0
$\begingroup$

Rosanswers logo

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?


Originally posted by RayROS on ROS Answers with karma: 108 on 2019-05-21

Post score: 0


Original comments

Comment by jayess on 2019-05-21:
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.

Comment by RayROS on 2019-05-21:
Thanks jayess for the comment. I just update the question with the text.

Comment by KennyDeDavion on 2021-09-29:
sudo apt install ros-melodic-imu-filter-madgwick , now not function. Why?

$\endgroup$

2 Answers 2

0
$\begingroup$

Rosanswers logo

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.


Originally posted by gvdhoorn with karma: 86574 on 2019-05-22

This answer was ACCEPTED on the original site

Post score: 4


Original comments

Comment by RayROS on 2019-05-22:
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. :)

Comment by gvdhoorn on 2019-05-22:
So did you need to build the package from source, or did you install it using apt?

Comment by RayROS on 2019-05-22:
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.

$\endgroup$
0
$\begingroup$

Rosanswers logo

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!


Originally posted by arminf82 with karma: 31 on 2019-09-08

This answer was NOT ACCEPTED on the original site

Post score: 3

$\endgroup$

Your Answer

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