Skip to content

Servo: re-order velocity limit check & minor cleanup - #956

Merged
tylerjw merged 5 commits into
moveit:mainfrom
AndyZe:andyz/various_servo_fixes2
Jan 7, 2022
Merged

tylerjw merged 5 commits into
moveit:mainfrom
AndyZe:andyz/various_servo_fixes2

Conversation

@AndyZe

@AndyZe AndyZe commented Jan 4, 2022

Copy link
Copy Markdown
Member

This is a simplified version of #886. It removes the latency compensation parameter that was controversial with reviewers for some reason (despite fixing some hardware issues and being backed as similar to what the robot manufacturers use :/ ). By splitting it out, I hope the review is faster.

The various fixes here are:

  • Re-order the checking of velocity limits. These limits should be checked after the other operations that affect velocity. Otherwise they aren't accurate.

  • Delete a block of code that was accidentally duplicated.

  • Clean up some comments.

  • Delete a couple unused things.

You can test this PR with the tutorial: https://moveit.picknik.ai/main/doc/realtime_servo/realtime_servo_tutorial.html

If you're familiar with the tutorial, you'll notice that motion is faster.

@AndyZe
AndyZe force-pushed the andyz/various_servo_fixes2 branch from 0c361cb to a38e4e8 Compare January 4, 2022 03:32
- Re-order the checking of velocity limits. These limits should be checked after the other operations that affect velocity. Otherwise they aren't accurate.

- Delete a block of code that was accidentally duplicated.

- Clean up some comments.

- Delete a couple unused things.
@AndyZe AndyZe changed the title Andyz/various servo fixes2 Various servo fixes2 Jan 4, 2022
@moveit moveit deleted a comment from mergify Bot Jan 4, 2022
@AndyZe
AndyZe force-pushed the andyz/various_servo_fixes2 branch from a38e4e8 to 109eb66 Compare January 4, 2022 03:38
@codecov

codecov Bot commented Jan 4, 2022 •

Copy link
Copy Markdown

Codecov Report

Merging #956 (f65cc43) into main (79addb3) will increase coverage by 0.02%.
The diff coverage is 95.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #956      +/-   ##
==========================================
+ Coverage   57.90%   57.92%   +0.02%     
==========================================
  Files         310      310              
  Lines       26113    26105       -8     
==========================================
  Hits        15118    15118              
+ Misses      10995    10987       -8     
Impacted Files Coverage Δ
moveit_ros/moveit_servo/src/servo_parameters.cpp 79.77% <75.00%> (-0.07%) ⬇️
moveit_ros/moveit_servo/src/enforce_limits.cpp 100.00% <100.00%> (ø)
moveit_ros/moveit_servo/src/servo_calcs.cpp 68.15% <100.00%> (+0.50%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 79addb3...f65cc43. Read the comment docs.

command_in_type: "unitless" # "unitless"> in the range [-1:1], as if from joystick. "speed_units"> cmds are in m/s and rad/s
scale:
# Scale parameters are only used if command_in_type=="unitless"
linear: 0.4 # Max linear velocity. Meters per publish_period. Unit is [m/s]. Only used for Cartesian commands.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

this simply wasn't accurate. It's left from the initial implementation years ago

Eigen::ArrayXd enforceVelocityLimits(const moveit::core::JointModelGroup* joint_model_group, double publish_period,
const Eigen::ArrayXd& delta_theta);
void enforceVelocityLimits(const moveit::core::JointModelGroup* joint_model_group, const double publish_period,
sensor_msgs::msg::JointState& joint_state);

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I had to refactor this because the order of velocity limit application was modified. No change in functionality.

std::bind(&ServoCalcs::collisionVelocityScaleCB, this, _1));

// Publish to collision_check for worst stop time
worst_case_stop_time_pub_ =

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This was unused. I think it's gone from MoveIt1 completely but somehow re-appeared in the port to MoveIt2

std::exit(EXIT_FAILURE);
}

// Load the smoothing plugin

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This was duplicated in the block above

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

I don't see anything wrong with these changes, will approve after my questions are answered. Could you give this PR a more meaningful name so that the current one doesn't end up as a commit message?

@AndyZe AndyZe changed the title Various servo fixes2 Servo: re-order velocity limit check & minor cleanup Jan 7, 2022

@tylerjw tylerjw 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.

I read through these and they look like good changes. Thank you!

@tylerjw
tylerjw merged commit 4f89450 into moveit:main Jan 7, 2022
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.

3 participants