1.命令
-
1.采集数据
- 采集所有话题:rosbag record -a
- 采集部分话题: rosbag record /chatter -o chat -o及后面的参数,是用来给bag文件命名的
- 采集特定节点订阅的话题:rosbag record --node=/joy_teleop
-
2.查看bag信息
- rosbag info /path/to/my.bag
- 查看特定的信息:rosbag info -y -k duration /path/to/my.bag
-
3.播放bag
- rosbag play recorded1.bag
- 同步:rosbag play --clock recorded1.bag
- 10倍速度播放:rosbag play -r 10 recorded1.bag
-
4.取子包
- 话题:rosbag filter in.bag out.bag “topic == ‘/tf’ or topic == ‘/tf2’”
- 时间:rosbag filter in.bag out.bag “t.to_sec() >= 123.4 and t.to_sec() <= 234.5”
2.问题
- 1.使用rosbag filter出现
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe8 in position 475: ordinal not in range(128)
- sudo vim /opt/ros/kinetic/lib/python2.7/dist-packages/genpy/dynamic.py
- 167+Enter到第168行
- 将tmp_file.file.write(full_text.encode())改为tmp_file.file.write(full_text)
- 保存,退出