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

freidankm's profile - activity

2017-06-01 04:43:21 -0500 received badge  Famous Question (source)
2017-06-01 02:35:45 -0500 received badge  Notable Question (source)
2016-02-29 11:43:13 -0500 received badge  Popular Question (source)
2015-01-16 14:25:03 -0500 asked a question rosbag bag_player issue

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<sensor_msgs::LaserScan>(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&, <unresolved overloaded="" function="" type="">)’ bag_player.register_callback<sensor_msgs::laserscan>(scan_topic, &scanCallback);"

while indicating:

note: candidate is: template<class t=""> void rosbag::BagPlayer::register_callback(const string&, typename rosbag::BagCallbackT<t>::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