Save data while robot is working.
So, you can analyze later.
mkdir bags
cd bags
ros2 bag # info, play, record
ros2 bag record {topic to record, ex) /number} -o {name of your file_name}
Save multiple topics
ros2 bag record {topic1} {topic2} -o {name of your file_name}
play exactly same when it is published.
ros2 bag play {name of your file_name}