message_filter synchronize boolean msg
Hello I want to add a boolean msg in my synchronizer but it seems that BoolConstPtr definition in the callback function is not working. Here is my class and callback dsefiniton.
class LandingNode {
public:
LandingNode (ros::NodeHandle &nh);
~LandingNode ();
void proc_callback (const sensor_msgs::ImageConstPtr& msgLeft,const sensor_msgs::ImageConstPtr& msgRight, const std_msgs::BoolConstPtr& msgHover);
private:
typedef message_filters::sync_policies::ApproximateTime<sensor_msgs::Image, sensor_msgs::Image, std_msgs::Bool> sync_pol;
message_filters::Subscriber<sensor_msgs::Image> *sub_left;
message_filters::Subscriber<sensor_msgs::Image> *sub_right;
message_filters::Subscriber<std_msgs::Bool> *sub_hover;
message_filters::Synchronizer<sync_pol> *sync_;
};
LandingNode::LandingNode( ros::NodeHandle &nh) {
sub_left = new message_filters::Subscriber<sensor_msgs::Image> (nh, "/left/image_raw", 10);
sub_right = new message_filters::Subscriber<sensor_msgs::Image> (nh, "/right/image_raw", 10);
sub_hover = new message_filters::Subscriber<std_msgs::Bool> (nh, "/is_hover", 10);
sync_ = new message_filters::Synchronizer<sync_pol> (sync_pol(10), *sub_left, *sub_right, *sub_hover);
sync_->registerCallback(boost::bind(&LandingNode::proc_callback, this, _1, _2, _3));
boost::thread t = boost::thread(boost::bind(&spinthread));
}
void LandingNode::proc_callback(const sensor_msgs::ImageConstPtr& msgLeft, const sensor_msgs::ImageConstPtr& msgRight, const std_msgs::BoolConstPtr& msgHover) {
i see the following errors
error: ‘__s_getMD5Sum’ is not a member of ‘boost::shared_ptr<const std_msgs::Bool_<std::allocator<void> > >’
return M::__s_getMD5Sum().c_str();
error: ‘value’ is not a member of ‘ros::message_traits::TimeStamp<std_msgs::Bool_<std::allocator<void> >, void>’
ros::Time msg_time = mt::TimeStamp<typename mpl::at_c<Messages, i>::type>::value(msg);
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~
error: ‘value’ is not a member of ‘ros::message_traits::TimeStamp<std_msgs::Bool_<std::allocator<void> >, void>’
if ((mt::TimeStamp<M2>::value(*m2.getMessage()) < time) ^ end)
~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~
/opt/ros/melodic/include/message_filters/sync_policies/approximate_time.h:565:40: error: ‘value’ is not a member of ‘ros::message_traits::TimeStamp<std_msgs::Bool_<std::allocator<void> >, void>’
time = mt::TimeStamp<M2>::value(*m2.getMessage());
~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~
The whole terminal msg id the following
opt/ros/melodic/include/message_filters/subscriber.h:146:7: required from ‘void message_filters::Subscriber<M>::subscribe(ros::NodeHandle&, const string&, uint32_t, const ros::TransportHints&, ros::CallbackQueueInterface*) [with M = boost::shared_ptr<const std_msgs::Bool_<std::allocator<void> > >; std::__cxx11::string = std::__cxx11::basic_string<char>; uint32_t = unsigned int]’
/opt/ros/melodic/include/message_filters/subscriber.h:114:14: required from ‘message_filters::Subscriber<M>::Subscriber(ros::NodeHandle&, const string&, uint32_t, const ros::TransportHints&, ros::CallbackQueueInterface*) [with M = boost::shared_ptr<const std_msgs::Bool_<std::allocator<void> > >; std::__cxx11::string = std::__cxx11::basic_string<char>; uint32_t = unsigned int]’
/home/ubuntu/catkin_ws/src/landing/src/landing2.cpp:52:93: required from here
/opt/ros/melodic/include/ros/message_traits.h:121:28: error: ‘__s_getMD5Sum’ is not a member of ‘boost::shared_ptr<const std_msgs::Bool_<std::allocator<void> > >’
return M::__s_getMD5Sum().c_str();
~~~~~~~~~~~~~~~~^~
/opt/ros/melodic/include/ros/message_traits.h: In instantiation of ‘static const char* ros::message_traits::DataType<M>::value() [with M = boost::shared_ptr<const std_msgs::Bool_<std::allocator<void> > >]’:
/opt/ros/melodic/include/ros/message_traits.h:237:104: required from ‘const char* ros::message_traits::datatype() [with M = boost::shared_ptr<const std_msgs::Bool_<std::allocator<void> > >]’
/opt/ros/melodic/include/ros/subscribe_options.h:90:53: required from ‘void ros::SubscribeOptions::initByFullCallbackType(const string&, uint32_t, const boost::function<void(P)>&, const boost::function<boost::shared_ptr<typename ros::ParameterAdapter<P>::Message>()>&) [with P = const ros::MessageEvent<const boost::shared_ptr<const std_msgs::Bool_<std::allocator<void> > > >&; std::__cxx11::string = std::__cxx11::basic_string<char>; uint32_t = unsigned int; typename ros::ParameterAdapter<P>::Message = boost::shared_ptr<const std_msgs::Bool_<std::allocator<void> > >]’
/opt ...