Hello everyone,
i am trying to play a bagfile in c++ code using the "bag_player" class, but cannot find a way to
satisfy the second argument of the "register_callback" method.
The code in question currently looks like this:
void LocalizeSimulation::loadBagFile(std::string filename) {
rosbag::BagPlayer bag_player(filename);
bagplayer_ = &bag_player;
bag_.open(filename, rosbag::bagmode::Read);
rosbag::View view(bag_);
bag_player.set_start(view.getBeginTime());
bag_player.set_end(view.getEndTime());
bag_player.start_play();
const std::string scan_topic = "/scan";
bag_player.register_callback(scan_topic, &scanCallback);}
and my scanCallback method like this:
void LocalizeSimulation::scanCallback(sensor_msgs::LaserScan::ConstPtr& scan) {}
But compiling the file yields the error "error: no matching function for call to ‘rosbag::BagPlayer::register_callback(const string&, )’
bag_player.register_callback(scan_topic, &scanCallback);"
while indicating:
note: candidate is: template void rosbag::BagPlayer::register_callback(const string&, typename rosbag::BagCallbackT::Callback)
Attempts to change the method signature to a template have failed and so have numerous attempts at changing the "&scanCallback" argument, e.g. using boost::bind. Unfortunately, there don't appear to be many example uses of the BagPlayer class so I require help from you guys.
Big Thanks in advance
freidankm
↧