Skip to content

Read and apply limits from the URDF - #35

Open
firesurfer wants to merge 4 commits into
mainfrom
feature/read-limits-from-urdf
Open

Read and apply limits from the URDF#35
firesurfer wants to merge 4 commits into
mainfrom
feature/read-limits-from-urdf

Conversation

@firesurfer

Copy link
Copy Markdown
Contributor

Added features

  1. Read maximum joint effort and maximum joint velocity from the urdf tag
  2. Convert these limits to the coupled coordinates space (@pvonwirth thats your review part)
  3. Actually apply the limits (in mock -> throw exception in case maximum velocity was exceeded, in real hardware -> set it to the drive as limits)

Notes

  1. This patch will override any maximum_motor_velocity limit and maximum_joint_torque limit set in the drive parameter files !
  2. This patch will need additional adaptions in the driver packages (added transform)

Discussion points

I don't really like the urdf tags as they are fixed in what we can pass there. For example adding a power limit would not be possible right now but somewhat desirable ?

…l to coupled coordinates - this needed an additional function added to the kinematics translator

@pvonwirth pvonwirth left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

You do not verify or ensure maximum joint limits within the couplend_..._interface class.
Please correct me, if I'm wrong.
But with only the motors observing / limiting themselves, this does not observe the actual maximum joint velocities. (Due to coupled kinematics)

Thus, I would first of all suggest to limit the joint commands where we still have joint commands.

The second issue is more critical: If one motor limits its commanded velocity and others do not, this may lead to involuntary absolutely uncommanded and undesired movements, especially with coupled kinematics, making the system unpredictable.
This is a state that we, i.m.h.o. should absolutely avoid.

A better approach is to detect 'overvelocity' and limit the entire robot equally, so that the entire robot becomes slower but the position trajectory stays invariant.

Limiting torques is even a more difficult problem to discuss.
I would put the hardware limits (with safety margin as already is intended) as absolute error barrier, freezing the robot if a violation is detected on that level. Because it should have be handled before.

Maybe this is worse a discussion. Maybe also together with @nferber to define actions the robot is allowed to take and the ones it should never do when applying safety limits.

{
// Factor by which we extend the hard limits so that what an application uses as limit for the input and what we use as
// hard safe factors is a bit scaled
inline constexpr double velocity_range_extension_factor = 1.1;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Do you think 10% is "a bit" scaled ?

if (!drive_->getGearboxRatio(configured_gear_ratio_)) {
RCLCPP_ERROR_STREAM(logger_, "Failed to obtain gear ratio");
// Throw as this is critical because we cannot use it to calculate the proper maximum motor velocity
throw std::runtime_error("Failed to btain the gear box ration of drive: " + get_name());

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

  1. type: "obtain"
  2. I think that drive internals such as gearbox ration should not be exposed to the outside. This is something for the drive and its firmware and noone else ...

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.

2 participants