經常使用的ROS命令

在這裏記一下,以避免之後忘記了。node

----------------------------------------------------------------------------------------------------------------------spa

創建catkin工程:code

catkin_create_pkg projectname roscpp sensor_msgs pcl_ros pcl_conversionsserver

打開ros master:blog

roscoreqt

查看topic列表:io

rostopic list -vast

打印topic內容:class

rostopic echo /topicstream

將bag轉爲pcd:

rosrun pcl_ros bag_to_pcd out.bag /velodyne_points ./pcd/

打開界面:

rviz

錄製topic作出bag:

rosbag record -o out.bag /velodyne_points

查看bag信息:

rosbag info out.bag

查看topic發送接收圖:

rosrun rqt_graph rqt_graph

重映射topic信息(將out.bag中point_cloud轉爲velodyne_points):

rosbag play out.bag  /point_cloud:=/velodyne_points

將point_cloud轉爲laserscan:

rosrun pointcloud_to_laserscan pointcloud_to_laserscan_node cloud_in:=/your_velodyne_points

查看bag中對應topic的frame_id:

rostopic echo /topic | grep frame_id

查看tf樹:

rosrun rqt_tf_tree rqt_tf_tree

保存地圖:

rosrun map_server map_saver -f my_map

將cartographer生成的pbstream導出爲ros標準地圖:

首先新建offline_pbstream_to_rosmap.launch

<launch>
  <node name="cartographer_pbstream_to_ros_map" pkg="cartographer_ros"
      type="cartographer_pbstream_to_ros_map" args="
          -pbstream_filename $(arg pbstream_filename)
          -map_filestem $(arg map_filestem)
          -resolution $(arg resolution)"
      output="screen">
  </node>
</launch>

再輸入以下命令:

roslaunch cartographer_ros offline_pbstream_to_rosmap.launch pbstream_filename:=/home/out.pbstream map_filestem:=/home/out resolution:=0.05

相關文章
相關標籤/搜索