35 #include "dwb_plugins/limited_accel_generator.hpp"
39 #include "pluginlib/class_list_macros.hpp"
40 #include "dwb_core/exceptions.hpp"
46 const nav2::LifecycleNode::SharedPtr & nh,
47 const std::string & plugin_name)
49 plugin_name_ = plugin_name;
53 acceleration_time_ = nh->declare_or_get_parameter<
double>(
54 plugin_name +
".sim_period");
55 }
catch (std::exception &) {
57 rclcpp::get_logger(
"LimitedAccelGenerator"),
58 "'sim_period' parameter is not set for %s", plugin_name.c_str());
59 double controller_frequency = nh->declare_or_get_parameter(
"controller_frequency", 20.0);
60 if (controller_frequency > 0) {
61 acceleration_time_ = 1.0 / controller_frequency;
64 rclcpp::get_logger(
"LimitedAccelGenerator"),
65 "A controller_frequency less than or equal to 0 has been set. "
66 "Ignoring the parameter, assuming a rate of 20Hz");
67 acceleration_time_ = 0.05;
75 velocity_iterator_->startNewIteration(current_velocity, acceleration_time_);
79 const nav_2d_msgs::msg::Twist2D & cmd_vel,
80 const nav_2d_msgs::msg::Twist2D & ,
Interface for iterating through possible velocities and creating trajectories.
Limits the acceleration in the generated trajectories to a fraction of the simulated time.
void startNewIteration(const nav_2d_msgs::msg::Twist2D ¤t_velocity) override
Start a new iteration based on the current velocity.
nav_2d_msgs::msg::Twist2D computeNewVelocity(const nav_2d_msgs::msg::Twist2D &cmd_vel, const nav_2d_msgs::msg::Twist2D &start_vel, const double dt) override
Calculate the velocity after a set period of time, given the desired velocity and acceleration limits...
void initialize(const nav2::LifecycleNode::SharedPtr &nh, const std::string &plugin_name) override
Initialize parameters as needed.
void initialize(const nav2::LifecycleNode::SharedPtr &nh, const std::string &plugin_name) override
Initialize parameters as needed.