赞
踩
1、创建catkin_ws工作区
- #!/bin/bash
-
- mkdir -p ~/catkin_ws/src
-
- cd ~/catkin_ws/src
-
- catkin_init_workspace
-
- cd ~/catkin_ws/
-
- catkin_make
-
- source devel/setup.bash
-
- source /opt/ros/kinetic/setup.bash
2、创建插件
- #!/bin/bash
-
- source /opt/ros/kinetic/setup.bash
-
- #rviz_wxcollect_commander
- rviz_plugin_name=rviz_wxcollect_commander
-
- catkin_create_pkg ${rviz_plugin_name} roscpp rviz std_msgs
- rm -rf ${rviz_plugin_name}/include
- cd ${rviz_plugin_name}/src
- touch ${rviz_plugin_name}.h ${rviz_plugin_name}.cpp
- cd ../
- touch >>plugin_description.xml
3、写插件逻辑,可以增加ui文件。
- set(CMAKE_INCLUDE_CURRENT_DIR ON)
- #这一句加上,不然找不到ui_xxxx.h
- qt5_wrap_ui(ui_FILES src/rviz_wxcollect_commander.ui)
4、编译插件
- catkin_ws目录下执行
- source /opt/ros/kinetic/setup.sh
- catkin_make
- source devel/setup.bash #否则找不到插件
5、启动rviz
- source /opt/ros/kinetic/setup.bash
- rosrun rviz rviz
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。