0
$\begingroup$

Rosanswers logo

Hello, I want to use message_filters on different msg types aswell as my custom msgs later on.. But it does not seem to work with PoseStamped. Marker and PointCloud2 together work.

I made sure that every message has a Header from std_msgs, but still not working..

Error Message:

usr/include/boost/bind/bind.hpp: In instantiation of ‘struct boost::_bi::result_traits<boost::_bi::unspecified, void (*)(const boost::shared_ptr<const sensor_msgs::PointCloud2_<std::allocator<void> > >&, const boost::shared_ptr<const visualization_msgs::Marker_<std::allocator<void> > >&, const boost::shared_ptr<const geometry_msgs::PoseStamped_<std::allocator<void> > >&)>’:
/usr/include/boost/bind/bind.hpp:883:48:   required from ‘class boost::_bi::bind_t<boost::_bi::unspecified, void (*)(const boost::shared_ptr<const sensor_msgs::PointCloud2_<std::allocator<void> > >&, const boost::shared_ptr<const visualization_msgs::Marker_<std::allocator<void> > >&, const boost::shared_ptr<const geometry_msgs::PoseStamped_<std::allocator<void> > >&), boost::_bi::list2<boost::arg<1>, boost::arg<2> > >’
/home/umut/catkin_ws/src/scan_matching/src/listener.cpp:60:54:   required from here
/usr/include/boost/bind/bind.hpp:69:37: error: ‘void (*)(const boost::shared_ptr<const sensor_msgs::PointCloud2_<std::allocator<void> > >&, const boost::shared_ptr<const visualization_msgs::Marker_<std::allocator<void> > >&, const boost::shared_ptr<const geometry_msgs::PoseStamped_<std::allocator<void> > >&)’ is not a class, struct, or union type
     typedef typename F::result_type type;
                                     ^
In file included from /usr/include/boost/function/detail/maybe_include.hpp:58:0,
                 from /usr/include/boost/function/detail/function_iterate.hpp:14,
                 from /usr/include/boost/preprocessor/iteration/detail/iter/forward1.hpp:92,
                 from /usr/include/boost/function.hpp:64,
                 from /opt/ros/kinetic/include/ros/forwards.h:40,
                 from /opt/ros/kinetic/include/ros/common.h:37,
                 from /opt/ros/kinetic/include/ros/ros.h:43,
                 from /home/umut/catkin_ws/src/scan_matching/src/listener.cpp:2:
