ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
Change your commented out lines to:
typedef sync_policies::ApproximateTime<myMsg, myMsg> MySyncPolicy;
typedef Synchronizer<MySyncPolicy> Sync;
boost::shared_ptr<Sync> sync;
In your constructor initialize and register:
sync.reset(new Sync(MySyncPolicy(10), sub1, sub2));
sync->registerCallback(boost::bind(&Node::callback, this, _1, _2));
2 | No.2 Revision |
Change your commented out lines to:
typedef sync_policies::ApproximateTime<myMsg, myMsg> MySyncPolicy;
typedef Synchronizer<MySyncPolicy> Sync;
boost::shared_ptr<Sync> sync;
In your constructor initialize and register:
sync.reset(new Sync(MySyncPolicy(10), sub1, sub2));
sync->registerCallback(boost::bind(&Node::callback, this, _1, _2));
Update
A couple of other things to keep in mind.
std_msgs/Header
field so that message times can be compared.void callback(const myMsgConstPtr &in1, const myMsgConstPtr &in2)
.With those types of changes I was able to get a node to compile that basically mimics what you have. I had to substitue myMsg
for sensor_msgs/Image
in order to use a message type I have access to.
3 | No.3 Revision |
Change your commented out lines to:
typedef sync_policies::ApproximateTime<myMsg, myMsg> MySyncPolicy;
typedef Synchronizer<MySyncPolicy> Sync;
boost::shared_ptr<Sync> sync;
In your constructor initialize and register:
sync.reset(new Sync(MySyncPolicy(10), sub1, sub2));
sync->registerCallback(boost::bind(&Node::callback, this, _1, _2));
Update
A couple of other things to keep in mind.
std_msgs/Header
field so that message times can be compared.void callback(const myMsgConstPtr control_sys::IntWithHeaderConstPtr &in1, const myMsgConstPtr control_sys::IntWithHeaderConstPtr &in2)
.With those types of changes I was able to get a node to compile that basically mimics what you have. I had to substitue myMsg
for sensor_msgs/Image
in order to use a message type I have access to.