Skip to content

Conversation

@Decwest
Copy link

@Decwest Decwest commented Oct 8, 2025


Basic Info

Info Please fill out this column
Ticket(s) this addresses #5524
Primary OS tested on Ubuntu 24.04 (ROS2 rolling)
Robotic platform tested on gazebo simulation of turtlebot3_waffle
Does this PR contain AI generated software? No
Was this PR description generated by AI software? No

Description of contribution in a few bullet points

  • Implement DWPP as an extension to the current RPP implementation

Description of documentation updates required from your changes

  • Added new parameter, so need to add that to default configs and documentation page

Added Parameters

  • max_linear_vel (rename of desired_linear_vel) (double): maximum linear velocity (m/s)
  • min_linear_vel (double): minimum linear velocity(m/s)
  • max_angular_vel (rename of desired_angular_vel) (double): maximum angular velocity (rad/s)
  • min_angular_vel (double): minimum angular velocity (rad/s)
  • max_linear_accel (double): maximum linear acceleration (m/s²)
  • max_linear_decel (double): maximum linear deceleration (m/s²)
  • max_angular_decel (double): maximum angular deceleration (m/rad²)
  • use_dynamic_window (bool): enable DWPP
  • velocity_feedback (string, no need to change) : How the current velocity is obtained during dynamic window computation.
    • "OPEN_LOOP": Uses the last commanded velocity (recommended)
    • "CLOSED_LOOP": Uses odometry velocity (may hinder proper acceleration/deceleration)

Description of how this change was tested

Simulation video

DWPP_simulation.mp4

Future work that may be required in bullet points

  • Discussion and modification regarding the renaming of Regulated Pure Pursuit
  • Documentation update

For Maintainers:

  • Check that any new parameters added are updated in docs.nav2.org
  • Check that any significant change is added to the migration guide
  • Check that any new features OR changes to existing behaviors are reflected in the tuning guide
  • Check that any new functions have Doxygen added
  • Check that any new features have test coverage
  • Check that any new plugins is added to the plugins page
  • If BT Node, Additionally: add to BT's XML index of nodes for groot, BT package's readme table, and BT library lists
  • Should this be backported to current distributions? If so, tag with backport-*.

Copy link
Member

@SteveMacenski SteveMacenski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@doisyg FYI - would this be of interest? See the video

Also, please add unit testing for the functions and features you added. Check out test/ in the package to see some examples. Your main function should be tested for all edge cases at the bare minimum

@doisyg
Copy link
Contributor

doisyg commented Oct 9, 2025

@doisyg FYI - would this be of interest? See the video

Absolutely ! @Decwest, we were discussing internally your DWPP repo (at Dexory) and I am super happy that you guys are working toward a nav2 integration.
Having linear acceleration constraints would be an immediate win for us.
Side note: could be a separate PR, but it would be even better to split the accel constraints between max_linear_accel and max_linear_decel. And in doing so, beware of bi-directionality, e.g. #3529
cc @kaichie @tonynajjar

@codecov
Copy link

codecov bot commented Oct 11, 2025

Codecov Report

❌ Patch coverage is 93.27731% with 8 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
...ntroller/src/regulated_pure_pursuit_controller.cpp 90.90% 8 Missing ⚠️
Files with missing lines Coverage Δ
...ated_pure_pursuit_controller/parameter_handler.hpp 100.00% <ø> (ø)
...t_controller/regulated_pure_pursuit_controller.hpp 100.00% <ø> (ø)
..._pure_pursuit_controller/src/parameter_handler.cpp 93.18% <100.00%> (+0.68%) ⬆️
...ntroller/src/regulated_pure_pursuit_controller.cpp 87.16% <90.90%> (+1.45%) ⬆️

... and 6 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@SteveMacenski
Copy link
Member

Let me know when you want me to take a look again after the review comments are addressed! Only things at a glance:

  const double A_MAX = params_->max_linear_accel;       // A_MAX
  const double V_MAX = params_->desired_linear_vel;     // V_MAX
  const double AW_MAX = params_->max_angular_accel;     // AW_MAX
  const double W_MAX = params_->desired_angular_vel;    // W_MAX
  const double DT = control_duration_;         // DT

  const double V_MIN = -V_MAX;
  const double W_MIN = -W_MAX;