/usr/include/boost/function/function_template.hpp: In instantiation of ‘static void boost::detail::function::void_function_obj_invoker9<FunctionObj, R, T0, T1, T2, T3, T4, T5, T6, T7, T8>::invoke(boost::detail::function::function_buffer&, T0, T1, T2, T3, T4, T5, T6, T7, T8) [with FunctionObj = boost::_bi::bind_t<boost::_bi::unspecified, boost::_bi::bind_t<boost::_bi::unspecified, void (*)(const boost::shared_ptr<const sensor_msgs::PointCloud2_<std::allocator<void> > >&, const boost::shared_ptr<const visualization_msgs::Marker_<std::allocator<void> > >&, const boost::shared_ptr<const geometry_msgs::PoseStamped_<std::allocator<void> > >&), boost::_bi::list2<boost::arg<1>, boost::arg<2> > >, boost::_bi::list9<boost::arg<1>, boost::arg<2>, boost::arg<3>, boost::arg<4>, boost::arg<5>, boost::arg<6>, boost::arg<7>, boost::arg<8>, boost::arg<9> > >; R = void; T0 = const boost::shared_ptr<const sensor_msgs::PointCloud2_<std::allocator<void> > >&; T1 = const boost::shared_ptr<const visualization_msgs::Marker_<std::allocator<void> > >&; T2 = const boost::shared_ptr<const geometry_msgs::PoseStamped_<std::allocator<void> > >&; T3 = const boost::shared_ptr<const message_filters::NullType>&; T4 = const boost::shared_ptr<const message_filters::NullType>&; T5 = const boost::shared_ptr<const message_filters::NullType>&; T6 = const boost::shared_ptr<const message_filters::NullType>&; T7 = const boost::shared_ptr<const message_filters::NullType>&; T8 = const boost::shared_ptr<const message_filters::NullType>&]’:
/usr/include/boost/function/function_template.hpp:940:38:   required from ‘void boost::function9<R, T1, T2, T3, T4, T5, T6, T7, T8, T9>::assign_to(Functor) [with Functor = boost::_bi::bind_t<boost::_bi::unspecified, boost::_bi::bind_t<boost::_bi::unspecified, void (*)(const boost::shared_ptr<const sensor_msgs::PointCloud2_<std::allocator<void> > >&, const boost::shared_ptr<const visualization_msgs::Marker_<std::allocator<void> > >&, const boost::shared_ptr<const geometry_msgs::PoseStamped_<std::allocator<void> > >&), boost::_bi::list2<boost::arg<1>, boost::arg<2> > >, boost::_bi::list9<boost::arg<1>, boost::arg<2>, boost::arg<3>, boost::arg<4>, boost::arg<5>, boost::arg<6>, boost::arg<7>, boost::arg<8>, boost::arg<9> > >; R = void; T0 = const boost::shared_ptr<const sensor_msgs::PointCloud2_<std::allocator<void> > >&; T1 = const boost::shared_ptr<const visualization_msgs::Marker_<std::allocator<void> > >&; T2 = const boost::shared_ptr<const geometry_msgs::PoseStamped_<std::allocator<void> > >&; T3 = const boost::shared_ptr<const message_filters::NullType>&; T4 = const boost::shared_ptr<const message_filters::NullType>&; T5 = const boost::shared_ptr<const message_filters::NullType>&; T6 = const boost::shared_ptr<const message_filters::NullType>&; T7 = const boost::shared_ptr<const message_filters::NullType>&; T8 = const boost::shared_ptr<const message_filters::NullType>&]’
/usr/include/boost/function/function_template.hpp:728:7:   required from ‘boost::function9<R, T1, T2, T3, T4, T5, T6, T7, T8, T9>::function9(Functor, typename boost::enable_if_c<(boost::type_traits::ice_not<(boost::is_integral<Functor>::value)>::value), int>::type) [with Functor = boost::_bi::bind_t<boost::_bi::unspecified, boost::_bi::bind_t<boost::_bi::unspecified, void (*)(const boost::shared_ptr<const sensor_msgs::PointCloud2_<std::allocator<void> > >&, const boost::shared_ptr<const visualization_msgs::Marker_<std::allocator<void> > >&, const boost::shared_ptr<const geometry_msgs::PoseStamped_<std::allocator<void> > >&), boost::_bi::list2<boost::arg<1>, boost::arg<2> > >, boost::_bi::list9<boost::arg<1>, boost::arg<2>, boost::arg<3>, boost::arg<4>, boost::arg<5>, boost::arg<6>, boost::arg<7>, boost::arg<8>, boost::arg<9> > >; R = void; T0 = const boost::shared_ptr<const sensor_msgs::PointCloud2_<std::allocator<void> > >&; T1 = const boost::shared_ptr<const visualization_msgs::Marker_<std::allocator<void> > >&; T2 = const boost::shared_ptr<const geometry_msgs::PoseStamped_<std::allocator<void> > >&; T3 = const boost::shared_ptr<const message_filters::NullType>&; T4 = const boost::shared_ptr<const message_filters::NullType>&; T5 = const boost::shared_ptr<const message_filters::NullType>&; T6 = const boost::shared_ptr<const message_filters::NullType>&; T7 = const boost::shared_ptr<const message_filters::NullType>&; T8 = const boost::shared_ptr<const message_filters::NullType>&; typename boost::enable_if_c<(boost::type_traits::ice_not<(boost::is_integral<Functor>::value)>::value), int>::type = int]’
/usr/include/boost/function/function_template.hpp:1077:16:   required from ‘boost::function<R(T0, T1, T2, T3, T4, T5, T6, T7, T8)>::function(Functor, typename boost::enable_if_c<(boost::type_traits::ice_not<(boost::is_integral<Functor>::value)>::value), int>::type) [with Functor = boost::_bi::bind_t<boost::_bi::unspecified, boost::_bi::bind_t<boost::_bi::unspecified, void (*)(const boost::shared_ptr<const sensor_msgs::PointCloud2_<std::allocator<void> > >&, const boost::shared_ptr<const visualization_msgs::Marker_<std::allocator<void> > >&, const boost::shared_ptr<const geometry_msgs::PoseStamped_<std::allocator<void> > >&), boost::_bi::list2<boost::arg<1>, boost::arg<2> > >, boost::_bi::list9<boost::arg<1>, boost::arg<2>, boost::arg<3>, boost::arg<4>, boost::arg<5>, boost::arg<6>, boost::arg<7>, boost::arg<8>, boost::arg<9> > >; R = void; T0 = const boost::shared_ptr<const sensor_msgs::PointCloud2_<std::allocator<void> > >&; T1 = const boost::shared_ptr<const visualization_msgs::Marker_<std::allocator<void> > >&; T2 = const boost::shared_ptr<const geometry_msgs::PoseStamped_<std::allocator<void> > >&; T3 = const boost::shared_ptr<const message_filters::NullType>&; T4 = const boost::shared_ptr<const message_filters::NullType>&; T5 = const boost::shared_ptr<const message_filters::NullType>&; T6 = const boost::shared_ptr<const message_filters::NullType>&; T7 = const boost::shared_ptr<const message_filters::NullType>&; T8 = const boost::shared_ptr<const message_filters::NullType>&; typename boost::enable_if_c<(boost::type_traits::ice_not<(boost::is_integral<Functor>::value)>::value), int>::type = int]’
/opt/ros/kinetic/include/message_filters/signal9.h:281:40:   required from ‘message_filters::Connection message_filters::Signal9<M0, M1, M2, M3, M4, M5, M6, M7, M8>::addCallback(C&) [with C = const boost::_bi::bind_t<boost::_bi::unspecified, void (*)(const boost::shared_ptr<const sensor_msgs::PointCloud2_<std::allocator<void> > >&, const boost::shared_ptr<const visualization_msgs::Marker_<std::allocator<void> > >&, const boost::shared_ptr<const geometry_msgs::PoseStamped_<std::allocator<void> > >&), boost::_bi::list2<boost::arg<1>, boost::arg<2> > >; M0 = sensor_msgs::PointCloud2_<std::allocator<void> >; M1 = visualization_msgs::Marker_<std::allocator<void> >; M2 = geometry_msgs::PoseStamped_<std::allocator<void> >; M3 = message_filters::NullType; M4 = message_filters::NullType; M5 = message_filters::NullType; M6 = message_filters::NullType; M7 = message_filters::NullType; M8 = message_filters::NullType]’
/opt/ros/kinetic/include/message_filters/synchronizer.h:310:40:   required from ‘message_filters::Connection message_filters::Synchronizer<Policy>::registerCallback(const C&) [with C = boost::_bi::bind_t<boost::_bi::unspecified, void (*)(const boost::shared_ptr<const sensor_msgs::PointCloud2_<std::allocator<void> > >&, const boost::shared_ptr<const visualization_msgs::Marker_<std::allocator<void> > >&, const boost::shared_ptr<const geometry_msgs::PoseStamped_<std::allocator<void> > >&), boost::_bi::list2<boost::arg<1>, boost::arg<2> > >; Policy = message_filters::sync_policies::ApproximateTime<sensor_msgs::PointCloud2_<std::allocator<void> >, visualization_msgs::Marker_<std::allocator<void> >, geometry_msgs::PoseStamped_<std::allocator<void> > >]’
/home/umut/catkin_ws/src/scan_matching/src/listener.cpp:60:55:   required from here
/usr/include/boost/function/function_template.hpp:159:11: error: no match for call to ‘(boost::_bi::bind_t<boost::_bi::unspecified, boost::_bi::bind_t<boost::_bi::unspecified, void (*)(const boost::shared_ptr<const sensor_msgs::PointCloud2_<std::allocator<void> > >&, const boost::shared_ptr<const visualization_msgs::Marker_<std::allocator<void> > >&, const boost::shared_ptr<const geometry_msgs::PoseStamped_<std::allocator<void> > >&), boost::_bi::list2<boost::arg<1>, boost::arg<2> > >, boost::_bi::list9<boost::arg<1>, boost::arg<2>, boost::arg<3>, boost::arg<4>, boost::arg<5>, boost::arg<6>, boost::arg<7>, boost::arg<8>, boost::arg<9> > >) (const boost::shared_ptr<const sensor_msgs::PointCloud2_<std::allocator<void> > >&, const boost::shared_ptr<const visualization_msgs::Marker_<std::allocator<void> > >&, const boost::shared_ptr<const geometry_msgs::PoseStamped_<std::allocator<void> > >&, const boost::shared_ptr<const message_filters::NullType>&, const boost::shared_ptr<const message_filters::NullType>&, const boost::shared_ptr<const message_filters::NullType>&, const boost::shared_ptr<const message_filters::NullType>&, const boost::shared_ptr<const message_filters::NullType>&, const boost::shared_ptr<const message_filters::NullType>&)’
           BOOST_FUNCTION_RETURN((*f)(BOOST_FUNCTION_ARGS));
           ^
