how to record and play back data?ROS

1、运行下面命令
roscore
rosrun turtlesim turtlesim_node 
rosrun turtlesim turtle_teleop_key


2、可有可无用于查看rostopic列表
rostopic list -v

display:
Published topics:
 * /turtle1/color_sensor [turtlesim/Color] 1 publisher
 * /rosout [rosgraph_msgs/Log] 3 publishers
 * /rosout_agg [rosgraph_msgs/Log] 1 publisher
 * /turtle1/cmd_vel [geometry_msgs/Twist] 1 publisher
 * /turtle1/pose [turtlesim/Pose] 1 publisher

Subscribed topics:
 * /rosout [rosgraph_msgs/Log] 1 subscriber
 * /chatter [std_msgs/String] 1 subscriber
 * /turtle1/cmd_vel [geometry_msgs/Twist] 1 subscriber
3、创建一个裤袋文件bagfiles  (ps: making a temporary directory to record data)
mkdir ~/bagfiles      
cd ~/bagfiles
rosbag record -a      # 生成begins with the year, data, and time and the suffix .bag
4、在~/bagfiles目录查看 .bag 文件
rosbag info <your bagfile>
we will see a list about: topic name主题名 、类型、每条主题包含的信息条数
This tells us topic names and types as well as the number (count) of each message topic contained in the bag file.
5、reproduce behavior in the running system重现行为:
rosbag play <your bagfile>
你会看到:
rosbag play <your bagfile>

6、记录数据的一个子集
线运行:rostopic list -v   查看 发布者和订阅着 选择你要记录的主题
rosbag record -O subset 主题1 主题2 主题3 ...
rosbag record -O subset /turtle1/cmd_vel /turtle1/pose
  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值