ROS librviz库
1、可视化管理类:rviz::VisualizationManager
The VisualizationManager class is the central manager class of rviz, holding all the Displays, Tools, ViewControllers, and other managers.
It keeps the current view controller for the main render window. It has a timer which calls update() on all the displays. It creates and holds pointers to the other manager objects: SelectionManager, FrameManager, the PropertyManager s, and Ogre::SceneManager.
/**
* \brief Constructor
* Creates managers and sets up global properties.
* @param render_panel a pointer to the main render panel widget of the app.
* @param wm a pointer to the window manager (which is really just a
* VisualizationFrame, the top-level container widget of rviz).
*/
explicit VisualizationManager(RenderPanel* render_panel, WindowManagerInterface* wm = nullptr);
在使用librviz时一般需要创建一个VisualizationManager对象,创建时给它指定渲染窗口RenderPanel,如下为在一个Qt运用的主窗口中嵌入librviz渲染窗口的示例:
// 创建渲染窗口,并将其添加到Qt主窗口布局中 render_panel_ = new rviz::RenderPanel();
QVBoxLayout* main_layout = new QVBoxLayout;
main_layout->addLayout( controls_layout );
main_layout->addWidget( render_panel_ );
setLayout( main_layout ); // 创建可视化管理对象 manager_ = new rviz::VisualizationManager( render_panel_ ); // 为渲染窗口关联场景相机及渲染上下文
render_panel_->initialize( manager_->getSceneManager(), manager_ ); // 初始化操作(必须,)
manager_->initialize(); // 启动刷新定时器,定时刷新librviz中的显示窗口
manager_->startUpdate();
用于管理Display的接口,Display就是rviz中左侧面板中可以显示的网格、坐标轴、话题等可视化元素
// 用于管理Display的接口,Display就是rviz中左侧面板中可以显示的网格、坐标轴、话题等可视化元素
/**
* \brief Create and add a display to this panel, by class lookup name
* @param class_lookup_name "lookup name" of the Display subclass, for pluginlib.
* Should be of the form "packagename/displaynameofclass", like "rviz/Image".
* @param name The name of this display instance shown on the GUI, like "Left arm camera".
* @param enabled Whether to start enabled
* @return A pointer to the new display.
*/
Display* createDisplay(const QString& class_lookup_name, const QString& name, bool enabled); /**
* \brief Add a display to be managed by this panel
* @param display The display to be added
*/
void addDisplay(Display* display, bool enabled); /**
* \brief Remove and delete all displays
*/
void removeAllDisplays();
示例:添加点云话题显示
m_pointCloud2 = m_rvizManager->createDisplay("rviz/PointCloud2","pointCloud2", true);
ROS_ASSERT(m_pointCloud2 != nullptr);
m_pointCloud2->subProp("Topic")->setValue("/pcd_points");
m_pointCloud2->subProp("Unreliable")->setValue("false");
m_pointCloud2->subProp("Selectable")->setValue("true");
m_pointCloud2->subProp("Style")->setValue("Flat Squares");
m_pointCloud2->subProp("Size (m)")->setValue("0.1");
m_pointCloud2->subProp("Alpha")->setValue("1");
m_pointCloud2->subProp("Decay Time")->setValue("0");
m_pointCloud2->subProp("Position Transformer")->setValue("XYZ");//
m_pointCloud2->subProp("Color Transformer")->setValue("Intensity");
m_pointCloud2->subProp("Queue Size")->setValue("10");
m_pointCloud2->subProp("Use rainbow")->setValue("true");
m_pointCloud2->subProp("Invert Rainbow")->setValue("false");
m_pointCloud2->subProp("Autocompute Intensity Bounds")->setValue("true");
// m_pointCloud2->subProp("Min Intensity")->setValue("1");
// m_pointCloud2->subProp("Max Intensity")->setValue("255");
m_rvizManager->setFixedFrame("hx_map");
rviz/PointCloud2是rviz提供的默认插件,其所有的属性设置均显示在左侧面板:
参考坐标系设置获取接口:
/** @brief Return the fixed frame name.
* @sa setFixedFrame() */
QString getFixedFrame() const override; /** @brief Set the coordinate frame we should be transforming all fixed data into.
* @param frame The name of the frame -- must match the frame name broadcast to libTF
* @sa getFixedFrame() */
void setFixedFrame(const QString& frame);
rviz配置保存与加载
/** @brief Load the properties of each Display and most editable rviz data.
*
* This is what is called when loading a "*.rviz" file.
*
* @param config The Config object to read from. Expected to be a Config::Map type.
* @sa save()
*/
void load(const Config& config); /**
* \brief Save the properties of each Display and most editable rviz
* data.
*
* This is what is called when saving a "*.vcg" file.
* \param config The object to write to.
* \sa loadDisplayConfig()
*/
void save(Config config) const;
还有其他接口暂未用到,具体可查看头文件:rviz/visualization_manager.h
ROS librviz库的更多相关文章
- ROS常用库(四)API学习之常用common_msgs(下)
一.前言 承接ROS常用库(三)API学习之常用common_msgs(上). 二.sensor_msgs 1.sensor_msgs / BatteryState.msg #电源状态 uint8 P ...
- ROS常用库(二) Serial库(单片机和上位机串口通讯)
比如我们做了个单片机,在win里面用串口调试助手接收和下发数据,那么在ubuntu里用ros怎么实现?换个说法,怎么实现上位机和下位机的通讯? 首先,用python自带的库就可以实现这个功能. 安装p ...
- TX2 安装 ROS 依赖库错误解决办法
一.更换ubuntu 16.04 更新源 1. 更新源 deb http://mirrors.ustc.edu.cn/ubuntu-ports/ xenial main multiverse rest ...
- ROS常用库(五)navigation之Tutorials
一.TF 详见古月居 https://www.guyuehome.com/355 重点:广播TF,订阅,编译时Cmakelist添加编译选项 broadcaster.sendTransform( tf ...
- ROS常用库(三)API学习之常用common_msgs(上)
一.概述 common_msgs包含其他ROS软件包广泛使用的消息.这些消息包括动作消息(actionlib_msgs),诊断消息(diagnostic_msgs),几何图元(geometry_msg ...
- ROS常用库(一) fake_localization
wiki是最好的学习资料,以下直接参考了wiki官网.另外po出官网网址,建议英语较好的朋友之接看原版 http://wiki.ros.org/fake_localization 概述 fake_lo ...
- ROS初探:(一)ROS架构
一.ROS架构 ROS架构上分为三个层级: 计算图级(Computation Graph level):体现进程与系统的关系,描述系统怎么运行. 文件系统级(Filesystem level):组织构 ...
- 快速了解 Robot Operating System(ROS) 机器人操作系统
http://www.ros.org/ 关于ROS About ROS http://www.ros.org/about-ros/ 机器人操作系统(ROS)是用于编写机器人软件的灵活框架.目的在简化 ...
- ROS机器人程序设计(原书第2版)补充资料 (柒) 第七章 3D建模与仿真 urdf Gazebo V-Rep Webots Morse
ROS机器人程序设计(原书第2版)补充资料 (柒) 第七章 3D建模与仿真 urdf Gazebo V-Rep Webots Morse 书中,大部分出现hydro的地方,直接替换为indigo或ja ...
- 关于ROS学习的一些反思
距离发布上一篇ROS的博客已经过去两年了,才发现原来自己已经这么久可没有写过关于ROS的文章,想来很是惭愧.这两年时间,自己怀着程序员的梦想,研究过RTOS,探索过Linux,编写过Android应用 ...
随机推荐
- 用Python来写个小型购物车程序
0x1 前言 Python语言能做很多东西的,像数据分析啊.自动化.开发. 爬虫(真的很棒哟,初学者玩很有成就感的啊哈哈)等等还有挺多. 0x2 用Python编写的一个小型购物车程序 import ...
- 记录Typescript的学习调试笔记(比 javascript更具面向对象,强类型检查,静态字段,适合现代的大团队分工与管理风格).
1.)先来一段Typescript的环境安装. 安装nodejs ,下载地址:https://nodejs.org/en/download/ //(node-v12.1 ...
- yolov5数据集制作 数据集分割+voc格式转txt格式代码
先上数据集分割代码 网上没找到合适的 自己写了一个 分割比例为0.6 :0.2 :0.2 import os import random oriImgDir = "./change14img ...
- Kubernetes 部署 - DevOps CI/CD详细指南
什么是Kubernetes部署? 在此文章中,我们将探索Kubernetes(K8s),结合DigitalOcean Kubernetes集群与Buddy自动化运维系统部署以达到以下列出的目标: 使 ...
- 聊聊web漏洞挖掘第一期
之前写2022年度总结的时候,有提到要给大家分享漏洞挖掘技巧.这里简单分享一些思路,更多的内容需要大家举一反三. 文章准备昨晚写的,昨天晚上出去唱歌,回来太晚了,耽搁了.昨天是我工作的last day ...
- 算法学习笔记(8.1): 网络最大流算法 EK, Dinic, ISAP
网络最大流 目录 网络最大流 EK 增广路算法 Dinic ISAP 作者有话说 前置知识以及更多芝士参考下述链接 网络流合集链接:网络流 最大流,值得是在不超过管道(边)容量的情况下从源点到汇点最多 ...
- 在GCP上创建Cloud SQL的三种方式(Console,gcloud,Terraform)
1 简介 Cloud SQL 是GCP上的关系型数据库,常用的有三种方式来创建: (1) 界面操作 (2) 命令行 gcloud (3) Terraform 在开始之前,可以查看:<初始化一个G ...
- 02-RTL代码分析思路
RTL代码分析思路(这里不进行具体代码的分析) verilog文件是以.v结尾的 1 RTL代码示例 //Date : 2023-01-09 //E-mail : xxxxxx@163.com //c ...
- flutter 设置Appbar上面的电池显示的状态栏的背景与颜色
写代码,修改了一下Appbar后,发现这个顶部颜色不对劲 找到这个文件lib\main.dart import 'dart:io'; import 'package:flutter/services. ...
- JS循环类数组对象,获得页面所有的某个ClssaName,处理它的属性
举例:获得所有的某个ClssaName,处理它的第一个子元素中的title赋值给内容 let links = Array.from(document.getElementsByClassName('m ...