imu_filter_madgwick does not compile properly on Ubuntu18.04 - Melodic
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?
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.
Thanks jayess for the comment. I just update the question with the text.
sudo apt install ros-melodic-imu-filter-madgwick , now not function. Why?