moveit2 icon indicating copy to clipboard operation
moveit2 copied to clipboard

Planning request adapters: short-circuit if failure, return code rather than bool

Open AndyZe opened this issue 3 years ago • 1 comments

Description

Previously, if one of the planning request adapters failed, the pipeline would continue onward anyway. Also, only a bool was returned, although moveit_msgs::MoveItErrorCodes.msg has some enums to report more detail.

This PR short-circuits in case there is an adapter failure and reports the actual error code.

For example, here's the output when there are 6 adapters and FixStartStateCollision fails:

[moveit_cpp_tutorial-4] [ERROR] [1665063576.588225372] [moveit_ros.fix_start_state_collision]: Running 'Fix Start State In Collision'
[moveit_cpp_tutorial-4] [WARN] [1665063576.588230842] [moveit_ros.fix_start_state_collision]: Unable to find a valid state nearby the start state (using jiggle fraction of 0.020000 and 100 sampling attempts).
[moveit_cpp_tutorial-4] [ERROR] [1665063576.588242808] [moveit.planning_request_adapter]: Adapter  result: -10
[moveit_cpp_tutorial-4] [ERROR] [1665063576.588261618] [moveit.planning_request_adapter]: Adapter  result: -10
[moveit_cpp_tutorial-4] [ERROR] [1665063576.588265353] [moveit.planning_request_adapter]: Adapter  result: -10
[moveit_cpp_tutorial-4] [ERROR] [1665063576.588267620] [moveit.planning_request_adapter]: Adapter  result: -10
[moveit_cpp_tutorial-4] [ERROR] [1665063576.588291731] [moveit.planning_request_adapter]: Adapter  result: -10
[moveit_cpp_tutorial-4] [ERROR] [1665063576.588300902] [moveit.ros_planning.planning_pipeline]: Res return: -10
[moveit_cpp_tutorial-4] [ERROR] [1665063576.588302635] [moveit.ros_planning_interface.planning_component]: Could not compute plan successfully

A code of -10 means "START_STATE_IN_COLLISION" :+1:

Prior to this PR, the output would be:

[moveit_cpp_tutorial-4] [ERROR] [1665067792.760674407] [moveit.planning_request_adapter]: Adapter result: 0
[moveit_cpp_tutorial-4] [ERROR] [1665067792.760687109] [moveit.planning_request_adapter]: Adapter result: 0
[moveit_cpp_tutorial-4] [ERROR] [1665067792.760691608] [moveit.planning_request_adapter]: Adapter result: 0
[moveit_cpp_tutorial-4] [ERROR] [1665067792.760693864] [moveit.planning_request_adapter]: Adapter result: 0
[moveit_cpp_tutorial-4] [ERROR] [1665067792.760695824] [moveit.planning_request_adapter]: Adapter result: 0
[moveit_cpp_tutorial-4] [ERROR] [1665067792.760701750] [moveit.ros_planning.planning_pipeline]: Res return: 0
[moveit_cpp_tutorial-4] [ERROR] [1665067792.760704577] [moveit.ros_planning_interface.planning_component]: Could not compute plan successfully

Which is not very useful for debugging.

Testing this PR

I've been testing with the move_group_interface tutorial. You can publish collision objects conveniently from the GUI:

ros2 launch moveit2_tutorials move_group.launch.py

ros2 launch moveit2_tutorials move_group_interface_tutorial.launch.py

This image shows a START_STATE_IN_COLLISION result code.

box_collision

AndyZe avatar Oct 06 '22 14:10 AndyZe

Codecov Report

Base: 51.09% // Head: 51.08% // Decreases project coverage by -0.02% :warning:

Coverage data is based on head (180d315) compared to base (749c5ae). Patch has no changes to coverable lines.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1605      +/-   ##
==========================================
- Coverage   51.09%   51.08%   -0.01%     
==========================================
  Files         381      381              
  Lines       31746    31746              
==========================================
- Hits        16217    16213       -4     
- Misses      15529    15533       +4     
Impacted Files Coverage Δ
...nning_scene_monitor/src/planning_scene_monitor.cpp 45.29% <0.00%> (-0.43%) :arrow_down:

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

:umbrella: View full report at Codecov.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.

codecov[bot] avatar Oct 10 '22 15:10 codecov[bot]