Skip to content

feat: adds ompl compatibility to the move_group_sequence - #1798

Closed
MarcoMagriDev wants to merge 4 commits into
moveit:mainfrom
MarcoMagriDev:feat/main/MoveGroupSequenceOMPL
Closed

MarcoMagriDev wants to merge 4 commits into
moveit:mainfrom
MarcoMagriDev:feat/main/MoveGroupSequenceOMPL

Conversation

@MarcoMagriDev

Copy link
Copy Markdown
Contributor

Description

The current implementation of MoveGroupSequence would allow you to specify the pipeline_id with which to plan the motion. Choosing the OMPL pipeline as planner causes the plan to fail.

This is due to the fact that internally to the MoveGroupSequence performs checks on the single planned path before joining two path together. The only checks that fails (in case of path planned with the OMPL pipeline) is the one on the stationarity of the last point of each planned trajectory. In particular, the condition regarding the zero acceleration value of the last point of the trajectory is never fulfilled.

Proposed solution

The proposed solution to this problem is quite brutal but empirically gives good results and would allow to use MoveGroupSequence with the OMPL planner.

@sjahr
sjahr requested a review from ct2034 December 9, 2022 18:26
@codecov

codecov Bot commented Dec 9, 2022 •

Copy link
Copy Markdown

Codecov Report

Patch coverage has no change and project coverage change: -0.45% ⚠️

Comparison is base (05f3501) 50.70% compared to head (124a71e) 50.25%.

❗ Current head 124a71e differs from pull request most recent head 3ba5ced. Consider uploading reports for the commit 3ba5ced to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1798      +/-   ##
==========================================
- Coverage   50.70%   50.25%   -0.45%     
==========================================
  Files         386      374      -12     
  Lines       31922    31277     -645     
==========================================
- Hits        16183    15714     -469     
+ Misses      15739    15563     -176     

see 116 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@ct2034

ct2034 commented Dec 9, 2022

Copy link
Copy Markdown
Contributor

Why is this issue unique to ompl?

@sjahr

sjahr commented Dec 9, 2022

Copy link
Copy Markdown
Contributor

I was wondering the same. @MarcoMagriDev do you have a minimal demo to reproduce the the error? Most planner plugins in MoveIt with PILZ beeing an exception create paths instead of trajectories and require running trajectory generation algorithm such as TOTG or Ruckig after a plan is generated. This is usually done in MoveIt with planning_request_adapters.

@MarcoMagriDev

Copy link
Copy Markdown
Contributor Author

@sjahr @ct2034 I don't know if the issue is related only to OMPL or it occurs for each planner different from PILZ.

@sjahr to reproduce the issue perform the following steps with reference to the panda_moveit_config

  1. add the pilz_industrial_motion_planner/MoveGroupSequenceAction capability to the move_group node
  2. run the demo ros2 launch moveit_resources_panda_moveit_config demo.launch.py
  3. run this script with different arguments:
    a) python3 send_move_group_sequence.py -t single : the robot should reach the extended position without any problem. When the motion is over, command a motion to the ready pose using the RViz interface before running the next tests.
    b) python3 send_move_group_sequence.py -t multi : you will get [ERROR] [1670856446.681808505] [panda_arm_controller]: Time between points 1 and 2 is not strictly increasing, it is 0.079133 and 0.079133 respectively and the robot will not move.
    c) python3 send_move_group_sequence.py -t multi : you will get
    [move_group-4] [ERROR] [1670856733.300848155] [moveit.pilz_industrial_motion_planner.trajectory_blender_transition_window]: During blending the last point of the preceding and the first point of the succeeding trajectory [move_group-4] [ERROR] [1670856733.300851601] [moveit.pilz_industrial_motion_planner.trajectory_blender_transition_window]: Trajectory blend request is not valid. [move_group-4] [ERROR] [1670856733.300890539] [moveit.pilz_industrial_motion_planner.move_group_sequence_action]: Planning pipeline threw an exception (error code: 99999): Blending failed

In both cases b) and c) the error is caused by the fact that the accelerations of the last point of each sub-trajectory coming from OMPL are not zero. By uncommenting lines 22 and 23 of the script you can also test what happen with the same targets with the PILZ pipeline.

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

