Skip to content

Commit

Permalink
diff_drive: Use speed_limiter from control_toolbox
Browse files Browse the repository at this point in the history
  • Loading branch information
christophfroehlich committed Nov 1, 2024
1 parent 87f21b3 commit 66f531a
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 250 deletions.
2 changes: 1 addition & 1 deletion diff_drive_controller/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ if(CMAKE_CXX_COMPILER_ID MATCHES "(GNU|Clang)")
endif()

set(THIS_PACKAGE_INCLUDE_DEPENDS
control_toolbox
controller_interface
generate_parameter_library
geometry_msgs
Expand Down Expand Up @@ -35,7 +36,6 @@ generate_parameter_library(diff_drive_controller_parameters
add_library(diff_drive_controller SHARED
src/diff_drive_controller.cpp
src/odometry.cpp
src/speed_limiter.cpp
)
target_compile_features(diff_drive_controller PUBLIC cxx_std_17)
target_include_directories(diff_drive_controller PUBLIC
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@
#include <string>
#include <vector>

#include "control_toolbox/speed_limiter.hpp"
#include "controller_interface/controller_interface.hpp"
#include "diff_drive_controller/odometry.hpp"
#include "diff_drive_controller/speed_limiter.hpp"
#include "diff_drive_controller/visibility_control.h"
#include "geometry_msgs/msg/twist_stamped.hpp"
#include "nav_msgs/msg/odometry.hpp"
Expand Down Expand Up @@ -135,8 +135,8 @@ class DiffDriveController : public controller_interface::ControllerInterface
std::queue<Twist> previous_commands_; // last two commands

// speed limiters
SpeedLimiter limiter_linear_;
SpeedLimiter limiter_angular_;
control_toolbox::SpeedLimiter limiter_linear_;
control_toolbox::SpeedLimiter limiter_angular_;

bool publish_limited_velocity_ = false;
std::shared_ptr<rclcpp::Publisher<Twist>> limited_velocity_publisher_ = nullptr;
Expand Down
105 changes: 0 additions & 105 deletions diff_drive_controller/include/diff_drive_controller/speed_limiter.hpp

This file was deleted.

1 change: 1 addition & 0 deletions diff_drive_controller/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
<build_depend>generate_parameter_library</build_depend>

<depend>backward_ros</depend>
<depend>control_toolbox</depend>
<depend>controller_interface</depend>
<depend>geometry_msgs</depend>
<depend>hardware_interface</depend>
Expand Down
4 changes: 2 additions & 2 deletions diff_drive_controller/src/diff_drive_controller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -296,13 +296,13 @@ controller_interface::CallbackReturn DiffDriveController::on_configure(
cmd_vel_timeout_ = std::chrono::milliseconds{static_cast<int>(params_.cmd_vel_timeout * 1000.0)};
publish_limited_velocity_ = params_.publish_limited_velocity;

limiter_linear_ = SpeedLimiter(
limiter_linear_ = control_toolbox::SpeedLimiter(
params_.linear.x.has_velocity_limits, params_.linear.x.has_acceleration_limits,
params_.linear.x.has_jerk_limits, params_.linear.x.min_velocity, params_.linear.x.max_velocity,
params_.linear.x.min_acceleration, params_.linear.x.max_acceleration, params_.linear.x.min_jerk,
params_.linear.x.max_jerk);

limiter_angular_ = SpeedLimiter(
limiter_angular_ = control_toolbox::SpeedLimiter(
params_.angular.z.has_velocity_limits, params_.angular.z.has_acceleration_limits,
params_.angular.z.has_jerk_limits, params_.angular.z.min_velocity,
params_.angular.z.max_velocity, params_.angular.z.min_acceleration,
Expand Down
139 changes: 0 additions & 139 deletions diff_drive_controller/src/speed_limiter.cpp

This file was deleted.

0 comments on commit 66f531a

Please sign in to comment.