Ask Your Question
0

imu_filter_madgwick does not compile properly on Ubuntu18.04 - Melodic

asked 2019-05-21 13:55:46 -0600

RayROS gravatar image

updated 2019-05-21 15:45:52 -0600

Hello, I downloaded the imu_filter_madgwick tool from here and installed on my catkin_ws. Unfortunately it does not compile and the problem is due to the file imu_filter_nodelet.cpp.

As I compile the project I receive the following error from the compiler.

`/home/emanuele/catkin_ws/src/imu_tools/imu_filter_madgwick/src/imu_filter_nodelet.cpp:39:24: error: expected constructor, destructor, or type conversion before ‘(’ token
 PLUGINLIB_DECLARE_CLASS(imu_filter_madgwick, ImuFilterNodelet, ImuFilterNodelet, nodelet::Nodelet);`

That seems to be due to the following line PLUGINLIB_DECLARE_CLASS(imu_filter_madgwick, ImuFilterNodelet, ImuFilterNodelet, nodelet::Nodelet); in the .cpp file below:

#include "imu_filter_madgwick/imu_filter_nodelet.h"
#include <pluginlib/class_list_macros.h>

void ImuFilterNodelet::onInit()
{
  NODELET_INFO("Initializing IMU Filter Nodelet");

  // TODO: Do we want the single threaded or multithreaded NH?
  ros::NodeHandle nh         = getMTNodeHandle();
  ros::NodeHandle nh_private = getMTPrivateNodeHandle();

  filter_.reset(new ImuFilterRos(nh, nh_private));
}

PLUGINLIB_DECLARE_CLASS(imu_filter_madgwick, ImuFilterNodelet, ImuFilterNodelet, nodelet::Nodelet);

After doing some research I found out that the PLUGINLIB_DECLARE_CLASS... is deprecated and should be substituted with the following line: PLUGINLIB_EXPORT_CLASS(imu_filter_madgwick, ImuFilterNodelet, ImuFilterNodelet, nodelet::Nodelet);

However as I try to compile the project I get a different compilation error which can be seen below:

`PLUGINLIB_EXPORT_CLASS" passed 4 arguments, but takes just 2
 ASS(imu_filter_madgwick, ImuFilterNodelet, ImuFilterNodelet, nodelet::Nodelet);
                                                                              ^
/home/emanuele/catkin_ws/src/imu_tools/imu_filter_madgwick/src/imu_filter_nodelet.cpp:39:1: error: ‘PLUGINLIB_EXPORT_CLASS’ does not name a type
 PLUGINLIB_EXPORT_CLASS(imu_filter_madgwick, ImuFilterNodelet, ImuFilterNodelet, nodelet::Nodelet);`

It seems that no matter what I substitute I can't make catkin_ws to work correctly. Is there something that I am missing or can someone point in the right direction on what the problem could be?

edit retag flag offensive close merge delete

Comments

Please don't use images to post text. Images are not searchable and the text in the images cannot be copied and pasted. Please update your question with a copy and paste of the text instead. See the support page for further information.

jayess gravatar imagejayess ( 2019-05-21 15:33:47 -0600 )edit

Thanks jayess for the comment. I just update the question with the text.

RayROS gravatar imageRayROS ( 2019-05-21 15:46:43 -0600 )edit

2 Answers

Sort by » oldest newest most voted
3

answered 2019-05-22 03:17:30 -0600

gvdhoorn gravatar image

Hello, I downloaded the imu_filter_madgwick tool from here and installed on my catkin_ws.

First question: why? Do you need to compile it from source?

imu_filter_madgwick has been released into Melodic quite some time ago (see the wiki page) making installation a simple sudo apt install ros-melodic-imu-filter-madgwick.

Unless you have a good reason to build from source I would recommend you install the binaries.

However as I try to compile the project I get a different compilation error which can be seen below:

`PLUGINLIB_EXPORT_CLASS" passed 4 arguments, but takes just 2
 ASS(imu_filter_madgwick, ImuFilterNodelet, ImuFilterNodelet, nodelet::Nodelet);
                                                                              ^
/home/emanuele/catkin_ws/src/imu_tools/imu_filter_madgwick/src/imu_filter_nodelet.cpp:39:1: error: ‘PLUGINLIB_EXPORT_CLASS’ does not name a type
 PLUGINLIB_EXPORT_CLASS(imu_filter_madgwick, ImuFilterNodelet, ImuFilterNodelet, nodelet::Nodelet);`

The correct syntax would be (from here):

PLUGINLIB_EXPORT_CLASS(ImuFilterNodelet, nodelet::Nodelet);

It's not just the name that changed, the arguments have changed as well.

This was changed in the Melodic version of the package about 2 years ago (in ccny-ros-pkg/imu_tools#77). If you'd install the binaries, you'd not have to make this change.

It would also appear you're trying to build the Indigo version on ROS Melodic. If you must build the package(s) from source, use the melodic branch.

edit flag offensive delete link more

Comments

Hello gvdhoorn and thanks for your detailed answer and for providing the latest version of the imu_filter_madgwick. And yes, I installed it using the Melodic version you indicated and now it works very well. :)

RayROS gravatar imageRayROS ( 2019-05-22 09:20:42 -0600 )edit

So did you need to build the package from source, or did you install it using apt?

gvdhoorn gravatar imagegvdhoorn ( 2019-05-22 09:23:06 -0600 )edit

I installed the binaries as you advised sudo apt install ros-melodic-imu-filter-madgwick. I was trying to build it from source only because I could not find a Melodic version. The only one that I found was the Indigo which did not carry the corrected syntax and the one cointained in the git repo I posted in the question.

RayROS gravatar imageRayROS ( 2019-05-22 10:07:43 -0600 )edit
1

answered 2019-09-08 03:53:34 -0600

updated 2019-09-28 17:42:59 -0600

jayess gravatar image

I just compiled imu_filter_madgwick on Rpi4 Debian Buster for Melodic! So if you need to compile it from source and the preferred

sudo apt install ros-melodic-imu-filter-madgwick

does not work, like on Buster for the moment, you need to git checkout on the melodic branch first!

$ cd catkin_ws/src

$ git clone https://github.com/ccny-ros-pkg/imu_tools.git

$ cd imu_tools

$ git checkout melodic



=> Your branch is up to date with 'origin/melodic'.

Now catkin_make will compile everything!

edit flag offensive delete link more

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: 2019-05-21 13:55:46 -0600

Seen: 268 times

Last updated: Sep 28