Are the acceleration values of the last waypoint approximately 0 though? If anything, the fault should be in TOTG, that's where the time profile is coming from. A fix could be to explicityl zero out velocity and acceleration in the last waypoint there. I don't see why not since non-zero velocity is not supported anyway. For the general case, we can also add an HaltTrajectory planner adapter that ensures a smooth transition from the last waypoint to full stop.

@MarcoMagriDev

Copy link
Copy Markdown
Contributor Author

Are the acceleration values of the last waypoint approximately 0 though? If anything, the fault should be in TOTG, that's where the time profile is coming from. A fix could be to explicityl zero out velocity and acceleration in the last waypoint there. I don't see why not since non-zero velocity is not supported anyway. For the general case, we can also add an HaltTrajectory planner adapter that ensures a smooth transition from the last waypoint to full stop.

By adding the following line waypoints can be visualized.
RCLCPP_ERROR_STREAM(LOGGER, "" << *(resp_cont.at(i).trajectory_));

Looking at acceleration values (for a simple motion that involves only one joint) it is possible to notice that the produced path has a trapezoidal velocity profile, thus acceleration are piece wise linear in time.
In particular, given a trajectory with n waypoints:

  1. the acceleration of the first point is 0
  2. from point 1 to point m has constant values
  3. from point m to point n-m has value 0
  4. from point n-m to point n (included, here is the problem) has the same constant value as in point 2 but with opposite sign.

So actually the acceleration values of the last waypoint are not approximately 0 (they have the same value as all waypoints from n-m to n)

@ct2034

ct2034 commented Jan 19, 2023 •

Copy link
Copy Markdown
Contributor

If the velocity profile is trapezoidal, then I think it would be a better approach to append a point with zero acceleration. This would make it symmetric with the first point, as you described.

What do you think?

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

I am not happy with the check for ompl. Either this applies to multiple planners and should be checked somehow depending on the trajectory, not the planner to apply to all or it depends purely on ompl, then it should be fixed there.

@MarcoMagriDev

Copy link
Copy Markdown
Contributor Author

If the velocity profile is trapezoidal, then I think it would be a better approach to append a point with zero acceleration. This would make it symmetric with the first point, as you described.

What do you think?

Instead of appending a point I think that it is better to just modify the last one.

I am not happy with the check for ompl. Either this applies to multiple planners and should be checked somehow depending on the trajectory, not the planner to apply to all or it depends purely on ompl, then it should be fixed there.

Totally agree with you. I am not happy with this check too.
I really like your idea to perform the check on the trajectory instead of the planner used.
Two possibile check substitutions comes to my mind:

  • check if the last point has zero velocity and a non zero acceleration (by doing so in practice the stationarity condition of the last point is only checked on velocities)
  • performs checks on the whole trajectory accelerations to assess if it is trapezoidal

What do you think?

@tylerjw

tylerjw commented Aug 23, 2023

Copy link
Copy Markdown
Member

I'm not sure what should be done with this PR. It seems there has been no work on it in the last 6mo, so I'm going to close it. Feel free to re-open and ping us for reviews.

@tylerjw tylerjw closed this Aug 23, 2023
nbbrooks added a commit that referenced this pull request Sep 22, 2026
rolling-ci broke on main between Sep 16 (093360f, green) and Sep 22
(b89c048, red) with a build failure, not a test failure:

  rviz_plugin_render_tools/src/trajectory_visualization.cpp:166:5:
    error: 'RVIZ_COMMON_LOG_WARNING' was not declared in this scope
  1 package failed: moveit_ros_visualization

No MoveIt commit in that window touches visualization. The trigger was the
weekly moveit/moveit2:rolling-ci image rebuild on Sep 19 (run 35463509686),
which moved rviz from 16.0.2-1resolute.20260821 to 16.0.3-1resolute.20260916.
That same scheduled run's source (rolling) image build already hit this error.