Your very large block of code may be more concise as

// Lambda approach
auto check = [&](double v, double w) {
  if (v >= dw_vmin && v <= dw_vmax && w >= dw_wmin && w <= dw_wmax && v > best_v) {
    best_v = v; best_w = w;
  }
};
check(dw_vmin, k * dw_vmin);
check(dw_vmax, k * dw_vmax);
check(dw_wmin / k, dw_wmin);
check(dw_wmax / k, dw_wmax);

or

std::pair<double, double> candidates[] = {
  {dw_vmin, k * dw_vmin},
  {dw_vmax, k * dw_vmax},
  {dw_wmin / k, dw_wmin},
  {dw_wmax / k, dw_wmax}
};

for (auto [v, w] : candidates) {
  if (v >= dw_vmin && v <= dw_vmax && w >= dw_wmin && w <= dw_wmax && v > best_v) {
    best_v = v; best_w = w;
  }
}

I'd suggest reviewing your code a bit for how it can be as concise and self-descriptive as possible
Try to rename these variables to be more inline with the rest of the codebase please to make this function more readable.

@Decwest
Copy link
Author

Decwest commented Oct 15, 2025

@SteveMacenski
Thank you for reviewing again, and sorry for the delay in my response.
I’ll address all of your comments one by one and will mention you once everything has been updated.
I’ll also work on improving the code readability.

@mergify
Copy link
Contributor

mergify bot commented Oct 22, 2025

@Decwest, your PR has failed to build. Please check CI outputs and resolve issues.
You may need to rebase or pull in main due to API changes (or your contribution genuinely fails).

@SteveMacenski
Copy link
Member

Let me know when I should take a look again! Note that you should probably rebase and/or pull in main so that CI can pass :-)

@mergify
Copy link
Contributor

mergify bot commented Oct 23, 2025

@Decwest, your PR has failed to build. Please check CI outputs and resolve issues.
You may need to rebase or pull in main due to API changes (or your contribution genuinely fails).

@mergify
Copy link
Contributor

mergify bot commented Oct 29, 2025

@Decwest, your PR has failed to build. Please check CI outputs and resolve issues.
You may need to rebase or pull in main due to API changes (or your contribution genuinely fails).

@Decwest
Copy link
Author

Decwest commented Oct 30, 2025

@SteveMacenski Hi,
I hope you had a great time at ROSCon.
Apologies for the delay, but I’ve completed the updates in response to your review.
I’ve also created a pull request for the documentation changes in the docs.nav2.org repository:
ros-navigation/docs.nav2.org#802
I’d appreciate it if you could take another look when you have a moment.

In addition, I have a couple of points I’d like to ask about:

  • Rename of desired_linear_vel
    I renamed desired_linear_vel to max_linear_vel to follow the naming convention used in other packages for specifying the maximum velocity. However, I’d like to confirm whether this change is appropriate from a compatibility perspective.
  • Sign of deceleration parameters
    The newly added max_linear_decel and max_angular_decel parameters are implemented assuming positive values. For reference, cancel_deceleration in RPP uses positive values, while max_decel in velocity_smoother is defined as negative. I’ve currently implemented them to be positive following RPP, but I’d appreciate your confirmation on whether this approach is appropriate.

Thank you very much for your time and support.

@Decwest
Copy link
Author

Decwest commented Nov 20, 2025

@SteveMacenski friendly ping:)

@SteveMacenski
Copy link
Member

SteveMacenski commented Nov 24, 2025

Please fix the merge conflict

Sorry for the delay. ROSCon + vacation took me out of the office for some time and takes a moment to get up to speed on all the PRs again that have piled up

This looks much better now though!

logger_ = logger;

declare_parameter_if_not_declared(
node, plugin_name_ + ".desired_linear_vel", rclcpp::ParameterValue(0.5));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should have a migration log here. If desired_linear_vel is set, log a warning that it has been changed to max_linear_vel and that they should migrate the use.

dynamic_window_min_angular_vel);
}

void RegulatedPurePursuitController::applyRegulationToDynamicWindow(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems like it can be a utils function as well; it doesn't use class members

if (dynamic_window_min_angular_vel <= 0.0 && 0.0 <= dynamic_window_max_angular_vel) {
optimal_angular_vel = 0.0;
} else {
// If not, select angular vel within dynamic window closest to 0
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// If not, select angular vel within dynamic window closest to 0
// If not, select angular vel within dynamic window closest to 0

optimal_angular_vel = dynamic_window_max_angular_vel;
}
}
return;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
return;

