Skip to content

[Servo] Move enforcePositionLimits and enforceVelocityLimits to utilities - #2180

Merged
AndyZe merged 10 commits into
moveit:mainfrom
ibrahiminfinite:cleanup3
May 24, 2023
Merged

AndyZe merged 10 commits into
moveit:mainfrom
ibrahiminfinite:cleanup3

Conversation

@ibrahiminfinite

@ibrahiminfinite ibrahiminfinite commented May 16, 2023 •

Copy link
Copy Markdown
Contributor

Description

This PR moves the functions enforcePositionLimits and enforceVelocityLimits into utilities from servo_calcs.cpp and enforce_limits.cpp respectively.
The dependency of some of the utility functions on rclcpp:Clock has also been removed.

Checklist

@codecov

codecov Bot commented May 16, 2023 •

Copy link
Copy Markdown

Codecov Report

Patch coverage: 75.81% and project coverage change: -0.03 ⚠️

Comparison is base (15b2331) 50.55% compared to head (d983053) 50.51%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2180      +/-   ##
==========================================
- Coverage   50.55%   50.51%   -0.03%     
==========================================
  Files         387      386       -1     
  Lines       31740    31735       -5     
==========================================
- Hits        16044    16029      -15     
- Misses      15696    15706      +10     
Impacted Files Coverage Δ
moveit_ros/moveit_servo/src/servo_calcs.cpp 71.08% <56.25%> (+0.81%) ⬆️
moveit_ros/moveit_servo/src/utilities.cpp 73.02% <82.61%> (-11.25%) ⬇️

... and 2 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@henningkayser henningkayser left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Is there a reason to not use RobotState::enforceBounds() or the alternatives for position/velocities?

@ibrahiminfinite

Copy link
Copy Markdown
Contributor Author

Is there a reason to not use RobotState::enforceBounds() or the alternatives for position/velocities?

Probably because of this (from PR #451 )

Previously, the incoming robot state velocity was used to check if the robot would move beyond the joint limit. That was a problem if the robot state did not contain velocity data, i.e. if "copy dynamics" hadn't been turned on.
This PR uses the prospective robot velocity from Servo itself to check if the joint would move beyond the position limit and halt, if so. This velocity should always be available regardless of whether "copy dynamics" is ON.

Maybe @AndyZe can clarify more on this ?

Also @sea-bass , did you have any cases where you needed to use the override_velocity_scaling_factor parameter ?
If that is not useful, we can take that out as well.

@sea-bass

sea-bass commented May 17, 2023 •

Copy link
Copy Markdown
Contributor

We are currently using override_velocity_scaling_factor actively right now, so please keep it!

@ibrahiminfinite

Copy link
Copy Markdown
Contributor Author

@AndyZe
Can you clarify on this #2180 (review)

@AndyZe

AndyZe commented May 18, 2023

Copy link
Copy Markdown
Member

I agree with your comment there

@ibrahiminfinite

Copy link
Copy Markdown
Contributor Author

This PR is a cleanup PR, mostly to keep things cleaner in the current ServoCalcs and also pull out functions that can be reused into utilities so that it could be used in the upcoming refactor.

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

Just one comment here

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

Thanks for this! Found a few typos and suggestions.

@ibrahiminfinite
ibrahiminfinite requested a review from sea-bass May 19, 2023 17:01

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

Almost there! I found a bug in the log message printing.

I think the remaining CI failure might just require updating your branch to main since SonarCloud was just added in a little while earlier.

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

Awesome!

@ibrahiminfinite

Copy link
Copy Markdown
Contributor Author

@sjahr @sea-bass
I think this can go in now, all tests passing

@sjahr

sjahr commented May 24, 2023

Copy link
Copy Markdown
Contributor

@AndyZe Do you mind giving a final review?

@AndyZe

AndyZe commented May 24, 2023

Copy link
Copy Markdown
Member

Still looks good to me. Let's merge it

@AndyZe
AndyZe merged commit 8d319c5 into moveit:main May 24, 2023
@ibrahiminfinite
ibrahiminfinite deleted the cleanup3 branch June 3, 2023 14:12
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.

5 participants