ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

You are writing empty message objects into your bag file:

print "RECORDING NEW BAG"
bag.write("tf",tfMsg)
bag.write("/cameras/right_hand_camera/image",Image())
bag.write("/cameras/left_hand_camera/image",Image())
bag.write("/robot/joint_states",JointState())
bag.write("/robot/end_effector/right_gripper/state",EndEffectorState())
bag.write("/robot/end_effector/left_gripper/state",EndEffectorState())
bag.write("/softkinetic_left/rgb/image_color",Image())
bag.write("/softkinetic_right/rgb/image_color",Image())
bag.write("/softkinetic_left/depth/image_raw",Image())
bag.write("/softkinetic_right/depth/image_raw",Image())
bag.write("/camera/rgb/image_color",Image())
bag.write("/camera/depth/image_raw",Image())

bag.write() writes the message object that you give it to the bag file with the specific topic name. Since you're supplying default-constructed messages (which are empty), that's what it is writing to the bag file.

If you want to subscribe to a topic and record the messages on that topic to a bag, you need to either call the robag command-line tool from your program and let it subscribe, or you need to create subscribers on each of the topics that you care about, and then actually write the received messages to the bag file.