常用的ROS命令
在这里记一下,以免以后忘记了。
----------------------------------------------------------------------------------------------------------------------
建立catkin工程:
catkin_create_pkg projectname roscpp sensor_msgs pcl_ros pcl_conversions
创建后可将cmakelists.txt中add_executable,add_dependencies,target_link_libraries这几行反注释掉。
打开ros master:
roscore
查看topic列表:
rostopic list -v
打印topic内容:
rostopic echo /topic
将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
发布base_link到velodyne的变换(use_sim_time设为true):
rosrun tf static_transform_publisher 0 0 0 0 0 0 base_link velodyne 0
保存地图:
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