Skip to content
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

Change filter coefficient to ROS param #2091

Merged
merged 14 commits into from
Apr 11, 2023
Merged
4 changes: 4 additions & 0 deletions moveit_core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ find_package(common_interfaces REQUIRED)
find_package(eigen_stl_containers REQUIRED)
find_package(Eigen3 REQUIRED)
find_package(eigen3_cmake_module REQUIRED)
find_package(generate_parameter_library REQUIRED)
find_package(geometric_shapes REQUIRED)
find_package(geometry_msgs REQUIRED)
find_package(kdl_parser REQUIRED)
Expand All @@ -45,6 +46,7 @@ find_package(urdfdom REQUIRED)
find_package(urdfdom_headers REQUIRED)
find_package(visualization_msgs REQUIRED)


# TODO: Port python bindings
# find_package(pybind11 REQUIRED)

Expand Down Expand Up @@ -108,6 +110,7 @@ install(
TARGETS
collision_detector_bullet_plugin
moveit_butterworth_filter
moveit_butterworth_parameters
moveit_collision_detection
moveit_collision_detection_bullet
moveit_collision_detection_fcl
Expand Down Expand Up @@ -145,6 +148,7 @@ ament_export_dependencies(
eigen_stl_containers
Eigen3
eigen3_cmake_module
generate_parameter_library
geometric_shapes
geometry_msgs
kdl_parser
Expand Down
7 changes: 5 additions & 2 deletions moveit_core/online_signal_smoothing/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,19 @@ target_include_directories(moveit_butterworth_filter PUBLIC
set_target_properties(moveit_butterworth_filter PROPERTIES VERSION
"${${PROJECT_NAME}_VERSION}"
)

generate_parameter_library(moveit_butterworth_parameters src/butterworth_parameters.yaml)

target_link_libraries(moveit_butterworth_filter
moveit_smoothing_base
moveit_butterworth_parameters
moveit_robot_model
moveit_smoothing_base
)
ament_target_dependencies(moveit_butterworth_filter
srdfdom # include dependency from moveit_robot_model
)

# Installation

install(DIRECTORY include/ DESTINATION include/moveit_core)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/moveit_smoothing_base_export.h DESTINATION include/moveit_core)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/moveit_butterworth_filter_export.h DESTINATION include/moveit_core)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@

#include <cstddef>

#include <moveit_butterworth_parameters.hpp>
#include <moveit/robot_model/robot_model.h>
#include <moveit/online_signal_smoothing/smoothing_base_class.h>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,12 +100,12 @@ bool ButterworthFilterPlugin::initialize(rclcpp::Node::SharedPtr node, moveit::c
{
node_ = node;
num_joints_ = num_joints;
auto param_listener = std::make_unique<online_signal_smoothing::ParamListener>(node_);
auto filter_coeff = param_listener->get_params().butterworth_filter_coeff;

for (std::size_t i = 0; i < num_joints_; ++i)
{
// Low-pass filters for the joint positions
// TODO(andyz): read a parameter
position_filters_.emplace_back(1.5 /* filter coefficient, should be >1 */);
position_filters_.emplace_back(filter_coeff);
}
return true;
};
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
online_signal_smoothing:
butterworth_filter_coeff: {
type: double,
default_value: 1.5,
description: "Filter coefficient for the Butterworth filter",
validation: {
gt<>: 1.0
ibrahiminfinite marked this conversation as resolved.
Show resolved Hide resolved
}
}
3 changes: 2 additions & 1 deletion moveit_core/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,9 @@
<buildtool_depend>pkg-config</buildtool_depend>
<buildtool_depend>eigen3_cmake_module</buildtool_depend>
<buildtool_export_depend>eigen3_cmake_module</buildtool_export_depend>
<depend>moveit_common</depend>

<depend>generate_parameter_library</depend>
<depend>moveit_common</depend>
<depend>angles</depend>
<depend>rclcpp</depend>
<depend>common_interfaces</depend>
Expand Down