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

TimeSynchronizer question : callback not called [closed]

asked 2013-09-27 04:34:44 -0600

rnunziata gravatar image

updated 2013-09-27 08:19:02 -0600

update:

tried to pass just one subscriber.

 // Listen for motor control response
 Subscriber<JointControllerState> j1_sub(n, "/rrbot/joint1_position_controller/state", 10);
// Subscriber<JointControllerState> j2_sub(n, "/rrbot/joint2_position_controller/state", 10);
 typedef sync_policies::ApproximateTime<JointControllerState, JointControllerState> MySyncPolicy;
 Synchronizer<MySyncPolicy> sync(MySyncPolicy(1000), j1_sub);
 sync.registerCallback(boost::bind(&PublishOdometry::handelerOdometry, this, _1));
 ROS_INFO("handelerInitialPose finished processing");

get compilation error:

 Building CXX object gazebo_ros_demos/rrbot_control/CMakeFiles/robot_odometry.dir/src/robot_odometry.cpp.o
/home/viki/catkin_ws/src/gazebo_ros_demos/rrbot_control/src/robot_odometry.cpp: In member function ‘void PublishOdometry::handelerInitialPose(geometry_msgs::PoseWithCovarianceStampedConstPtr)’:
/home/viki/catkin_ws/src/gazebo_ros_demos/rrbot_control/src/robot_odometry.cpp:163:64: error: no matching function for call to ‘message_filters::Synchronizer<message_filters::sync_policies::ApproximateTime<control_msgs::JointControllerState_<std::allocator<void> >, control_msgs::JointControllerState_<std::allocator<void> > > >::Synchronizer(MySyncPolicy, message_filters::Subscriber<control_msgs::JointControllerState_<std::allocator<void> > >&)’
/home/viki/catkin_ws/src/gazebo_ros_demos/rrbot_control/src/robot_odometry.cpp:163:64: note: candidates are:
In file included from /opt/ros/hydro/include/message_filters/time_synchronizer.h:38:0,
                 from /home/viki/catkin_ws/src/gazebo_ros_demos/rrbot_control/src/robot_odometry.cpp:14:
/opt/ros/hydro/include/message_filters/synchronizer.h:220:3: note: message_filters::Synchronizer<Policy>::Synchronizer(const Policy&) [with Policy = message_filters::sync_policies::ApproximateTime<control_msgs::JointControllerState_<std::allocator<void> >, control_msgs::JointControllerState_<std::allocator<void> > >]
/opt/ros/hydro/include/message_filters/synchronizer.h:220:3: note:   candidate expects 1 argument, 2 provided
/opt/ros/hydro/include/message_filters/synchronizer.h:213:3: note: template<class F0, class F1, class F2, class F3, class F4, class F5, class F6, class F7, class F8> message_filters::Synchronizer::Synchronizer(const Policy&, F0&, F1&, F2&, F3&, F4&, F5&, F6&, F7&, F8&)
/opt/ros/hydro/include/message_filters/synchronizer.h:213:3: note:   template argument deduction/substitution failed:
/home/viki/catkin_ws/src/gazebo_ros_demos/rrbot_control/src/robot_odometry.cpp:163:64: note:   candidate expects 10 arguments, 2 provided
In file included from /opt/ros/hydro/include/message_filters/time_synchronizer.h:38:0,
                 from /home/viki/catkin_ws/src/gazebo_ros_demos/rrbot_control/src/robot_odometry.cpp:14:
/opt/ros/hydro/include/message_filters/synchronizer.h:205:3: note: template<class F0, class F1, class F2, class F3, class F4, class F5, class F6, class F7> message_filters::Synchronizer::Synchronizer(const Policy&, F0&, F1&, F2&, F3&, F4&, F5&, F6&, F7&)
/opt/ros/hydro/include/message_filters/synchronizer.h:205:3: note:   template argument deduction/substitution failed:
/home/viki/catkin_ws/src/gazebo_ros_demos/rrbot_control/src/robot_odometry.cpp:163:64: note:   candidate expects 9 arguments, 2 provided
In file included from /opt/ros/hydro/include/message_filters/time_synchronizer.h:38:0,
                 from /home/viki/catkin_ws/src/gazebo_ros_demos/rrbot_control/src/robot_odometry.cpp:14:
/opt/ros/hydro/include/message_filters/synchronizer.h:197:3: note: template<class F0, class F1, class F2, class F3, class F4, class F5, class F6> message_filters::Synchronizer::Synchronizer(const Policy&, F0&, F1&, F2&, F3&, F4&, F5&, F6&)
/opt/ros/hydro/include/message_filters/synchronizer.h:197:3: note:   template argument deduction/substitution failed:
/home/viki/catkin_ws/src/gazebo_ros_demos/rrbot_control/src/robot_odometry.cpp:163:64: note:   candidate expects 8 arguments, 2 provided
In file included from /opt/ros/hydro/include/message_filters/time_synchronizer.h:38:0,
                 from /home/viki/catkin_ws/src/gazebo_ros_demos/rrbot_control/src/robot_odometry ...
(more)
edit retag flag offensive reopen merge delete

Closed for the following reason duplicate question by rnunziata
close date 2013-09-28 06:10:22

Comments

Two things come to mind when I look at your code: check your subscribed topics in rqt_graph (rrbot seems like a typo for robot) and check if your synchronization policy is being too strict by echoing both topics and looking at timestamps (10 ms might be too little depending on what you are syncing).

georgebrindeiro gravatar image georgebrindeiro  ( 2013-09-27 04:58:00 -0600 )edit

I can't think of a good reason. I was having issue with TimeSynchronizer being called the other day, but that's because I wasn't using the ApproximateTime sync policy. One thing you could try is just seeing if you can get separate subscribers to work, just as a sanity check. Or check DEBUG output...

georgebrindeiro gravatar image georgebrindeiro  ( 2013-09-27 06:24:46 -0600 )edit

I don't think what you did is valid, since it doesn't make sense to synchronize a channel alone. I meant regular ROS subscribers.

georgebrindeiro gravatar image georgebrindeiro  ( 2013-09-27 10:52:21 -0600 )edit

I use them all the time...even within the same node that is having this problem.

rnunziata gravatar image rnunziata  ( 2013-09-27 11:22:45 -0600 )edit

1 Answer

Sort by » oldest newest most voted
0

answered 2013-09-28 06:09:57 -0600

rnunziata gravatar image

New item opened with test program demonstrating problem

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2013-09-27 04:34:44 -0600

Seen: 615 times

Last updated: Sep 28 '13