return;
}

void RegulatedPurePursuitController::computeOptimalVelocityWithinDynamicWindow(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This also doesn't appear to use class members can could be the util like the other regulation functions

// considering velocity and acceleration constraints (DWPP)
const double regulated_linear_vel = linear_vel;
geometry_msgs::msg::Twist current_speed;
if (params_->velocity_feedback == "CLOSED_LOOP") {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't be be made of use more generally if we're enabling open vs closed loop? This is not the only place speed is utilized

@Decwest
Copy link
Author

Decwest commented Nov 25, 2025

@SteveMacenski
Thank you very much for taking the time to provide such a careful review despite your busy schedule.
I will address all of your comments once again.

I have one issue that I would like to ask for your advice on.
At the moment, I am developing in a Rolling Docker environment based on osrf/ros:rolling-desktop-full:
https://github.com/Decwest/dwpp_test_environment/blob/feature/nav2_integration/docker/Dockerfile.rolling

However, after syncing Nav2 to the latest version today and building and running it in this environment, I encountered a segmentation fault, and Nav2 no longer starts.
If you happen to have any insight into what might be causing this, I would greatly appreciate your advice.

Below is a detailed description of the situation.

  • Log obtained when running controller_server in debug mode
ROLLING ubuntu:~/ros2_ws$ ros2 run nav2_controller controller_server \
  --ros-args --log-level debug \
  -r __ns:=/ \
  -p use_sim_time=False
[DEBUG] [1764069038.870090908] [rclcpp]: signal handler installed
[DEBUG] [1764069038.870102907] [rclcpp]: deferred_signal_handler(): waiting for SIGINT/SIGTERM or uninstall
[DEBUG] [1764069038.870473289] [rcl]: Initializing node 'controller_server' in namespace ''
[DEBUG] [1764069038.870496899] [rcl]: Using domain ID of '0'
[ros2run]: Segmentation fault

From this, it seems that the process runs at least up to rclcpp::init() and rcl_init(), but it crashes immediately afterward. In addition to controller_server, planner_server, behavior_server, smoother_server, route_server, and opennav_docking all crashed as well. bt_navigator, waypoint_follower, collision_monitor, velocity_smoother, and lifecycle_manager remained alive. No other error messages were printed.

  • Clean build
    I deleted the build, install, and log directories and rebuilt everything, but the issue persisted.

  • Recreating the environment
    I cloned the repository from scratch on another PC and rebuilt the Docker environment, but the same problem occurred. Because of this, I believe it is unlikely that any local files are causing the issue.

  • Updating binaries
    I ran sudo apt update and upgrade and then performed a clean build, but the same issue occurred.

  • Downgrading the Nav2 version
    I reverted the Nav2 commit to an earlier one (10/26, Decwest@d536d33
    ) and performed a clean build, but the issue persisted.

  • Reverting the Docker image to a previous version
    I attempted this, but I could not find older tags for osrf/ros:rolling-desktop-full. When I ran Docker build today, the image was cloned from scratch, so it is certain that the base image has been updated since the last time the environment was working. My suspicion is that this update might be related to the issue.

If you have any ideas or suggestions, I would be grateful to hear them.
Thank you very much for your time and assistance.

@SteveMacenski
Copy link
Member

Unfortunately I'm not sure - it sounds like you took some of the right debugging steps to try to isolate the issue. The next steps I would try are to compile with debug flags and run with GDB to see what that says. This tutorial may be helpful: https://docs.nav2.org/tutorials/docs/get_backtrace.html

If its the core docker image, which it sounds like it may be, the right answer would be try to use an older version. Another option would be to build that image yourself locally and see if that does the trick.

@SteveMacenski
Copy link
Member

We also have a nav2 docker that hasn't been updated in some time and we keep older images around for 30 or 60 days so you should be able to find one from October even after I get it turning over right now https://github.com/ros-navigation/nav2_docker

(annoyingly github disables jobs after 30 days of the repo being inactive, even though its job is fully automated so there's not really any active pushes required for a year at time)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants