ROS学习记录

ROS话题(topic)映射

  1. 直接运行ROS节点并在命令行中映射
    :用Intel RealSense T265运行ORB-SLAM3时,可以将鱼眼相机的话题/camera/fisheye1/image_raw映射为代码中的话题/camera/left/image_raw
rosrun ORB_SLAM3 Stereo_Inertial Vocabulary/ORBvoc.txt ./Examples/ROS/ORB_SLAM3/IntelRealSenseT265.yaml  /camera/left/image_raw:=/camera/fisheye1/image_raw  /camera/left/image_raw:=/camera/fisheye2/image_raw   /imu:=/camera/imu false 
  1. 播放数据包bag并在命令行中进行映射
rosbag play --pause THU_Campus1.bag /camera/fisheye1/image_raw:/camera/left/image_raw /camera/fisheye2/image_raw:=/camera/left/image_raw /camera/imu:=/imu
# 添加`--pause`参数后,按空格键可以对数据包进行暂停或者开始
  1. 使用remap标签在launch文件中进行重映射
    待添加

ROS中rosbag命令

  1. 录制数据包
rosbag record -a
# 录制全部的话题

rosbag record -O ThuCampus.bag /camera/fisheye1/image_raw /camera/fisheye2/image_raw /camera/imu
# 将数据包文件起名为ThuCampus.bag
# 录制了三个话题
# /camera/fisheye1/image_raw
# /camera/fisheye2/image_raw
# /camera/imu

rosbag record --split --size=1024 /camera/fisheye1/image_raw
# 单位MB
rosbag record --split --duration=30 /camera/fisheye1/image_raw
# 录制30秒
rosbag record --split --duration=5m /camera/fisheye1/image_raw
# 录制5分钟
rosbag record --split --duration=2h /camera/fisheye1/image_raw
# 录制2小时
  1. 剪辑数据包
# 表达式
filter   
# 例子
rosbag filter my.bag out.bag "topic == '/camera/fisheye1/image_raw' or topic == '/camera/fisheye2/image_raw'" # 根据话题进行剪辑
rosbag filter my.bag out.bag "t.to_sec() >= 123444.77 and t.to_sec() <= 234545.88" # 根据时间进行剪辑

你可能感兴趣的:(ROS学习记录)