Skip to content

Conversation

@wittenator
Copy link

@wittenator wittenator commented Mar 1, 2025

This PR adds the option to use steering angle and linear velocity for controllers that inherit from the steering library.

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.

@wittenator wittenator changed the title Add AckermannDriveStamped control to steering library WIP: Add AckermannDriveStamped control to steering library Mar 1, 2025
@wittenator
Copy link
Author

wittenator commented Mar 1, 2025

The tests on HEAD are currently broken, but I wanted to get this PR out in order to track progress.

Copy link
Contributor

@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.

why WIP?
Please fix the failing jobs, start with the pre-commit and clang job.
The tests on the master branch are green.

@Juliaj
Copy link
Contributor

Juliaj commented Jun 12, 2025

@Juliaj How relevant are additional test cases for the inheriting controllers? Since I only added passthrough for the class variable in the controllers, tests for each inherited controller would essentially only test the functionality of the steering controller that is already covered and add a huge amount of boilerplate for the other controllers.

@wittenator, sorry for missing your comment. I noticed that you have updated the tests. Will take another look shortly.

@Juliaj
Copy link
Contributor

Juliaj commented Jun 13, 2025

@Juliaj How relevant are additional test cases for the inheriting controllers? Since I only added passthrough for the class variable in the controllers, tests for each inherited controller would essentially only test the functionality of the steering controller that is already covered and add a huge amount of boilerplate for the other controllers.

@wittenator, great work on the test coverage added in test_steering_controllers_library_steering_input.cpp!

I'd suggest adding one more test to cover the new use_twist_input parameter. This could be added to the existing on_configure test or in a dedicated test case to verify the parameter is properly handled during configuration.

Overall, these changes look solid!

@mergify
Copy link
Contributor

mergify bot commented Jul 24, 2025

This pull request is in conflict. Could you fix it @wittenator?

Copy link
Contributor

@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.

I responded to your questions, could you please address them and fix the conflicts from the latest refactoring?

@christophfroehlich
Copy link
Contributor

I'd suggest adding one more test to cover the new use_twist_input parameter. This could be added to the existing on_configure test or in a dedicated test case to verify the parameter is properly handled during configuration.

Isn't this implicitly done by the new tests using the yaml parmeterfile?

@wittenator
Copy link
Author

I responded to your questions, could you please address them and fix the conflicts from the latest refactoring?

I'm on it and going to fix the conflicts over the coming days. Thanks for answering the remaining few questions!

Copy link
Contributor

@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 also address the old open conversation about the argument and variable renaming.

Copy link
Contributor

@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.

Thanks for your patience, I still have some comments to be solved.

@wittenator
Copy link
Author

Thanks for looking over it again! I've fixed both open requests

Copy link
Contributor

@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.

Thanks again for the followup. Almost finished IMHO:

  • I think the renaming to angular_command was missing in the header files, and I hope that I found all occurrences for improving the argument name.
  • The build fails now. Please apply the changes from this PR to the added file.


void SteeringOdometry::update_open_loop(const double v_bx, const double omega_bz, const double dt)
void SteeringOdometry::update_open_loop(
const double v_bx, const double last_angular_command_, const double dt,
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
const double v_bx, const double last_angular_command_, const double dt,
const double v_bx, const double angular_command, const double dt,

Copy link
Contributor

Choose a reason for hiding this comment

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

Trailing _ is denoting a member variable. and why using last?


/// Integrate odometry:
integrate_fk(v_bx, omega_bz, dt);
integrate_fk(v_bx, last_angular_command_, dt);
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
integrate_fk(v_bx, last_angular_command_, dt);
integrate_fk(v_bx, angular_command, dt);

*/
void update_open_loop(const double v_bx, const double omega_bz, const double dt);
void update_open_loop(
const double v_bx, const double omega_bz, const double dt, const bool use_twist_input = true);
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
const double v_bx, const double omega_bz, const double dt, const bool use_twist_input = true);
const double v_bx, const double angular_command, const double dt, const bool use_twist_input = true);

Comment on lines +197 to +199
angular_ = use_twist_input
? last_angular_command_
: convert_steering_angle_to_angular_velocity(v_bx, last_angular_command_);
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
angular_ = use_twist_input
? last_angular_command_
: convert_steering_angle_to_angular_velocity(v_bx, last_angular_command_);
angular_ = use_twist_input
? angular_command
: convert_steering_angle_to_angular_velocity(v_bx, angular_command);

std::tuple<std::vector<double>, std::vector<double>> SteeringOdometry::get_commands(
const double v_bx, const double omega_bz, const bool open_loop,
const bool reduce_wheel_speed_until_steering_reached)
const double v_bx, const double last_angular_command_, const bool open_loop,
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
const double v_bx, const double last_angular_command_, const bool open_loop,
const double v_bx, const double angular_command, const bool open_loop,

Comment on lines +268 to +269
? SteeringOdometry::convert_twist_to_steering_angle(v_bx, last_angular_command_)
: last_angular_command_;
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
? SteeringOdometry::convert_twist_to_steering_angle(v_bx, last_angular_command_)
: last_angular_command_;
? SteeringOdometry::convert_twist_to_steering_angle(v_bx, angular_command)
: angular_command;

* \return Tuple of velocity commands and steering commands
*/
std::tuple<std::vector<double>, std::vector<double>> get_commands(
const double v_bx, const double omega_bz, const bool open_loop = true,
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
const double v_bx, const double omega_bz, const bool open_loop = true,
const double v_bx, const double angular_command, const bool open_loop = true,

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.

Controller handling different input types

3 participants