scan_matching/src/CMakeFiles/listener.dir/build.make:62: recipe for target 'scan_matching/src/CMakeFiles/listener.dir/listener.cpp.o' failed
make[2]: *** [scan_matching/src/CMakeFiles/listener.dir/listener.cpp.o] Error 1
CMakeFiles/Makefile2:2869: recipe for target 'scan_matching/src/CMakeFiles/listener.dir/all' failed
make[1]: *** [scan_matching/src/CMakeFiles/listener.dir/all] Error 2
Makefile:140: recipe for target 'all' failed
make: *** [all] Error 2
Invoking "make -j12 -l12" failed

I am using Ubuntu 16.04 and ROS Kinetic

#include <ros/ros.h>
#include <iostream>
#include <std_msgs/Header.h>

#include <ukf_state_msg/State.h>

#include <sensor_msgs/PointCloud.h>
#include <sensor_msgs/PointCloud2.h>
#include <sensor_msgs/point_cloud_conversion.h>

#include <visualization_msgs/Marker.h>
#include <visualization_msgs/MarkerArray.h>

//http://wiki.ros.org/message_filters#ExactTime_Policy
#include <message_filters/subscriber.h>
#include <message_filters/synchronizer.h>
#include <message_filters/sync_policies/exact_time.h>
#include <message_filters/sync_policies/approximate_time.h>

