Skip to content

Add unit tests for the moveit_py RobotTrajectory bindings - #3999

Open
vishwagw wants to merge 2 commits into
moveit:mainfrom
vishwagw:test-robot-trajectory
Open

vishwagw wants to merge 2 commits into
moveit:mainfrom
vishwagw:test-robot-trajectory

Conversation

@vishwagw

@vishwagw vishwagw commented Nov 26, 2026 •

Copy link
Copy Markdown

Description

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
  • Extend the tutorials / documentation reference
  • 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.

@coderabbitai

coderabbitai Bot commented Nov 26, 2026 •

Copy link
Copy Markdown

Explain Change →

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.

Estimated code review effort: 2 (Simple) | ~12 minutes

Change: Other

Suggested reviewers: illyakaynov-vbti, matthijsburgh

Merge Risk: Minimal · up to ce888

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: Passed 4

Check name Status Explanation
Title check Passed 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 Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Description Check Passed 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.

Share

Recent review info

Run configuration

Commits

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.

@mergify

mergify Bot commented Nov 26, 2026

Copy link
Copy Markdown

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

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.

1 participant