You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Add unit tests for the moveit_py RobotTrajectory bindings - #3999
moveit.core.robot_trajectory.RobotTrajectory has no Python tests. This PR adds moveit_py/test/unit/test_robot_trajectory.py (12 tests) and registers it in moveit_py/CMakeLists.txt. It uses the existing Panda fixtures, so it adds no dependencies.
Covered:
Construction of an empty trajectory, and the robot_model and joint_model_group_name properties
set_robot_trajectory_msg: one waypoint per point, with matching positions (via __len__ and __getitem__)
get_waypoint_durations, duration and average_segment_duration, including that a zero first segment is left out of the average
__iter__ yields (RobotState, duration_from_previous) pairs in order
get_robot_trajectory_msg round trip (joint names, positions, time_from_start) and joint_filter
__reverse__ and unwind (a no-op for the Panda arm, which has no continuous joints)
apply_totg_time_parameterization returns False and leaves the trajectory untimed when the model has no acceleration limits (the Panda fixture URDF has none)
apply_ruckig_smoothing succeeds using Ruckig's default limits, and keeps the start and end configurations
There are no changes to library code or API, so MIGRATION.md is not affected.
Notes for reviewers:
A successful TOTG retime can't be unit-tested with this fixture. Acceleration limits come from joint_limits.yaml, which RobotModel(urdf_xml_path, srdf_xml_path) doesn't load, and the bindings can't set limits. I'm happy to add an integration test that loads moveit_resources_panda_moveit_config if you want that covered.
The bindings define __reverse__ (which reverses in place) rather than Python's __reversed__, so reversed(trajectory) uses the sequence protocol and does not call it. The test calls __reverse__() directly and documents the current behaviour. I can open a separate issue if that's worth changing.
Tested: built moveit_py from main and ran colcon test --packages-select moveit_py: 39 tests, 0 failures (12 new). black 25.1.0, codespell 2.4.1 and cmake-format 0.6.13 are clean.
Checklist
Required by CI: Code is auto formatted using clang-format
Document API changes relevant to the user in the MIGRATION.md notes
Create tests, which fail without this PR reference
Include a screenshot if changing a GUI
While waiting for someone to review your request, please help review another open pull request to support the maintainers
Summary by CodeRabbit
Tests
Added automated coverage for robot trajectory initialization, properties, message import and export, waypoint timing, iteration, joint filtering, reversal, and unwinding.
Added checks for time parameterization behavior when acceleration limits are missing, and for trajectory smoothing that preserves the start and end configurations.
No actionable comments were generated in the recent review.
Walkthrough
This change adds a RobotTrajectory unit test suite using a Panda robot fixture and registers the test file in the pytest list. The tests cover trajectory properties, message conversion, waypoint operations, and TOTG and Ruckig time parameterization.
Changes: RobotTrajectory tests
Layer / File(s)
Summary
Trajectory setup and operations moveit_py/test/unit/test_robot_trajectory.py, moveit_py/CMakeLists.txt
Adds Panda-based test helpers and tests for trajectory properties, message conversion, waypoint operations, and test registration.
Time parameterization tests moveit_py/test/unit/test_robot_trajectory.py
Tests that TOTG fails without acceleration limits and leaves the trajectory untimed. Tests that Ruckig smoothing succeeds, assigns positive durations, and preserves the endpoint configurations.
This change adds test coverage for the RobotTrajectory bindings and registers it in the build. It does not change runtime behavior, so merge risk is minimal.
Pre-merge checks: 4
Check name
Status
Explanation
Title check
The title "Add unit tests for the moveit_py RobotTrajectory bindings" matches the main change. The PR adds a unit test file for the RobotTrajectory bindings and registers it in moveit_py/CMakeLists.tx…
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Description Check
Check skipped - CodeRabbit’s high-level summary is enabled.
Full details: Title check
Explanation
The title "Add unit tests for the moveit_py RobotTrajectory bindings" matches the main change. The PR adds a unit test file for the RobotTrajectory bindings and registers it in moveit_py/CMakeLists.txt. The title is short, specific, and contains no file lists or vague terms.
Finishing Touches
Generate unit tests (beta)
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Reviewing files that changed from the base of the PR and between 5399d29 and ce88846.
Files selected for processing: 2
moveit_py/CMakeLists.txt
moveit_py/test/unit/test_robot_trajectory.py
Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.
Tick the box to add this pull request to the merge queue (same as @mergifyio queue). If it does not match the queue conditions yet, it enters the queue once it does.
Queue this pull request once it meets the queue conditions
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
moveit.core.robot_trajectory.RobotTrajectoryhas no Python tests. This PR addsmoveit_py/test/unit/test_robot_trajectory.py(12 tests) and registers it inmoveit_py/CMakeLists.txt. It uses the existing Panda fixtures, so it adds no dependencies.Covered:
robot_modelandjoint_model_group_namepropertiesset_robot_trajectory_msg: one waypoint per point, with matching positions (via__len__and__getitem__)get_waypoint_durations,durationandaverage_segment_duration, including that a zero first segment is left out of the average__iter__yields(RobotState, duration_from_previous)pairs in orderget_robot_trajectory_msground trip (joint names, positions,time_from_start) andjoint_filter__reverse__andunwind(a no-op for the Panda arm, which has no continuous joints)apply_totg_time_parameterizationreturnsFalseand leaves the trajectory untimed when the model has no acceleration limits (the Panda fixture URDF has none)apply_ruckig_smoothingsucceeds using Ruckig's default limits, and keeps the start and end configurationsThere are no changes to library code or API, so
MIGRATION.mdis not affected.Notes for reviewers:
joint_limits.yaml, whichRobotModel(urdf_xml_path, srdf_xml_path)doesn't load, and the bindings can't set limits. I'm happy to add an integration test that loadsmoveit_resources_panda_moveit_configif you want that covered.__reverse__(which reverses in place) rather than Python's__reversed__, soreversed(trajectory)uses the sequence protocol and does not call it. The test calls__reverse__()directly and documents the current behaviour. I can open a separate issue if that's worth changing.Tested: built
moveit_pyfrommainand rancolcon test --packages-select moveit_py: 39 tests, 0 failures (12 new). black 25.1.0, codespell 2.4.1 and cmake-format 0.6.13 are clean.Checklist
Summary by CodeRabbit