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库的更多相关文章

  1. ROS常用库(四)API学习之常用common_msgs(下)

    一.前言 承接ROS常用库(三)API学习之常用common_msgs(上). 二.sensor_msgs 1.sensor_msgs / BatteryState.msg #电源状态 uint8 P ...

  2. ROS常用库(二) Serial库(单片机和上位机串口通讯)

    比如我们做了个单片机,在win里面用串口调试助手接收和下发数据,那么在ubuntu里用ros怎么实现?换个说法,怎么实现上位机和下位机的通讯? 首先,用python自带的库就可以实现这个功能. 安装p ...

  3. TX2 安装 ROS 依赖库错误解决办法

    一.更换ubuntu 16.04 更新源 1. 更新源 deb http://mirrors.ustc.edu.cn/ubuntu-ports/ xenial main multiverse rest ...

  4. ROS常用库(五)navigation之Tutorials

    一.TF 详见古月居 https://www.guyuehome.com/355 重点:广播TF,订阅,编译时Cmakelist添加编译选项 broadcaster.sendTransform( tf ...

  5. ROS常用库(三)API学习之常用common_msgs(上)

    一.概述 common_msgs包含其他ROS软件包广泛使用的消息.这些消息包括动作消息(actionlib_msgs),诊断消息(diagnostic_msgs),几何图元(geometry_msg ...

  6. ROS常用库(一) fake_localization

    wiki是最好的学习资料,以下直接参考了wiki官网.另外po出官网网址,建议英语较好的朋友之接看原版 http://wiki.ros.org/fake_localization 概述 fake_lo ...

  7. ROS初探:(一)ROS架构

    一.ROS架构 ROS架构上分为三个层级: 计算图级(Computation Graph level):体现进程与系统的关系,描述系统怎么运行. 文件系统级(Filesystem level):组织构 ...

  8. 快速了解 Robot Operating System(ROS) 机器人操作系统

     http://www.ros.org/ 关于ROS About ROS http://www.ros.org/about-ros/ 机器人操作系统(ROS)是用于编写机器人软件的灵活框架.目的在简化 ...

  9. ROS机器人程序设计(原书第2版)补充资料 (柒) 第七章 3D建模与仿真 urdf Gazebo V-Rep Webots Morse

    ROS机器人程序设计(原书第2版)补充资料 (柒) 第七章 3D建模与仿真 urdf Gazebo V-Rep Webots Morse 书中,大部分出现hydro的地方,直接替换为indigo或ja ...

  10. 关于ROS学习的一些反思

    距离发布上一篇ROS的博客已经过去两年了,才发现原来自己已经这么久可没有写过关于ROS的文章,想来很是惭愧.这两年时间,自己怀着程序员的梦想,研究过RTOS,探索过Linux,编写过Android应用 ...

随机推荐

  1. 2、postman调试

    Postman接口调试: postman博客参考 Postman是一个API(接口)开发协作平台,其提供了发送请求.检查响应.自动化测试.数据模拟.服务监控.文档分享等一系列与API(接口)开发有关的 ...

  2. [python] Python map函数总结

    Python map函数总结 本文主要介绍如何使用Python(Python3版本)的内置map()函数.简单来说map()函数会将指定的函数依次作用于某个序列的每个元素,并返回一个迭代器对象.map ...

  3. Redis缓存何以一枝独秀?——从百变应用场景与热门面试题中感受下Redis的核心特性与使用注意点

    大家好,又见面了. 本文是笔者作为掘金技术社区签约作者的身份输出的缓存专栏系列内容,将会通过系列专题,讲清楚缓存的方方面面.如果感兴趣,欢迎关注以获取后续更新. 作为<深入理解缓存原理与实战设计 ...

  4. 琐碎的想法(五)for 的前世今生

    for 起因 记得大学上C语言的课,第一次遇到的问题就是循环结构里面的 for. 选择结构的 if 非常易懂,和日常生活的判断没有区别. 循环结构的 while 同样比较好理解. 本质上是一个判断 如 ...

  5. [C++Primer] 第二章 变量和基本类型

    第二章 变量和基本类型 引用 引用定义的时候必须初始化. 引用初始化之后无法重新绑定到其它对象上. 引用本身并不是对象,所以没有指向引用的引用(不管如何多层引用,引用的还是源对象) 下面用一个简单的例 ...

  6. 算法学习笔记(5): 最近公共祖先(LCA)

    最近公共祖先(LCA) 目录 最近公共祖先(LCA) 定义 求法 方法一:树上倍增 朴素算法 复杂度分析 方法二:dfs序与ST表 初始化与查询 复杂度分析 方法三:树链剖分 DFS序 性质 重链 重 ...

  7. day03-Spring管理Bean-IOC-01

    Spring管理Bean-IOC 1.Spring配置/管理bean介绍 Bean管理包括两方面: 创建bean对象 给bean注入属性 Bean的配置方式: 基于xml文件配置方式 基于注解配置方式 ...

  8. QuartzNet在winform中使用(目前版本3.6)

    界面图"没有什么技术含量~   不过还是有部分人不太了解的 接下来一一解析下,勿q 使用步骤: 1.初始化帮助类 QuarztHelper x = new QuarztHelper(); 2 ...

  9. Vue02 Node下载安装

    转 https://blog.csdn.net/A_awen/article/details/121952701 1 下载 https://nodejs.org/en/download/ 2 安装 全 ...

  10. JAVA虚拟机09---垃圾回收---经典垃圾回收器

    1.Serial收集器 1.1简介 Serial收集器是最基础.历史最悠久的收集器,曾经(在JDK 1.3.1之前)是HotSpot虚拟机新生代收集器的唯一选择   1.2使用算法 标记-复制算法 1 ...