The upstream change is ros2/rviz#1798 ("Moved implementation to cpp", merged
2026-07-16), which removed #include "rviz_common/logging.hpp" from
rviz_common/interaction/forwards.hpp. That was the one include path by which
trajectory_visualization.cpp reached the RVIZ_COMMON_LOG_* macros:

  trajectory_visualization.cpp
    -> rviz_default_plugins/robot/robot_link.hpp
      -> rviz_common/interaction/forwards.hpp
        -> rviz_common/logging.hpp          (edge removed by #1798)

Walking the include graph of both release tarballs finds exactly one path at
16.0.2 and none at 16.0.3.

trajectory_visualization.cpp is just the first file the build reaches.
robot_state_display.cpp and interactive_marker_display.cpp have no path to
logging.hpp under 16.0.3 either and would fail as soon as the build gets past
moveit_rviz_plugin_render_tools; planning_scene_display.cpp still reaches it
via transformation_manager.hpp -> pluginlib_factory.hpp. Include the header
explicitly in all four rather than leaving three of them on an accident.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
nbbrooks added a commit that referenced this pull request Sep 22, 2026
* Include rviz_common/logging.hpp where RVIZ_COMMON_LOG_* is used

rolling-ci broke on main between Sep 16 (093360f, green) and Sep 22
(b89c048, red) with a build failure, not a test failure:

  rviz_plugin_render_tools/src/trajectory_visualization.cpp:166:5:
    error: 'RVIZ_COMMON_LOG_WARNING' was not declared in this scope
  1 package failed: moveit_ros_visualization

No MoveIt commit in that window touches visualization. The trigger was the
weekly moveit/moveit2:rolling-ci image rebuild on Sep 19 (run 35463509686),
which moved rviz from 16.0.2-1resolute.20260821 to 16.0.3-1resolute.20260916.
That same scheduled run's source (rolling) image build already hit this error.

The upstream change is ros2/rviz#1798 ("Moved implementation to cpp", merged
2026-07-16), which removed #include "rviz_common/logging.hpp" from
rviz_common/interaction/forwards.hpp. That was the one include path by which
trajectory_visualization.cpp reached the RVIZ_COMMON_LOG_* macros:

  trajectory_visualization.cpp
    -> rviz_default_plugins/robot/robot_link.hpp
      -> rviz_common/interaction/forwards.hpp
        -> rviz_common/logging.hpp          (edge removed by #1798)

Walking the include graph of both release tarballs finds exactly one path at
16.0.2 and none at 16.0.3.

trajectory_visualization.cpp is just the first file the build reaches.
robot_state_display.cpp and interactive_marker_display.cpp have no path to
logging.hpp under 16.0.3 either and would fail as soon as the build gets past
moveit_rviz_plugin_render_tools; planning_scene_display.cpp still reaches it
via transformation_manager.hpp -> pluginlib_factory.hpp. Include the header
explicitly in all four rather than leaving three of them on an accident.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

* Include rviz_common/frame_manager_iface.hpp where getFrameManager() is used

Second casualty of the same rviz 16.0.3 include cleanup. With the logging.hpp
fix in place the build gets further and then fails on:

  planning_scene_display.cpp:741:30: error: invalid use of incomplete type
    'class rviz_common::FrameManagerIface'

ros2/rviz#1829 ("Cleanup headers") dropped #include "frame_manager_iface.hpp"
from display_context.hpp, so `context_->getFrameManager()->...` now sees only
the forward declaration that display_context.hpp still carries.

robot_state_display.cpp already includes the header directly and is fine.
interactive_marker_display.cpp has the same call and additionally upcasts the
shared_ptr from getTransformer(), so it needs the complete FrameTransformer
type too.

Diffing the reachable-header sets of every file under moveit_ros/visualization
between the 16.0.2 and 16.0.3 trees, five rviz headers stop being reachable:
logging.hpp, logging_handler.hpp, frame_manager_iface.hpp, frame_transformer.hpp
and ros_integration/ros_node_abstraction.hpp. Of those, only logging.hpp (the
previous commit), frame_manager_iface.hpp and frame_transformer.hpp are used by
symbol anywhere in the tree, and all are now included directly.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

---------

Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
RazvanApostuWF pushed a commit to wefabricate/moveit2 that referenced this pull request Sep 24, 2026
…it#3861)

* Include rviz_common/logging.hpp where RVIZ_COMMON_LOG_* is used

rolling-ci broke on main between Sep 16 (093360f, green) and Sep 22
(b89c048, red) with a build failure, not a test failure:

  rviz_plugin_render_tools/src/trajectory_visualization.cpp:166:5:
    error: 'RVIZ_COMMON_LOG_WARNING' was not declared in this scope
  1 package failed: moveit_ros_visualization

No MoveIt commit in that window touches visualization. The trigger was the
weekly moveit/moveit2:rolling-ci image rebuild on Sep 19 (run 35463509686),
which moved rviz from 16.0.2-1resolute.20260821 to 16.0.3-1resolute.20260916.
That same scheduled run's source (rolling) image build already hit this error.

The upstream change is ros2/rviz#1798 ("Moved implementation to cpp", merged
2026-07-16), which removed #include "rviz_common/logging.hpp" from
rviz_common/interaction/forwards.hpp. That was the one include path by which
trajectory_visualization.cpp reached the RVIZ_COMMON_LOG_* macros:

  trajectory_visualization.cpp
    -> rviz_default_plugins/robot/robot_link.hpp
      -> rviz_common/interaction/forwards.hpp
        -> rviz_common/logging.hpp          (edge removed by moveit#1798)

Walking the include graph of both release tarballs finds exactly one path at
16.0.2 and none at 16.0.3.

trajectory_visualization.cpp is just the first file the build reaches.
robot_state_display.cpp and interactive_marker_display.cpp have no path to
logging.hpp under 16.0.3 either and would fail as soon as the build gets past
moveit_rviz_plugin_render_tools; planning_scene_display.cpp still reaches it
via transformation_manager.hpp -> pluginlib_factory.hpp. Include the header
explicitly in all four rather than leaving three of them on an accident.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

* Include rviz_common/frame_manager_iface.hpp where getFrameManager() is used

Second casualty of the same rviz 16.0.3 include cleanup. With the logging.hpp
fix in place the build gets further and then fails on:

  planning_scene_display.cpp:741:30: error: invalid use of incomplete type
    'class rviz_common::FrameManagerIface'

ros2/rviz#1829 ("Cleanup headers") dropped #include "frame_manager_iface.hpp"
from display_context.hpp, so `context_->getFrameManager()->...` now sees only
the forward declaration that display_context.hpp still carries.

robot_state_display.cpp already includes the header directly and is fine.
interactive_marker_display.cpp has the same call and additionally upcasts the
shared_ptr from getTransformer(), so it needs the complete FrameTransformer
type too.

Diffing the reachable-header sets of every file under moveit_ros/visualization
between the 16.0.2 and 16.0.3 trees, five rviz headers stop being reachable:
logging.hpp, logging_handler.hpp, frame_manager_iface.hpp, frame_transformer.hpp
and ros_integration/ros_node_abstraction.hpp. Of those, only logging.hpp (the
previous commit), frame_manager_iface.hpp and frame_transformer.hpp are used by
symbol anywhere in the tree, and all are now included directly.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

---------

Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
(cherry picked from commit 82b575f)
RazvanApostuWF added a commit to wefabricate/moveit2 that referenced this pull request Sep 24, 2026
* utils: Added check for constrain region position and modified warnings

* Removed COLCON_IGNORE file from trajectory_cache package

* CI: CI now removes the colcon_ignore files on build to prevent compatibility issues

* CI: Keep moveit_setup_simulation ignored and stage COLCON_IGNORE removal

- moveit_setup_simulation is COLCON_IGNOREd upstream (unfinished port), so it stays ignored in CI
- git rm stages the deletions, keeping them out of the clang-tidy patch (git diff)

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>

* Include rviz_common/logging.hpp where RVIZ_COMMON_LOG_* is used (moveit#3861)

* Include rviz_common/logging.hpp where RVIZ_COMMON_LOG_* is used

rolling-ci broke on main between Sep 16 (093360f, green) and Sep 22
(b89c048, red) with a build failure, not a test failure:

  rviz_plugin_render_tools/src/trajectory_visualization.cpp:166:5:
    error: 'RVIZ_COMMON_LOG_WARNING' was not declared in this scope
  1 package failed: moveit_ros_visualization

No MoveIt commit in that window touches visualization. The trigger was the
weekly moveit/moveit2:rolling-ci image rebuild on Sep 19 (run 35463509686),
which moved rviz from 16.0.2-1resolute.20260821 to 16.0.3-1resolute.20260916.
That same scheduled run's source (rolling) image build already hit this error.

The upstream change is ros2/rviz#1798 ("Moved implementation to cpp", merged
2026-07-16), which removed #include "rviz_common/logging.hpp" from
rviz_common/interaction/forwards.hpp. That was the one include path by which
trajectory_visualization.cpp reached the RVIZ_COMMON_LOG_* macros:

  trajectory_visualization.cpp
    -> rviz_default_plugins/robot/robot_link.hpp
      -> rviz_common/interaction/forwards.hpp
        -> rviz_common/logging.hpp          (edge removed by moveit#1798)

Walking the include graph of both release tarballs finds exactly one path at
16.0.2 and none at 16.0.3.

trajectory_visualization.cpp is just the first file the build reaches.
robot_state_display.cpp and interactive_marker_display.cpp have no path to
logging.hpp under 16.0.3 either and would fail as soon as the build gets past
moveit_rviz_plugin_render_tools; planning_scene_display.cpp still reaches it
via transformation_manager.hpp -> pluginlib_factory.hpp. Include the header
explicitly in all four rather than leaving three of them on an accident.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

* Include rviz_common/frame_manager_iface.hpp where getFrameManager() is used

Second casualty of the same rviz 16.0.3 include cleanup. With the logging.hpp
fix in place the build gets further and then fails on:

  planning_scene_display.cpp:741:30: error: invalid use of incomplete type
    'class rviz_common::FrameManagerIface'

ros2/rviz#1829 ("Cleanup headers") dropped #include "frame_manager_iface.hpp"
from display_context.hpp, so `context_->getFrameManager()->...` now sees only
the forward declaration that display_context.hpp still carries.

robot_state_display.cpp already includes the header directly and is fine.
interactive_marker_display.cpp has the same call and additionally upcasts the
shared_ptr from getTransformer(), so it needs the complete FrameTransformer
type too.

Diffing the reachable-header sets of every file under moveit_ros/visualization
between the 16.0.2 and 16.0.3 trees, five rviz headers stop being reachable:
logging.hpp, logging_handler.hpp, frame_manager_iface.hpp, frame_transformer.hpp
and ros_integration/ros_node_abstraction.hpp. Of those, only logging.hpp (the
previous commit), frame_manager_iface.hpp and frame_transformer.hpp are used by
symbol anywhere in the tree, and all are now included directly.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

---------

Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
(cherry picked from commit 82b575f)

* De-flake trajectory_cache _with_move_group tests, take 2 (moveit#3859)

* De-flake trajectory_cache _with_move_group tests, take 2

test_motion_plan_request_features_with_move_group has been the recurring
failure in the jazzy-ci + ikfast job (runs 34683703000, 34819993343,
35124906659), while every other matrix entry passes on the same commits.

The test asserts that StartStateJointStateFeatures writes insert metadata.
For an is_diff start state that path calls MoveGroupInterface::getCurrentState(),
which only waits one second for a complete robot state; when it times out the
feature returns UNABLE_TO_AQUIRE_SENSOR_DATA, no metadata is written, and the
follow-on queryList assertions fail with "no such column:
M_StartStateJointStateFeatures.start_state.joint_state.name_0".

The gating added in moveit#3777 is working: joint_state_broadcaster is activated and
publishing before the test binary launches. What remains is subscriber-side
discovery of /joint_states taking longer than a second on a loaded runner. The
fixture's own spin loop made that worse by busy-waiting at 100% CPU while
several of these tests run concurrently under ctest.

So prime the current state monitor once in SetUp() with a 10s timeout, so the
short waits inside the cache always find a populated monitor, and block in
spin_once() instead of hot-looping on spin_some(). Raise the add_ros_test
timeouts to 120s so a genuine /joint_states failure reports the assertion
message rather than being killed by the harness.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

* Use UPPER_CASE for the new fixture constants

clang-tidy's readability-identifier-naming requires GlobalConstantCase to be
UPPER_CASE, which is also what the rest of the trajectory_cache package uses.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

---------

Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
(cherry picked from commit b222baf)

---------

Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
Co-authored-by: Nathan Brooks <[email protected]>
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.

6 participants