-
Notifications
You must be signed in to change notification settings - Fork 408
Add AckermannDriveStamped control to steering library #1563
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
The tests on HEAD are currently broken, but I wanted to get this PR out in order to track progress. |
There was a problem hiding this 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.
steering_controllers_library/include/steering_controllers_library/steering_odometry.hpp
Outdated
Show resolved
Hide resolved
This pull request is in conflict. Could you fix it @wittenator? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I fixed the CMakeLists according to #1697. @wittenator do you have time to discuss the open conversations in this PR?
steering_controllers_library/src/steering_controllers_library.cpp
Outdated
Show resolved
Hide resolved
@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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll wait for fixing the open conversations before the final review
edit: and please take care of the pre-commit errors (have you installed it?)
steering_controllers_library/test/test_steering_controllers_library_ackermann_input.hpp
Outdated
Show resolved
Hide resolved
steering_controllers_library/test/test_steering_controllers_library_ackermann_input.hpp
Outdated
Show resolved
Hide resolved
@wittenator, sorry for missing your comment. I noticed that you have updated the tests. Will take another look shortly. |
---------------------------------- | ||
|
||
The controller uses velocity input, i.e., stamped `twist messages <twist_msg_>`_ where linear ``x`` and angular ``z`` components are used. | ||
The controller uses velocity input, i.e., stamped `twist messages <twist_msg_>`_ where linear ``x`` and angular ``z`` components are used if ``twist_input == true``. If ``twist_input == false``, the controller uses `control_msgs/msg/SteeringControllerStatus <steering_controller_status_msg_>`_ where linear ``speed`` and angular ``steering_angle`` components are used. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we add more context for the inputs, for example
The controller uses velocity input, i.e., stamped `twist messages <twist_msg_>`_ where:
- **Linear velocity (`linear x`)**: Represents the forward/backward motion of the robot along its x-axis (in meters per second, m/s).
- **Angular velocity (`angular z`)**: Represents the rotational motion of the robot around its z-axis (in radians per second, rad/s).
These components are used when ``twist_input == true``.
If ``twist_input == false``, the controller uses `control_msgs/msg/SteeringControllerStatus <steering_controller_status_msg_>`_ where:
- **Speed (`speed`)**: Represents the linear speed of the robot (in meters per second, m/s).
- **Steering angle (`steering_angle`)**: Represents the angle of the steering joints (in radians, rad).
Values in other components are ignored.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, I can add this. One thing that comes up then is: What is a good way to describe the steering angle? The exact positions of the joints and wheels depends on both the steering angle as an abstract value and the exact kinematic setup of the robot. For an Ackermann steering geometry, the positions of the joints are different from each other and from the steering angle, so I had trouble finding a fitting description of it without mentioning something like a steering wheel or some common element that links the steering joints.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are terminologies introduced at https://control.ros.org/rolling/doc/ros2_controllers/doc/mobile_robot_kinematics.html#mobile-robot-kinematics helpful to give a description ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
one could define the steering angle with the ICR being perpendicular to the imaginary single steering wheel.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've added a small overview for both cases that describe the inputs and their physical equivalent in the docs.
@wittenator, great work on the test coverage added in I'd suggest adding one more test to cover the new Overall, these changes look solid! |
This pull request is in conflict. Could you fix it @wittenator? |
There was a problem hiding this 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?
Isn't this implicitly done by the new tests using the yaml parmeterfile? |
I'm on it and going to fix the conflicts over the coming days. Thanks for answering the remaining few questions! |
There was a problem hiding this 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.
right_traction_wheel_vel, left_traction_wheel_vel, steer_pos_); | ||
const double angular_velocity = | ||
convert_steering_angle_to_angular_velocity(linear_velocity, steer_pos_); | ||
const double angular_velocity = std::tan(steer_pos_) * linear_velocity / wheel_base_; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shouldnt it use convert_steering_angle_to_angular_velocity here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, most definitely, I used it now instead.
msg.twist.angular.z = std::numeric_limits<double>::quiet_NaN(); | ||
} | ||
|
||
void reset_controller_reference_msg( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we need this specialization?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're right, this is an unnecessary specialization. I removed it
steering_controllers_library/src/steering_controllers_library.cpp
Outdated
Show resolved
Hide resolved
steering_controllers_library/src/steering_controllers_library.cpp
Outdated
Show resolved
Hide resolved
steering_controllers_library/src/steering_controllers_library.cpp
Outdated
Show resolved
Hide resolved
steering_controllers_library/src/steering_controllers_library.cpp
Outdated
Show resolved
Hide resolved
// store (for open loop odometry) and set commands | ||
last_linear_velocity_ = timeout ? 0.0 : reference_interfaces_[0]; | ||
last_angular_velocity_ = timeout ? 0.0 : reference_interfaces_[1]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why do we need this here, and haven't needed it before?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, this slipped in from some playing around in the code. I removed it now
std::string steering_interface_name_ = "position"; | ||
// defined in setup | ||
std::string traction_interface_name_ = ""; | ||
std::string preceeding_prefix_ = "pid_controller"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
std::string preceeding_prefix_ = "pid_controller"; | |
std::string preceding_prefix_ = "pid_controller"; |
we already discussed this, haven't this changed?
However, this is not used at all. Please don't copy dead code.
Co-authored-by: Christoph Fröhlich <[email protected]>
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:
colcon test
andpre-commit run
(requires you to install pre-commit bypip3 install pre-commit
)