message filters PoseWithCovarianceStamped
Dear Ros Users, I tried to use a message filters to sync two PoseWithCovarianceStamped topics
void callback(const geometrymsgs::PoseWithCovarianceStampedPtr& pose1, const geometrymsgs::PoseWithCovarianceStampedPtr& pose2)
{
...
}
messagefilters::Subscriber<geometrymsgs::PoseWithCovarianceStamped> posesub1(nh, "pose1", 1);
messagefilters::Subscriber posesub2(nh, "pose2", 1);
messagefilters::TimeSynchronizer <geometrymsgs::PoseWithCovarianceStamped, geometrymsgs::PoseWithCovarianceStamped> sync(posesub1, posesub2, 10);
sync.registerCallback(boost::bind(&callback, _1, _2));
but I got error at compile time:
/usr/include/boost/bind/bind.hpp:313:34: error: invalid initialization of reference of type ‘const boost::sharedptr<geometrymsgs::PoseWithCovarianceStampedstd::allocator<void > >&’ from expression of type ‘const boost::sharedptr
Asked by Rahndall on 2015-04-06 01:35:12 UTC
Answers
This error message is trying to tell you that it expects your callback to take a boost::shared_ptr (or the ConstPtr message subtype) for the first argument; not a reference to a object.
Try this instead:
void callback(const geometry_msgs::PoseWithCovarianceStampedConstPtr& pose_1, const geometry_msgs::PoseWithCovarianceStampedConstPtr& pose_2)
Asked by Leo Campos on 2017-07-28 14:45:09 UTC
Comments