Fix orientation of subframe offset before applying to motion plans#2890
Fix orientation of subframe offset before applying to motion plans#2890riv-tnoble wants to merge 15 commits intomoveit:masterfrom
Conversation
…d subframe offset to LIN and CIRC motions
Codecov Report
@@ Coverage Diff @@
## master #2890 +/- ##
==========================================
+ Coverage 61.31% 61.35% +0.04%
==========================================
Files 373 373
Lines 31742 31747 +5
==========================================
+ Hits 19461 19476 +15
+ Misses 12281 12271 -10
Continue to review full report at Codecov.
|
|
Could those calculations be moved to a common location? Are they maybe even useful outside of |
|
@simonschmeisser While they are probably useful, those calculations are a specific fix for this |
|
Also fixes #2884 |
|
Agree that it'd be nice to make this code common if possible. The most reasonable place seems like the ResolveConstraintFrames plugin, which calculates the subframe offsets before the plan request reaches the planner. I have a couple of concerns though:
|
There was a problem hiding this comment.
Thank you very much for your investigation!
Other planners rely on the KinematicConstraint classes, which are probably designed for sampling. This is a fundamental differnce of OMPL - here we just use a single constraint. I would prefer a more general approach, but currently am not aware of a simple solution.
To avoid code-duplication, you could still move the offset part into trajectory_functions.cpp or similar.
Note that for a circle, you probably also have to add the offset to the circ_path_point (interim or center): https://github.com/ros-planning/moveit/blob/049be73b8343d67ffde400fed9ed4c387c6ea9e5/moveit_planners/pilz_industrial_motion_planner/src/trajectory_generator_circ.cpp#L183
| Eigen::Vector3d offset_in_world; | ||
| tf2::fromMsg(req.goal_constraints.at(0).position_constraints.at(0).target_point_offset, offset_in_world); | ||
| Eigen::Quaterniond goal_orientation; | ||
| tf2::fromMsg(req.goal_constraints.at(0).orientation_constraints.at(0).orientation, goal_orientation); | ||
| Eigen::Vector3d offset_in_goal = goal_orientation * offset_in_world; | ||
| p.x -= offset_in_goal[0]; | ||
| p.y -= offset_in_goal[1]; | ||
| p.z -= offset_in_goal[2]; |
There was a problem hiding this comment.
Would a calculation directly with Eigen types give the same results? Would look a bit more readable to me:
| Eigen::Vector3d offset_in_world; | |
| tf2::fromMsg(req.goal_constraints.at(0).position_constraints.at(0).target_point_offset, offset_in_world); | |
| Eigen::Quaterniond goal_orientation; | |
| tf2::fromMsg(req.goal_constraints.at(0).orientation_constraints.at(0).orientation, goal_orientation); | |
| Eigen::Vector3d offset_in_goal = goal_orientation * offset_in_world; | |
| p.x -= offset_in_goal[0]; | |
| p.y -= offset_in_goal[1]; | |
| p.z -= offset_in_goal[2]; | |
| geometry_msgs::Pose pose; | |
| pose.position = | |
| req.goal_constraints.at(0).position_constraints.at(0).constraint_region.primitive_poses.at(0).position; | |
| pose.orientation = req.goal_constraints.at(0).orientation_constraints.at(0).orientation; | |
| normalizeQuaternion(pose.orientation); | |
| Eigen::Isometry3d pose_eigen; | |
| tf2::fromMsg(pose, pose_eigen); | |
| Eigen::Isometry3d offset_in_world; | |
| tf2::fromMsg(req.goal_constraints.at(0).position_constraints.at(0).target_point_offset, offset_in_world); | |
| pose_eigen.linear() -= offset_in_world * pose_eigen.rotation(); |
There was a problem hiding this comment.
Thanks for the advice! Will get those tasks done tomorrow:
- Move common offset transformation into
trajectory_functions.cpp - Apply offset to center for CIRC motions
- Tidy up Eigen computations
…path constraints of CIRC motions
|
@jschleicher @rhaschke @v4hn Any ideas why the build might be failing? |
|
Looks like the Windows build failure is the same as this #2892 (comment) Unsure why so many tests would be failing provided they aren't all using offsets and aren't checking for specific end poses |
|
Unsure why so many tests would be failing provided they aren't all using offsets and aren't checking for specific end poses
I just triggered re-runs to rule out a system issue, but you probably broke something and will have to look into it. :)
Just run the specific failing tests locally to debug.
|
| * @param constraint | ||
| * @return | ||
| */ | ||
| Eigen::Isometry3d getConstraintPose(moveit_msgs::Constraints constraint); |
There was a problem hiding this comment.
| Eigen::Isometry3d getConstraintPose(moveit_msgs::Constraints constraint); | |
| Eigen::Isometry3d getConstraintPose(const moveit_msgs::Constraints& constraint); |
|
@aa-tom You can run the tests locally with more output using for example so maybe some check for empty constraint lists got lost? |
|
Thanks. Will run the tests locally and take a look this afternoon |
|
Sorry for the delay! I believe I've fixed the tests now (locally, at least). The issue was caused by trying to access the goal's position constraints when applying the offset to the circle interim/center as some tests use goals with no position constraints. I have a couple of questions I was hoping you could answer @jschleicher :
|
|
Looks like the Windows build failed. |
It's not normal, but it's supported throughout the pipeline and should not break anything.
Yes, please ignore it, RoboStack has trouble again. |
jschleicher
left a comment
There was a problem hiding this comment.
Great to see this progress! Approving 👍
v4hn
left a comment
There was a problem hiding this comment.
I do believe you fixed the issue with this patch at your end, but do we actually have a test for your use setup? Not saying I insist on writing one to merge this fix.
Please consider my inline feedback though.
| const geometry_msgs::Quaternion& orientation) | ||
| { | ||
| geometry_msgs::Pose pose; | ||
| pose.position = constraint.position_constraints.front().constraint_region.primitive_poses.front().position; |
There was a problem hiding this comment.
This is the only line where you use constraint and passing the whole constraint object makes the other two parameters redundant in two out of three calls (Is the CIRC call passing path_constraints actually correct?)
Please either pass only a Constraints message *and possibly create one for the CIRC call) or change the first parameter to a Vector3, so you can unpack the Constraints message before the call.
There was a problem hiding this comment.
I addressed this feedback in rivelinrobotics#5. Please merge this and provide unit tests. Thanks!
No automated tests currently, but I'm happy to write them. I'm thinking perhaps a unit test for each planner inspecting the
I believe the
Shall do. I'll change the parameter to
|
|
@rivelin-tom, what is your progress on #2890 (comment)? This PR is currently blocking the next Noetic release as your colleague? asked for merging this before: #2890 (comment) |
|
Ping @rivelin-tom. |
Fix moveit#2879 by reorienting the subframe offset applied to a goal pose in the PTP planner, so that it is applied in the correct direction. Also add the same offset computation to LIN and CIRC generators, thus allowing them to work with subframes. Co-authored-by: Robert Haschke <rhaschke@users.noreply.github.com>
|
@rhaschke should this be closed since you merged it manually? |
No, I'm still waiting for unit tests to be added... Unfortunately, there was no activity from @rivelin-tom since 15 days. |
|
@rhaschke Apologies for the delay but @rivelin-tom has had to implement some features and enhancements for us. We've not forgotten about it, just had some urgent and critical work to get out the way first. |
|
@rhaschke Thanks a bunch for getting it ready for the release and apologies for the delay. I'm super busy at the moment, so it'll be a little while before I'm able to pick this back up and write the tests. I do intend to write them! |
|
Is this replaced by e30c6fa? see also moveit/moveit_task_constructor#191 and moveit/moveit_task_constructor#304 |
|
@rivelin-tom Is it still realistic to wait for your tests here? I know you want to do them, but you are obviously busy with other things.
No, feel free to open separate PRs if you have patches. |
|
@v4hn I think it'd be best to close this off for now to avoid delaying longer. I believe it was already merged with master as part of the 1.1.6 release? Happy for this PR to simply be closed if that's the case |
|
Yes, the fix was already merged. However, this PR is still open as a reminder that you, @rivelin-tom, promised to provide some unit tests. Of course, you can close here and open a new PR for those tests. |
|
Sorry, was away for Christmas. I will do that, then. Thanks for the help implementing the changes 👍 |
Partially reverts changes of #2890
Partially reverts changes of moveit#2890
Description
This PR fixes #2879 by reorienting the subframe offset applied to a goal pose in the PTP planner, so that it is applied in the correct direction. It also adds the same offset computation to LIN and CIRC motions, allowing them to work with subframes.
The video below demonstrates the fix by showing that the goal point planned to by pilz PTP is now the same as OMPL.
pilz_subframes_fix.mp4
Checklist