当前位置:   article > 正文

rviz二次开发

rviz二次开发

1、创建catkin_ws工作区

  1. #!/bin/bash
  2. mkdir -p ~/catkin_ws/src
  3. cd ~/catkin_ws/src
  4. catkin_init_workspace
  5. cd ~/catkin_ws/
  6. catkin_make
  7. source devel/setup.bash
  8. source /opt/ros/kinetic/setup.bash

2、创建插件

  1. #!/bin/bash
  2. source /opt/ros/kinetic/setup.bash
  3. #rviz_wxcollect_commander
  4. rviz_plugin_name=rviz_wxcollect_commander
  5. catkin_create_pkg ${rviz_plugin_name} roscpp rviz std_msgs
  6. rm -rf ${rviz_plugin_name}/include
  7. cd ${rviz_plugin_name}/src
  8. touch ${rviz_plugin_name}.h ${rviz_plugin_name}.cpp
  9. cd ../
  10. touch >>plugin_description.xml

3、写插件逻辑,可以增加ui文件。

  1. set(CMAKE_INCLUDE_CURRENT_DIR ON)
  2. #这一句加上,不然找不到ui_xxxx.h
  3. qt5_wrap_ui(ui_FILES src/rviz_wxcollect_commander.ui)

4、编译插件

  1. catkin_ws目录下执行
  2. source /opt/ros/kinetic/setup.sh
  3. catkin_make
  4. source devel/setup.bash #否则找不到插件

5、启动rviz

  1. source /opt/ros/kinetic/setup.bash
  2. rosrun rviz rviz

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/不正经/article/detail/623637
推荐阅读
相关标签
  

闽ICP备14008679号