How to reuse old ROS bag files in the cyber RT?
Hi,
Is there any way to reuse the ROS bag files in the cyber RT in rc3.5? It looks like cyber has a similar tool for playback, cyber_record. But I failed to use it to play the old bag files; it complains "read header section failed".
Thanks, Junjie
System information
- OS Platform and Distribution (e.g., Linux Ubuntu 14.04): Ubunut 14.04
- Apollo installed from (source or binary): source
- Apollo version (1.0, 1.5, 2.0, 2.5, 3.0): rc3.5
I have the same problem.
Same question.
@davidhopper2003 Awesome! Thanks a lot!
I've figured it out. Please refer to this document:
rosbag_to_record demo_2.5.bag demo.record
Did you get images converted as well using this tool? Thanks
@luqiang21 Yes, I did. The screenshot is as follows.

@luqiang21 Yes, I did. The screenshot is as follows.
Thank you for your prompt reply. For images I mean these two channels:
/apollo/sensor/camera/front_6mm/image
/apollo/sensor/camera/front_6mm/image/compressed
I recorded them in a bag using apollo 3.0 and tried to convert it to record file. The file size reduced from 5.8 GB to 1.8 GB. Seems lots of information lost.
@luqiang21
The topics you have mentioned are currently not supported, you can add your own convertion logic in the file modules/data/tools/rosbag_to_record/rosbag_to_record.cc. The currently supported topics are shown as follows:
if (channel_name == "/apollo/perception/obstacles") {
auto pb_msg = m.instantiate<apollo::perception::PerceptionObstacles>();
pb_msg->SerializeToString(&serialized_str);
} else if (channel_name == "/apollo/planning") {
auto pb_msg = m.instantiate<apollo::planning::ADCTrajectory>();
pb_msg->SerializeToString(&serialized_str);
} else if (channel_name == "/apollo/prediction") {
auto pb_msg = m.instantiate<apollo::prediction::PredictionObstacles>();
pb_msg->SerializeToString(&serialized_str);
} else if (channel_name == "/apollo/canbus/chassis") {
auto pb_msg = m.instantiate<apollo::canbus::Chassis>();
pb_msg->SerializeToString(&serialized_str);
} else if (channel_name == "/apollo/control") {
auto pb_msg = m.instantiate<apollo::control::ControlCommand>();
pb_msg->SerializeToString(&serialized_str);
} else if (channel_name == "/apollo/guardian") {
auto pb_msg = m.instantiate<apollo::guardian::GuardianCommand>();
pb_msg->SerializeToString(&serialized_str);
} else if (channel_name == "/apollo/localization/pose") {
auto pb_msg = m.instantiate<apollo::localization::LocalizationEstimate>();
pb_msg->SerializeToString(&serialized_str);
} else if (channel_name == "/apollo/perception/traffic_light") {
auto pb_msg = m.instantiate<apollo::perception::TrafficLightDetection>();
pb_msg->SerializeToString(&serialized_str);
} else if (channel_name == "/apollo/drive_event") {
auto pb_msg = m.instantiate<apollo::common::DriveEvent>();
pb_msg->SerializeToString(&serialized_str);
} else if (channel_name == "/apollo/sensor/gnss/odometry") {
auto pb_msg = m.instantiate<apollo::localization::Gps>();
pb_msg->SerializeToString(&serialized_str);
} else if (channel_name == "/apollo/monitor/static_info") {
auto pb_msg = m.instantiate<apollo::data::StaticInfo>();
pb_msg->SerializeToString(&serialized_str);
} else if (channel_name == "/apollo/monitor") {
auto pb_msg = m.instantiate<apollo::common::monitor::MonitorMessage>();
pb_msg->SerializeToString(&serialized_str);
} else if (channel_name == "/apollo/canbus/chassis_detail") {
auto pb_msg = m.instantiate<apollo::canbus::ChassisDetail>();
pb_msg->SerializeToString(&serialized_str);
} else if (channel_name == "/apollo/control/pad") {
auto pb_msg = m.instantiate<apollo::control::PadMessage>();
pb_msg->SerializeToString(&serialized_str);
} else if (channel_name == "/apollo/navigation") {
auto pb_msg = m.instantiate<apollo::relative_map::NavigationInfo>();
pb_msg->SerializeToString(&serialized_str);
} else if (channel_name == "/apollo/routing_request") {
auto pb_msg = m.instantiate<apollo::routing::RoutingRequest>();
pb_msg->SerializeToString(&serialized_str);
} else if (channel_name == "/apollo/routing_response") {
auto pb_msg = m.instantiate<apollo::routing::RoutingResponse>();
pb_msg->SerializeToString(&serialized_str);
} else if (channel_name == "/tf" || channel_name == "/tf_static") {
// ...
} else if (channel_name == "/apollo/sensor/conti_radar") {
auto pb_msg = m.instantiate<apollo::drivers::ContiRadar>();
pb_msg->SerializeToString(&serialized_str);
} else if (channel_name == "/apollo/sensor/delphi_esr") {
auto pb_msg = m.instantiate<apollo::drivers::DelphiESR>();
pb_msg->SerializeToString(&serialized_str);
} else if (channel_name == "/apollo/sensor/gnss/best_pose") {
auto pb_msg = m.instantiate<apollo::drivers::gnss::GnssBestPose>();
pb_msg->SerializeToString(&serialized_str);
} else if (channel_name == "/apollo/sensor/gnss/imu") {
auto pb_msg = m.instantiate<apollo::drivers::gnss::Imu>();
pb_msg->SerializeToString(&serialized_str);
} else if (channel_name == "/apollo/sensor/gnss/ins_stat") {
auto pb_msg = m.instantiate<apollo::drivers::gnss::InsStat>();
pb_msg->SerializeToString(&serialized_str);
} else if (channel_name == "/apollo/sensor/gnss/rtk_eph") {
auto pb_msg = m.instantiate<apollo::drivers::gnss::GnssEphemeris>();
pb_msg->SerializeToString(&serialized_str);
} else if (channel_name == "/apollo/sensor/gnss/rtk_obs") {
auto pb_msg = m.instantiate<apollo::drivers::gnss::EpochObservation>();
pb_msg->SerializeToString(&serialized_str);
} else if (channel_name ==
"/apollo/sensor/velodyne64/compensator/PointCloud2") {
auto ros_msg = m.instantiate<sensor_msgs::PointCloud2>();
auto pb_msg = std::make_shared<apollo::drivers::PointCloud>();
convert_PointCloud(pb_msg, ros_msg);
pb_msg->SerializeToString(&serialized_str);
} else {
AWARN << "not support channel:" << channel_name;
continue;
}
@davidhopper2003 Thank you so much!