#include <scan_match/var_defs.hpp>
#include <scan_match/filter_scan.hpp>

using namespace sensor_msgs;
using namespace message_filters;
using namespace visualization_msgs;
using namespace geometry_msgs;
using namespace ukf_state_msg;

void callback(const PointCloud2::ConstPtr &point_cloud, const Marker::ConstPtr &marker, const PoseStamped::ConstPtr &pose)
{

}



int main(int argc, char **argv)
{
  ros::init(argc, argv, "scan_matching_node");
  ros::NodeHandle nh;

  message_filters::Subscriber<PointCloud2> point_cloud_sub(nh, "point_cloud", 1);
  message_filters::Subscriber<Marker> marker_sub(nh, "marker", 1);
  message_filters::Subscriber<PoseStamped> pose_sub(nh, "vehicle_pose",1);

  typedef sync_policies::ApproximateTime<PointCloud2,Marker,PoseStamped> MySyncPolicy;
  Synchronizer<MySyncPolicy> sync(MySyncPolicy(10), point_cloud_sub,marker_sub,pose_sub);
  sync.registerCallback(boost::bind(&callback, _1, _2));
  ros::spin();

  return 0;
}

Originally posted by Teslarekt on ROS Answers with karma: 1 on 2020-02-25

Post score: 0

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

sync.registerCallback(boost::bind(&callback, _1, _2));

where is _3 in the callback ?


Originally posted by Fetullah Atas with karma: 819 on 2020-02-25

This answer was ACCEPTED on the original site

Post score: 0


Original comments

Comment by Teslarekt on 2020-02-26:
Omg.. I didn't even realize what _1,_2 etc. stood for... worked perfectly ! Thank you so much !

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.