Skip to content
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

Fix steering controllers library kinematics #1150

Merged
merged 12 commits into from
Jul 3, 2024

Conversation

christophfroehlich
Copy link
Contributor

@christophfroehlich christophfroehlich commented May 26, 2024

A follow-up of #1149 to fix bugs of the steering library, namely

  • in open-loop mode, zero steering angle was used for IK calculation
    discussed in Add mobile robot kinematics 101 and improve steering library docs #954 (my fix breaks API of the library, but it had no information about open_loop. I could duplicate the get_commands() method to get_commands_open_loop(), but that would break ABI too?)
  • wrong wheelspeed was used (traction on steering wheel, instead of other axle was assumed)
  • Improve odometry of overdetermined measurements. use nonlinear dependency from wheel speed to calculate linear velocity (ideal) vs the old linear average:
    image

This should finally fix #937 #933 and #789

@christophfroehlich christophfroehlich changed the title Fix/steering controllers library kinematics Fix steering controllers library kinematics May 26, 2024
@christophfroehlich christophfroehlich force-pushed the fix/steering_controllers_library-docs branch from 4b06b5f to 77212df Compare May 27, 2024 19:18
@christophfroehlich christophfroehlich force-pushed the fix/steering_controllers_library_kinematics branch 2 times, most recently from 498e09d to c421ad0 Compare May 28, 2024 19:54
Base automatically changed from fix/steering_controllers_library-docs to master June 5, 2024 19:50
- in open-loop mode, zero steering angle was used for IK calculation
- wrong wheelspeed was used (traction on steering wheel, instead of other axle was assumed)
Copy link
Contributor

@qinqon qinqon left a comment

Choose a reason for hiding this comment

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

first pass, I will review the "Improve odometry of overdetermined measurements" later on

Copy link
Contributor

mergify bot commented Jun 19, 2024

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

@christophfroehlich
Copy link
Contributor Author

fe2ba4b:

$ colcon test --packages-select steering_controllers_library ackermann_steering_controller bicycle_steering_
controller tricycle_steering_controller
Starting >>> steering_controllers_library
Finished <<< steering_controllers_library [0.38s]          
Starting >>> ackermann_steering_controller
Starting >>> bicycle_steering_controller
Starting >>> tricycle_steering_controller
Finished <<< ackermann_steering_controller [0.93s]                                                                                                 
Finished <<< bicycle_steering_controller [0.97s]
Finished <<< tricycle_steering_controller [0.96s]

Summary: 4 packages finished [1.76s]

Comment on lines +162 to +169
// overdetermined, we take the average
const double right_steer_pos_est = std::atan(
wheelbase_ * std::tan(right_steer_pos) /
(wheelbase_ - wheel_track_ / 2 * std::tan(right_steer_pos)));
const double left_steer_pos_est = std::atan(
wheelbase_ * std::tan(left_steer_pos) /
(wheelbase_ + wheel_track_ / 2 * std::tan(left_steer_pos)));
steer_pos_ = (right_steer_pos_est + left_steer_pos_est) * 0.5;
Copy link
Contributor

Choose a reason for hiding this comment

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

Calculations are fine, but I thin we can split it a little to re-use and improve readability having "atan" and "tan" at the same line is a little confusing.

Copy link
Contributor

Choose a reason for hiding this comment

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

Nah that's fine since this is following the docs.

Copy link
Contributor

@qinqon qinqon left a comment

Choose a reason for hiding this comment

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

/lgtm

@destogl destogl merged commit df04492 into master Jul 3, 2024
4 of 18 checks passed
@destogl destogl deleted the fix/steering_controllers_library_kinematics branch July 3, 2024 17:43
wittenator pushed a commit to wittenator/ros2_controllers that referenced this pull request Jul 5, 2024
@christophfroehlich christophfroehlich added backport-humble This label should be used by maintaines only! Label triggers PR backport to ROS2 humble. backport-iron This label should be used by maintaines only! Label triggers PR backport to ROS2 Iron. labels Jul 5, 2024
mergify bot pushed a commit that referenced this pull request Jul 5, 2024
mergify bot pushed a commit that referenced this pull request Jul 5, 2024
henrygerardmoore pushed a commit to henrygerardmoore/ros2_controllers that referenced this pull request Jul 19, 2024
…rom the library. (ros-controls#1150)

* Rename HW for simpler debugging and remove deprecated initial value handling.
* Remove fake from parameters.
* Remove FakeSystem
* Cleanup fake from tests.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-humble This label should be used by maintaines only! Label triggers PR backport to ROS2 humble. backport-iron This label should be used by maintaines only! Label triggers PR backport to ROS2 Iron.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Odomentry not properly working with ackermann steering
4 participants