8.16 Bag Recording Interfaces
8.16.1 Built‑in Recording Method
You can use the provided launch files to start ROS 2 topic recording and store data in the default path /home/ubuntu/bags.
Recording is split into 100 MB bag files, and the maximum storage capacity for the recording directory is 2 GB. When the limit is exceeded, the oldest folders and bag files are automatically deleted. Applicable to all Walker Tienkung models.
# Record specified topics as configured in:
# /home/ubuntu/ros2ws/install/utils/lib/utils/topics.config
# The default list contains key topics for body control.
ros2 launch utils record_config_topic.py
# Record all topics
ros2 launch utils record_all_topic.py
8.16.2 Generic ROS 2 Recording and Playback
1. Specify Storage Location and Name
ros2 bag record -o /home/ubuntu/bag_record/{id} /joint_states
# -o specifies the storage path; {id} can be set as needed
# /joint_states is the topic to be recorded
2. View Recording Information
ros2 bag info /home/ubuntu/bag_record/{id}
# View bag information
3. Play Back Recorded Data
Before playback, stop the node that publishes the corresponding topics; otherwise, message conflicts may occur and cause incorrect behavior.
ros2 bag play /home/ubuntu/bag_record/{id}
# Play the recorded data