Hello,
I am trying to write a node to edit the timestamps in a bag file, using C++. The code I have written is attached below. I have tried to follow the template given in the rosbag C++ API, but I am unable to open any of the bag files I have, even though they run perfectly well when I play them back using rosbag play. Specifically, I am seeing the error message
terminate called after throwing an instance of 'rosbag::BagIOException'
what(): Error opening file: ~/catkin_ws/src/publish_text/launch/filtered.bag
I am not quite sure why exactly this is happening. Would greatly appreciate it if anyone had any suggestions!
Thanks. (Code from the main function of my code enclosed below)
ros::init(argc, argv, "postprocessing");
ros::NodeHandle nh("~");
std::string instr, outstr;
rosbag::Bag inbag, outbag;
if (nh.getParam("input_path", instr)) {
inbag.open(instr, rosbag::bagmode::Read);
} else {
ROS_ERROR("No input path provided, terminating\n");
exit(1);
}
if (!nh.getParam("output_path", outstr)) {
outbag.open(outstr, rosbag::bagmode::Write);
} else {
ROS_ERROR("No output path provided, terminating\n");
exit(1);
}
↧