Skip to content

Commit

Permalink
add complementary_filter_nodelet (#181)
Browse files Browse the repository at this point in the history
  • Loading branch information
borongyuan authored Nov 14, 2023
1 parent 472666b commit f55d47e
Show file tree
Hide file tree
Showing 5 changed files with 60 additions and 1 deletion.
13 changes: 12 additions & 1 deletion imu_complementary_filter/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ find_package(catkin REQUIRED COMPONENTS
cmake_modules
geometry_msgs
message_filters
nodelet
pluginlib
roscpp
sensor_msgs
std_msgs
Expand All @@ -19,6 +21,8 @@ catkin_package(
CATKIN_DEPENDS
geometry_msgs
message_filters
nodelet
pluginlib
roscpp
sensor_msgs
std_msgs
Expand All @@ -40,13 +44,16 @@ add_library(complementary_filter
)
target_link_libraries(complementary_filter ${catkin_LIBRARIES} ${Boost_LIBRARIES})

# create complementary_filter_nodelet library
add_library (complementary_filter_nodelet src/complementary_filter_nodelet.cpp)
target_link_libraries(complementary_filter_nodelet complementary_filter ${catkin_LIBRARIES})

# create complementary_filter_node executable
add_executable(complementary_filter_node
src/complementary_filter_node.cpp)
target_link_libraries(complementary_filter_node complementary_filter ${catkin_LIBRARIES})

install(TARGETS complementary_filter
install(TARGETS complementary_filter complementary_filter_nodelet
ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
RUNTIME DESTINATION ${CATKIN_GLOBAL_BIN_DESTINATION}
Expand All @@ -64,3 +71,7 @@ install(DIRECTORY include/${PROJECT_NAME}/
FILES_MATCHING PATTERN "*.h"
PATTERN ".svn" EXCLUDE
)

install(FILES complementary_filter_nodelet.xml
DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}
)
9 changes: 9 additions & 0 deletions imu_complementary_filter/complementary_filter_nodelet.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<!-- Complementary Filter nodelet publisher -->
<library path="lib/libcomplementary_filter_nodelet">
<class name="imu_complementary_filter/ComplementaryFilterNodelet" type="ComplementaryFilterNodelet"
base_class_type="nodelet::Nodelet">
<description>
Complementary Filter nodelet publisher.
</description>
</class>
</library>
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#ifndef IMU_TOOLS_COMPLEMENTARY_FILTER_NODELET_H
#define IMU_TOOLS_COMPLEMENTARY_FILTER_NODELET_H

#include <nodelet/nodelet.h>

#include "imu_complementary_filter/complementary_filter_ros.h"

class ComplementaryFilterNodelet : public nodelet::Nodelet
{
public:
virtual void onInit();

private:
boost::shared_ptr<imu_tools::ComplementaryFilterROS> filter_;
};

#endif // IMU_TOOLS_COMPLEMENTARY_FILTER_NODELET_H
8 changes: 8 additions & 0 deletions imu_complementary_filter/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,23 @@
<build_depend>cmake_modules</build_depend>
<build_depend>geometry_msgs</build_depend>
<build_depend>message_filters</build_depend>
<build_depend>nodelet</build_depend>
<build_depend>pluginlib</build_depend>
<build_depend>roscpp</build_depend>
<build_depend>sensor_msgs</build_depend>
<build_depend>std_msgs</build_depend>
<build_depend>tf</build_depend>
<run_depend>geometry_msgs</run_depend>
<run_depend>message_filters</run_depend>
<run_depend>nodelet</run_depend>
<run_depend>pluginlib</run_depend>
<run_depend>roscpp</run_depend>
<run_depend>sensor_msgs</run_depend>
<run_depend>std_msgs</run_depend>
<run_depend>tf</run_depend>

<export>
<nodelet plugin="${prefix}/complementary_filter_nodelet.xml" />
</export>

</package>
14 changes: 14 additions & 0 deletions imu_complementary_filter/src/complementary_filter_nodelet.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#include "imu_complementary_filter/complementary_filter_nodelet.h"
#include <pluginlib/class_list_macros.h>

void ComplementaryFilterNodelet::onInit()
{
NODELET_INFO("Initializing Complementary Filter Nodelet");

ros::NodeHandle nh = getMTNodeHandle();
ros::NodeHandle nh_private = getMTPrivateNodeHandle();

filter_.reset(new imu_tools::ComplementaryFilterROS(nh, nh_private));
}

PLUGINLIB_EXPORT_CLASS(ComplementaryFilterNodelet, nodelet::Nodelet)

0 comments on commit f55d47e

Please sign in to comment.