Skip to content

diff_drive_controller: set parameters as read_only#2293

Open
kamal2730 wants to merge 3 commits intoros-controls:masterfrom
kamal2730:fix/diff-drive-read-only-params
Open

diff_drive_controller: set parameters as read_only#2293
kamal2730 wants to merge 3 commits intoros-controls:masterfrom
kamal2730:fix/diff-drive-read-only-params

Conversation

@kamal2730
Copy link
Copy Markdown

Add read_only: true to all 36 parameters in diff_drive_controller for consistency with other drive controllers.
Fixes #1696

Description

Right now I added read_only: true for all params because currently, the controller does not support runtime parameter updates for SpeedLimiter-related parameters. This would require adding try_update_params() to the RT loop and implementing a set_params() method in the SpeedLimiter class. If needed, I will address this in a follow-up PR.

Fixes #1696

Is this user-facing behavior change?

NO

Did you use Generative AI?

No

Additional Information

TODOs

To send us a pull request, please:

  • Fork the repository.
  • Modify the source; please focus on the specific change you are contributing. If you also reformat all the code, it will be hard for us to focus on your change.
  • Ensure local tests pass. (colcon test and pre-commit run (requires you to install pre-commit by pip3 install pre-commit)
  • Commit to your fork using clear commit messages.
  • Send a pull request, answering any default questions in the pull request interface.
  • Pay attention to any automated CI failures reported in the pull request, and stay involved in the conversation.

Add read_only: true to all 36 parameters in diff_drive_controller
for consistency with other drive controllers.
Fixes ros-controls#1696
Copy link
Copy Markdown
Member

@christophfroehlich christophfroehlich left a comment

Choose a reason for hiding this comment

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

Please evaluate which parameters make sense to be reconfigured at runtime, see my comment here
#2074 (review)

@kamal2730 kamal2730 changed the title diff_drive_controller: set all parameters as read_only diff_drive_controller: set parameters as read_only Apr 14, 2026
@kamal2730
Copy link
Copy Markdown
Author

I evaluated which parameters make sense to be reconfigured at runtime and identified 19 parameters that can be made dynamic:
Member variable updates:

  • cmd_vel_timeout

Direct from params_ (auto-updates):

  • publish_limited_velocity
  • enable_odom_tf'

SpeedLimiter set_params() updates:

  • linear.x.max_velocity
  • linear.x.min_velocity
  • linear.x.max_acceleration
  • linear.x.max_deceleration
  • linear.x.max_acceleration_reverse
  • linear.x.max_deceleration_reverse
  • linear.x.max_jerk
  • linear.x.min_jerk
  • angular.z.max_velocity
  • angular.z.min_velocity
  • angular.z.max_acceleration
  • angular.z.max_deceleration
  • angular.z.max_acceleration_reverse
  • angular.z.max_deceleration_reverse
  • angular.z.max_jerk
  • angular.z.min_jerk

Implementation Plan

I will handle the runtime updates in update_and_write_commands() by:

  1. Adding if (param_listener_->try_update_params(params_)) check
  2. Updating cmd_vel_timeout member variable
  3. Calling set_params() on SpeedLimiter objects for velocity/acceleration/jerk limits
  4. publish_limited_velocity and enable_odom_tf auto-update with params_
    Does this approach look good to you?

@christophfroehlich
Copy link
Copy Markdown
Member

Sounds good. Only, I'm not sure about cmd_vel_timeout, but both options are fine for me.

…arameters

Add set_params() method to SpeedLimiter class for updating parameters
at runtime. Add try_update_params() in RT loop to detect and apply
parameter changes on-the-fly.
Dynamic parameters:
- enable_odom_tf, cmd_vel_timeout, publish_limited_velocity
- linear.x.* (8 params)
- angular.z.* (8 params)
Fixes ros-controls#1696
@kamal2730
Copy link
Copy Markdown
Author

@christophfroehlich Added parameter handling for runtime updates. Could you review?

@codecov
Copy link
Copy Markdown

codecov bot commented Apr 15, 2026

Codecov Report

❌ Patch coverage is 0% with 8 lines in your changes missing coverage. Please review.
✅ Project coverage is 85.08%. Comparing base (ab5ce0c) to head (0bddc84).

Files with missing lines Patch % Lines
...iff_drive_controller/src/diff_drive_controller.cpp 0.00% 5 Missing and 1 partial ⚠️
...er/include/diff_drive_controller/speed_limiter.hpp 0.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2293      +/-   ##
==========================================
- Coverage   85.13%   85.08%   -0.05%     
==========================================
  Files         154      154              
  Lines       15417    15425       +8     
  Branches     1334     1335       +1     
==========================================
  Hits        13125    13125              
- Misses       1800     1807       +7     
- Partials      492      493       +1     
Flag Coverage Δ
unittests 85.08% <0.00%> (-0.05%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
...er/include/diff_drive_controller/speed_limiter.hpp 66.66% <0.00%> (-33.34%) ⬇️
...iff_drive_controller/src/diff_drive_controller.cpp 78.71% <0.00%> (-1.41%) ⬇️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Copy Markdown
Member

@christophfroehlich christophfroehlich left a comment

Choose a reason for hiding this comment

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

looks fine for me, but could you please add a test for the parameter updates at runtime? have a look at existing tests with specified limits, copy it, and extend it with another update call with changed limits.

@kamal2730
Copy link
Copy Markdown
Author

Sure, even I was thinking the same 😅

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.

DiffDrive: Check read_only key for parameters

2 participants