-
Notifications
You must be signed in to change notification settings - Fork 366
Implemented a generic filters plugin #1634
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Implemented a generic filters plugin #1634
Conversation
@christophfroehlich I just made another commit to fix the issues in the workflow.. requesting you to approve to workflow |
@ankurbodhe can you fix the pre-commit jobs? Is this ready for review? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for contribution!
In general, have a look at other packages in this repository to follow the (code) style, copyright claims etc.
Please address my comments and also fix the pre-commit failures as Sai already has mentioned.
# Enable warnings | ||
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") | ||
add_compile_options(-Wall -Wextra -Wpedantic) | ||
endif() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please have a look at the other packages, we use ros2_control_cmake instead
find_package(ament_cmake REQUIRED) | ||
find_package(controller_interface REQUIRED) | ||
find_package(filters REQUIRED) | ||
find_package(pluginlib REQUIRED) | ||
find_package(rclcpp REQUIRED) | ||
find_package(rclcpp_lifecycle REQUIRED) | ||
find_package(hardware_interface REQUIRED) | ||
find_package(generate_parameter_library REQUIRED) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please have a look at the other packages to follow the same style (look for THIS_PACKAGE_INCLUDE_DEPENDS
)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we usually put this in the src folder
<name>chained_filter_controller</name> | ||
<version>0.0.0</version> | ||
<description>TODO: Package description</description> | ||
<maintainer email="[email protected]">ankur-u24</maintainer> | ||
<license>TODO: License declaration</license> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please copy maintainer, license from the other packages of this repo, and add you and Bence as authors
<author email="[email protected]">Bence Magyar</author>
you can copy the description of the plugin xml below.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please insert a copyright notice
@@ -0,0 +1,107 @@ | |||
// chained_filter.cpp (migrated from ROSCon 2024 workshop) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// chained_filter.cpp (migrated from ROSCon 2024 workshop) |
please insert a copyright notice instead
@@ -0,0 +1,93 @@ | |||
#include <gtest/gtest.h> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#include <gtest/gtest.h> | |
#include <gmock/gmock.h> |
We are using gmock consistently, see #1625
TEST_F(ChainedFilterControllerTest, DeactivateDoesNotCrash) | ||
{ | ||
EXPECT_NO_THROW({ | ||
controller_->on_deactivate(rclcpp_lifecycle::State()); | ||
}); | ||
} | ||
|
||
TEST_F(ChainedFilterControllerTest, CleanupDoesNotCrash) | ||
{ | ||
EXPECT_NO_THROW({ | ||
controller_->on_cleanup(rclcpp_lifecycle::State()); | ||
}); | ||
} | ||
|
||
TEST_F(ChainedFilterControllerTest, ShutdownDoesNotCrash) | ||
{ | ||
EXPECT_NO_THROW({ | ||
controller_->on_shutdown(rclcpp_lifecycle::State()); | ||
}); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this is necessary to test. The controller manager assures that only the correct state transitions are called.
ASSERT_EQ( | ||
controller_->init( | ||
"chained_filter", // controller name | ||
"test_ns", // namespace | ||
0, // intra-process (0 = disabled) | ||
"test_node", // RCL node name | ||
rclcpp::NodeOptions()), // node options |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
where do you have this from? This is completely wrong, see
https://github.com./ros-controls/ros2_control/blob/c19997a8e614773cf69e5f3e6ffd7b511f2a4f5c/controller_interface/include/controller_interface/controller_interface_base.hpp#L154-L156
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add a test if a filter is loaded and used to process data.
This PR migrates and enhances the chained_filter_controller originally implemented during the ROSCon 2024 control workshop. The controller enables chaining and filtering of state interfaces through a sequence of filters.
Changes introduced: