-
Notifications
You must be signed in to change notification settings - Fork 367
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
@christophfroehlich I fixed all the pre-commit checks and the colcon test checks. I think this should be ready for a first review now. |
@christophfroehlich Since there is quite a bit of incoming movement in the steering controllers library and the odometry library. Are we holding off with this PR's addition until these parts stabilized again? |
there is only one which i have on the list to be merged soon #836. I try to review yours within the next days |
No hurry, I need to fix the tests with the newest merge anyway. I'll ping you here, once I am done with this |
@christophfroehlich I fixed the tests. This should be ready now |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1563 +/- ##
==========================================
+ Coverage 84.77% 84.94% +0.17%
==========================================
Files 127 129 +2
Lines 12096 12277 +181
Branches 1036 1048 +12
==========================================
+ Hits 10254 10429 +175
- Misses 1503 1509 +6
Partials 339 339
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
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.
The changes look good. A few suggestions for improvement: Could we update the relevant documentation to reflect this change? It would be valuable to add more test coverage for the new functionality - particularly in the three controllers modified by this PR.
front_wheel_track: 2.12321 | ||
rear_wheel_track: 1.76868 | ||
front_wheels_radius: 0.45 | ||
rear_wheels_radius: 0.45 |
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.
The names of these parameters have been changed, see #1166. Can we update these accordingly ?
@@ -5,6 +5,7 @@ test_steering_controllers_library: | |||
open_loop: false | |||
velocity_rolling_window_size: 10 | |||
position_feedback: false | |||
twist_input: true |
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.
Being relatively new to ros2_control development, I'm not entirely familiar with the established practices to define params ... I wanted to share a thought on the parameter naming and type choice. The current bool parameter doesn't call out the supported input options. An enum-based parameter named input_type
could be an alternative but I'm not sure about the complexity that these introduce.
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.
afaik there is no enum-like parameter feature in rclcpp. The only thing we could use is a string array, with a one_of<>
validator.
I don't have a strong opinion here, maybe other reviewers have.
@@ -0,0 +1,215 @@ | |||
// Copyright (c) 2023, Stogl Robotics Consulting UG (haftungsbeschränkt) |
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.
nit, could we name this file as ..._library_ackerman_input.cpp ?
unsigned int velocity_rolling_window_size_ = 10; | ||
bool position_feedback_ = false; | ||
std::vector<std::string> rear_wheels_names_ = {"rear_right_wheel_joint", "rear_left_wheel_joint"}; | ||
std::vector<std::string> front_wheels_names_ = { |
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.
Similar to comments above on the changes introduced by #1166, please help update these variable names.
twist_input: { | ||
type: bool, | ||
default_value: true, | ||
description: "Choose whether a Twist/TwistStamped or a AckermannDriveStamped message is used as input.", |
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.
description: "Choose whether a Twist/TwistStamped or a AckermannDriveStamped message is used as input.", | |
description: "Choose whether a TwistStamped or a AckermannDriveStamped message is used as input.", |
we don't allow unstamped messages from jazzy on, or am I missing something?
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 have difficulties to follow your code with mixing phi and angular velocity, can you please clarify this for me? And some minor comments added to those of @Juliaj
@@ -167,3 +167,10 @@ steering_controllers_library: | |||
position_feedback is true then ``HW_IF_POSITION`` is taken as interface type", | |||
read_only: false, | |||
} | |||
|
|||
twist_input: { |
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.
should we rename it to use_twist_input
? This would make the params_.twist_input
code more descriptive.
type: bool, | ||
default_value: true, | ||
description: "Choose whether a Twist/TwistStamped or a AckermannDriveStamped message is used as input.", | ||
read_only: false, |
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.
does it make sense to change this when the controller is running?
@@ -180,16 +182,18 @@ bool SteeringOdometry::update_from_velocity( | |||
|
|||
double linear_velocity = get_linear_velocity_double_traction_axle( | |||
right_traction_wheel_vel, left_traction_wheel_vel, steer_pos_); | |||
const double angular_velocity = 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.
oops, the std::tan
was missing here?
@@ -252,7 +261,7 @@ std::tuple<std::vector<double>, std::vector<double>> SteeringOdometry::get_comma | |||
} | |||
#endif | |||
// steering angle | |||
phi = SteeringOdometry::convert_twist_to_steering_angle(v_bx, omega_bz); | |||
phi = twist_input ? SteeringOdometry::convert_twist_to_steering_angle(v_bx, omega_bz) : omega_bz; |
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 is this phi=omega_bz
for ackermann input?
std::vector<std::string> joint_names_ = { | ||
rear_wheels_names_[0], rear_wheels_names_[1], front_wheels_names_[0], front_wheels_names_[1]}; | ||
|
||
std::vector<std::string> rear_wheels_preceeding_names_ = { |
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 fix the typos here, see #1655
std::array<double, 4> joint_state_values_ = {{0.5, 0.5, 0.0, 0.0}}; | ||
std::array<double, 4> joint_command_values_ = {{1.1, 3.3, 2.2, 4.4}}; | ||
|
||
std::array<std::string, 2> joint_reference_interfaces_ = {{"linear", "angular"}}; |
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.
does it make sense to call this variable joint_
?
{ | ||
/// Save last linear and angular velocity: | ||
linear_ = v_bx; | ||
angular_ = omega_bz; | ||
angular_ = twist_input ? omega_bz : convert_steering_angle_to_angular_velocity(v_bx, omega_bz); |
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.
there is no steering angle here?
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
)