Ask Your Question
0

Synchronizer.h Errors

asked 2018-08-20 10:13:02 -0500

Old Meme gravatar image

updated 2018-08-20 13:35:48 -0500

Hi guys,

I've been trying to do approximate time synchronization, and have been adapting tutorial examples for my own needs. I was facing some errors with sync_policies not having a type, synchronizer not being declared in the scope, and so on. Seeing some other forum posts, I added

using namespace message_filters

and got a wall of errors:

/home/pi/ros_ws/src/link/src/roscomm.cpp: In function ‘int main(int, char**)’:   
/home/pi/ros_ws/src/link/src/roscomm.cpp:222:85: error: ‘IMU’ is not a member of ‘sensor_msgs’                     
   typedef sync_policies::ApproximateTime<sensor_msgs::NavSatFix, std_msgs::Float64, sensor_msgs::IMU> NavSyncPolicy;
                                                                                     ^~~~~~~~~~~
/home/pi/ros_ws/src/link/src/roscomm.cpp:222:85: error: ‘IMU’ is not a member of ‘sensor_msgs’                   
/home/pi/ros_ws/src/link/src/roscomm.cpp:222:101: error: template argument 3 is invalid
   typedef sync_policies::ApproximateTime<sensor_msgs::NavSatFix, std_msgs::Float64, sensor_msgs::IMU> NavSyncPolicy;
                                                                                                     ^                                                                                 
In file included from /home/pi/ros_ws/src/link/src/roscomm.cpp:21:0:                                                                                                                                        
/opt/ros/kinetic/include/message_filters/synchronizer.h: In instantiation of ‘class message_filters::Synchronizer<int>’:
/home/pi/ros_ws/src/link/src/roscomm.cpp:223:49:   required from here
/opt/ros/kinetic/include/message_filters/synchronizer.h:68:7: error: base type ‘int’ fails to be a struct or class type
 class Synchronizer : public boost::noncopyable, public Policy
       ^~~~~~~~~~~~
/opt/ros/kinetic/include/message_filters/synchronizer.h:71:37: error: ‘int’ is not a class, struct, or union type
   typedef typename Policy::Messages Messages;
                                     ^~~~~~~~
/opt/ros/kinetic/include/message_filters/synchronizer.h:72:35: error: ‘int’ is not a class, struct, or union type
   typedef typename Policy::Events Events;
                                   ^~~~~~
/opt/ros/kinetic/include/message_filters/synchronizer.h:73:35: error: ‘int’ is not a class, struct, or union type
   typedef typename Policy::Signal Signal;
                                   ^~~~~~
/opt/ros/kinetic/include/message_filters/synchronizer.h:74:49: error: ‘int’ is not a class, struct, or union type
   typedef typename mpl::at_c<Messages, 0>::type M0;
                                                 ^~
/opt/ros/kinetic/include/message_filters/synchronizer.h:75:49: error: ‘int’ is not a class, struct, or union type
   typedef typename mpl::at_c<Messages, 1>::type M1;
                                                 ^~
/opt/ros/kinetic/include/message_filters/synchronizer.h:76:49: error: ‘int’ is not a class, struct, or union type
   typedef typename mpl::at_c<Messages, 2>::type M2;
                                                 ^~
/opt/ros/kinetic/include/message_filters/synchronizer.h:77:49: error: ‘int’ is not a class, struct, or union type
   typedef typename mpl::at_c<Messages, 3>::type M3;
                                                 ^~
/opt/ros/kinetic/include/message_filters/synchronizer.h:78:49: error: ‘int’ is not a class, struct, or union type
   typedef typename mpl::at_c<Messages, 4>::type M4;
                                                 ^~
/opt/ros/kinetic/include/message_filters/synchronizer.h:79:49: error: ‘int’ is not a class, struct, or union type
   typedef typename mpl::at_c<Messages, 5>::type M5;
                                                 ^~
/opt/ros/kinetic/include/message_filters/synchronizer.h:80:49: error: ‘int’ is not a class, struct, or union type
   typedef typename mpl::at_c<Messages, 6>::type M6;
                                                 ^~
/opt/ros/kinetic/include/message_filters/synchronizer.h:81:49: error: ‘int’ is not a class, struct, or union type
   typedef typename mpl::at_c<Messages, 7>::type ...
(more)
edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
1

answered 2018-08-20 12:11:15 -0500

gvdhoorn gravatar image

updated 2018-08-20 12:15:41 -0500

/.../src/roscomm.cpp:222:85: error: ‘IMU’ is not a member of ‘sensor_msgs’                     
   typedef sync_policies::ApproximateTime<sensor_msgs::NavSatFix, std_msgs::Float64, sensor_msgs::IMU> NavSyncPolicy;
                                                                                     ^~~~~~~~~~~
/.../src/roscomm.cpp:222:85: error: ‘IMU’ is not a member of ‘sensor_msgs’

Note: the message name is Imu, not IMU.

If you've fixed that and still get the same error, it's likely you forgot to include the sensor_msgs/Imu.h header.

another note: time synchronisation is only possible with message types that have a header: std_msgs/Float64 doesn't have one, so it cannot be used.


Edit:

Is this an error with synchronizer.h I can't fix, was it caused by a minor error in my code?

seeing as these packages have been around for at least 10 years, I would always assume your code is at fault -- at first.

However, no code is faultless, so if you've assured that you're doing the right thing, then suspecting message_filters starts to make sense.

edit flag offensive delete link more

Comments

So the original issue was fixed, but now there's something wrong with my boost statement that I don't know how to fix (see edit)

Old Meme gravatar imageOld Meme ( 2018-08-20 13:31:11 -0500 )edit
1

Please don't post follow-up issues in the same question.

If you have a new problem, post a new question.

gvdhoorn gravatar imagegvdhoorn ( 2018-08-20 13:32:05 -0500 )edit

If time sync can't be used with message types without headers, is there any way to sync those types of messages then?

Old Meme gravatar imageOld Meme ( 2018-08-20 13:46:11 -0500 )edit

If time sync can't be used with message types without headers, is there any way to sync those types of messages then?

Not with message_filters with C++ afaik. Without access to a stamp, how would you think synchronisation should work?

The Python version does support it, but it inserts a stamp.

gvdhoorn gravatar imagegvdhoorn ( 2018-08-20 15:25:42 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2018-08-20 10:13:02 -0500

Seen: 83 times

Last updated: Aug 20 '18