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

Discuss some force-pushed changes #545

Closed
wants to merge 5 commits into from

Conversation

sjahr
Copy link
Contributor

@sjahr sjahr commented Mar 18, 2024

@rhaschke I have some questions around the changes you created on the ros2 branch. I'd like to use this PR to understand them better and potentially make some updates.

@sjahr sjahr requested a review from rhaschke March 18, 2024 17:50
@@ -63,11 +63,11 @@ class CartesianPath : public PlannerInterface

void init(const moveit::core::RobotModelConstPtr& robot_model) override;

Result plan(const planning_scene::PlanningSceneConstPtr& from, const planning_scene::PlanningSceneConstPtr& to,
MoveItErrorCode plan(const planning_scene::PlanningSceneConstPtr& from, const planning_scene::PlanningSceneConstPtr& to,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Why did you decide to introduce Result instead of using error codes? Aren't we loosing information by reducing the error code to a boolean?

Copy link
Contributor

Choose a reason for hiding this comment

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

Originally, #525 introduced tl::expected<bool, std::string> to return both, a boolean result and an error message. Later, this was changed to MoveItErrorCode, which - in ROS2 - supports the error message and an error source. As this extended MoveItErrorCode is not available in ROS1 and the purpose was just to return an additional string message, I introduced an explicit data type that is uniformly usable in ROS1 and ROS2.
If at all, the source information is lost (it was never fed into the error code).

Copy link
Contributor

Choose a reason for hiding this comment

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

I don't consider reverting to MoveItErrorCode and I don't see something missing so far.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If at all, the source information is lost (it was never fed into the error code).

Good point that should be done, otherwise that field is pointless.

I see, have you considered enhancing the error code with a string message in moveit1? The main motivation here was to improve the debug-ability of moveit in general. The source field was introduced to infer the planning pipeline that created the error message when using parallel planning. Without that, I think it is just possible to tell that one of the planners failed with the given error message. Not which one. Alternatively, the string could be enhanced with that information.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, I shortly considered augmenting MoveItErrorCode in MoveIt1 as well. However, I decided against, because the error message is redundant as we already have a fixed mapping from the error code to a human-readable message (MoveItErrorCode::toString()). Further, the source member was not filled regularly - only in planning adapters. As far as I can see, the planning pipeline name is not yet stored in that field.

Note, that there are two MoveItErrorCode header files (I think one should be removed):

  • moveit_core/utils/include/moveit/utils/moveit_error_code.h (regularly used)
  • moveit_ros/hybrid_planning/hybrid_planning_manager/hybrid_planning_manager_component/include/moveit/hybrid_planning_manager/moveit_error_code_interface.h (used only once)

@@ -78,10 +78,10 @@ PlannerInterface::Result JointInterpolationPlanner::plan(const planning_scene::P
// add first point
result->addSuffixWayPoint(from->getCurrentState(), 0.0);
if (from->isStateColliding(from_state, jmg->getName()))
return { false, "Start state is in collision!" };
return MoveItErrorCode(MoveItErrorCodes::START_STATE_IN_COLLISION, "Start state is in collision!");
Copy link
Contributor Author

Choose a reason for hiding this comment

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

These returned in ros-old just FAILURE, I changed them so that the error code actually provides value

Copy link
Contributor

Choose a reason for hiding this comment

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

Note, that the error code is never actually considered in code - we just check for success.
It might be useful for inspection during debugging though.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, we did that in some custom applications. Given that MoveIt generates this error code, it would be great not to loose this information in the MTC solution.

Copy link
Contributor

Choose a reason for hiding this comment

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

How did you access that code in custom applications? It is never exposed from any stage!?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You're right, I think was wrong about that, sorry

@rhaschke
Copy link
Contributor

Thanks for your questions. I hope I answered all of them. Unfortunately, the diff link I provided originally, doesn't allow for comments. I just noticed that now.
I'm collecting fixups to the ros2 branch in a new PR: #547. Thanks for your input!
Did somebody already figure out, why the default goal reaching threshold is relaxed in ROS2 compared to ROS1?

@sjahr
Copy link
Contributor Author

sjahr commented Mar 20, 2024

@rhaschke Thanks for your detailed explanations. That is very helpful and going through you changes was insightful too!

Did somebody already figure out, why the default goal reaching threshold is relaxed in ROS2 compared to ROS1?

I can take a look into it. With Michael's change ported to moveit2 the MTC pick and place demo worked for me without needing to adjust the threshold but maybe I am missing something here.

@rhaschke
Copy link
Contributor

The MTC pick and place demo worked for me without needing to adjust the threshold.

The code using this threshold was only recently added in the master branch. So, if pick+place worked before on the old ros2 branch, this doesn't come at a surprise for me.

@sjahr sjahr force-pushed the pr-revert_some_cleanup_changes branch from 48d97b1 to e11f89c Compare March 25, 2024 10:24
@rhaschke
Copy link
Contributor

Dear @sjahr, can we close this? I think all changes were discussed.
Also, I would like to remove the branch ros2-old. Did you and your colleagues at PickNik successfully migrated to the new branch?

@sjahr sjahr closed this May 27, 2024
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