1. 增加 source 到 bashrc 中
為了不用在小車的 Ubuntu 上每次都 source
自己的工作空間,我把自己的 workspace 加到 ~/.bashrc
文件末尾:
然后重啟 shell萄金,之后就會自動 source 我得工作空間振亮,可以使用 roscd 直接進(jìn)入指定包中:
roscd pkg_name
2. 編寫啟動 launch
每次調(diào)試小車挚瘟,都要分別啟動很多節(jié)點案淋,比如融合大年、建圖余佃、Loam蔽氨、Rviz 等傻工,所以我把這些節(jié)點全部配置在一個 launch 中啟動,直接一行命令啟動孵滞,這樣調(diào)試就方便多了中捆,大大節(jié)省時間:
-
lidar_camera_fusion\launch
:lidar_camera_fusion.launch
-
octomap_server\rviz
:octomap_debug.rviz
-
octomap_server\launch
:dlonng_octomap_test.launch
<launch>
<!-- Start ZED! -->
<include file = "$(find zed_cpu_ros)/launch/zed_cpu_ros.launch" />
<!-- Start Robosense LIDAR! -->
<include file = "$(find rslidar_pointcloud)/launch/rs_lidar_16.launch" />
<!-- Start fusion node! -->
<include file = "$(find lidar_camera_fusion)/launch/lidar_camera_fusion.launch" />
<!-- Start Octomap node! -->
<include file = "$(find octomap_server)/launch/octomap_server_start.launch" />
<!-- Start octomap_debug.rviz -->
<node pkg = "rviz" type = "rviz" name = "$(anon rviz)" respawn = "false" output = "screen" args = "-d $(find octomap_server)/rviz/octomap_debug.rviz"/>
<!-- Start Lego Loam! -->
<include file = "$(find lego_loam)/launch/demo.launch" />
<!-- Only using in map build test! -->
<node pkg = "tf2_ros" type = "static_transform_publisher" name = "dlonng_static_test_broadcaster" args = "0 0 0 0 0 0 base_link rslidar" />
</launch>
3. 補充一些小 Tips
如果不知道要啟動的包的 launch 文件叫啥,可以查找指定包的路徑坊饶,然后進(jìn)入看看 launch 文件夾下面的啟動文件叫啥:
rospack list | grep "zed_cpu_ros"
rospack list | grep "rslidar_pointcloud"
之后我就可以從 octomap_server 中一鍵啟動所有我建圖要用的節(jié)點了:
roslaunch octomap_server dlonng_octomap_test.launch
但是啟動過程中遇到 rviz 節(jié)點名字重復(fù)的問題泄伪,我把雷達(dá)啟動的 RVIZ 關(guān)掉或者把啟動 RVIZ 的節(jié)點名稱改變下,防止重復(fù)匿级。