Skip to content

Constrained freedrive implementation#507

Open
srvald wants to merge 4 commits into
UniversalRobots:masterfrom
srvald:constrained_freedrive
Open

Constrained freedrive implementation#507
srvald wants to merge 4 commits into
UniversalRobots:masterfrom
srvald:constrained_freedrive

Conversation

@srvald
Copy link
Copy Markdown
Contributor

@srvald srvald commented May 15, 2026

Description

This Pull Request introduces support for Constrained Freedrive mode in the ur_client_library. This feature allows users to lock specific axes during freedrive and define a custom reference feature pose.

Changes:

  • UrDriver: Added writeConstrainedFreedriveControlMessage to expose the constrained freedrive interface to the user.
  • ReverseInterface: Updated the communication protocol to include the new arguments (free axes and feature pose) in the command buffer sent to the robot.
  • URScript: Updated external_control.urscript to parse the new buffer data and apply it to the freedrive_mode() URScript command.
  • Examples: Updated freedrive_example.cpp to demonstrate both normal and constrained modes.
  • Tests: Added unit tests in test_ur_driver.cpp and test_reverse_interface.cpp.

Protocol Details:

  • Data Package Expansion: The communication buffer has been increased from 8 to 15 integers to accommodate the free_axes (6x int32) and feature_pose (6x int32 scaled by MULT_jointstate) arrays.

Testing Performed:

  • Hardware Validation: Tested on a real robot running PolyScope X 10.12.1. The constrained freedrive was successfully activated, correctly respecting the locked axes and the reference frame.
image
  • Unit Testing: All modified tests were executed using ctest.

    • ReverseInterfaceTest.write_constrained_freedrive_message: PASSED
    image
    • UrDriverTest.robot_receive_timeout_off_headless: PASSED
    image
    • UrDriverTest.robot_receive_timeout_headless: PASSED
    image

Note

Medium Risk
Medium risk because it changes the reverse-interface wire protocol and the paired external_control.urscript parsing, so mismatched script/library versions or buffer sizing errors could break robot control flows.

Overview
Adds constrained freedrive by extending freedrive reverse-interface messages to include free_axes and feature_pose (buffer expanded from 8 to 15 int32s) and updating external_control.urscript to call freedrive_mode(free_axes, feature_pose).

Exposes the new capability via UrDriver::writeConstrainedFreedriveControlMessage, updates the freedrive example to toggle between normal and constrained modes via CLI args, and extends unit tests to cover the new message shape and timeout behavior.

Reviewed by Cursor Bugbot for commit 114c359. Bugbot is set up for automated code reviews on this repo. Configure here.

@codecov
Copy link
Copy Markdown

codecov Bot commented May 15, 2026

Codecov Report

❌ Patch coverage is 0% with 12 lines in your changes missing coverage. Please review.
✅ Project coverage is 16.51%. Comparing base (8f35234) to head (114c359).
⚠️ Report is 6 commits behind head on master.

Files with missing lines Patch % Lines
src/control/reverse_interface.cpp 0.00% 7 Missing ⚠️
src/ur/ur_driver.cpp 0.00% 3 Missing ⚠️
...lude/ur_client_library/control/reverse_interface.h 0.00% 1 Missing ⚠️
include/ur_client_library/ur/ur_driver.h 0.00% 1 Missing ⚠️

❗ There is a different number of reports uploaded between BASE (8f35234) and HEAD (114c359). Click for more details.

HEAD has 40 uploads less than BASE
Flag BASE (8f35234) HEAD (114c359)
python_scripts 2 1
start_ursim 6 1
ur5e-10.11.0 7 0
ur5e-10.12.0 7 0
ur5e-10.7.0 7 0
ur5e-5.9.4 7 0
ur20-latest 6 0
Additional details and impacted files
@@             Coverage Diff             @@
##           master     #507       +/-   ##
===========================================
- Coverage   76.96%   16.51%   -60.45%     
===========================================
  Files         116      116               
  Lines        6342     6376       +34     
  Branches     2761     2775       +14     
===========================================
- Hits         4881     1053     -3828     
- Misses       1112     5245     +4133     
+ Partials      349       78      -271     
Flag Coverage Δ
check_version_ur10-3.15.8 11.69% <0.00%> (?)
check_version_ur10e-10.11.0 11.69% <0.00%> (?)
check_version_ur10e-5.15.2 11.69% <0.00%> (?)
check_version_ur12e-10.12.1 11.74% <0.00%> (?)
check_version_ur12e-5.25.1 11.89% <0.00%> (?)
check_version_ur15-10.12.1 11.69% <0.00%> (?)
check_version_ur15-5.25.1 11.69% <0.00%> (?)
check_version_ur16e-10.12.1 11.69% <0.00%> (?)
check_version_ur16e-5.25.1 11.69% <0.00%> (?)
check_version_ur18-10.12.1 11.74% <0.00%> (?)
check_version_ur18-5.25.1 11.89% <0.00%> (?)
check_version_ur20-10.12.1 11.69% <0.00%> (?)
check_version_ur20-5.25.1 11.69% <0.00%> (?)
check_version_ur3-3.14.3 11.89% <0.00%> (?)
check_version_ur30-10.12.1 11.74% <0.00%> (?)
check_version_ur30-5.25.1 11.69% <0.00%> (?)
check_version_ur3e-10.11.0 11.69% <0.00%> (?)
check_version_ur3e-5.9.4 12.50% <0.00%> (?)
check_version_ur5-3.15.8 11.69% <0.00%> (?)
check_version_ur5e-10.11.0 11.69% <0.00%> (?)
check_version_ur5e-5.12.8 11.69% <0.00%> (?)
check_version_ur7e-10.11.0 11.74% <0.00%> (?)
check_version_ur7e-5.22.2 11.69% <0.00%> (?)
check_version_ur8long-10.12.1 11.69% <0.00%> (?)
check_version_ur8long-5.25.1 11.69% <0.00%> (?)
python_scripts 75.90% <ø> (ø)
start_ursim 83.88% <ø> (-1.16%) ⬇️
ur20-latest ?
ur5e-10.11.0 ?
ur5e-10.12.0 ?
ur5e-10.7.0 ?
ur5e-5.9.4 ?

Flags with carried forward coverage won't be shown. Click here to find out more.

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

Comment thread include/ur_client_library/control/reverse_interface.h
Comment thread src/control/reverse_interface.cpp Outdated
@srvald srvald force-pushed the constrained_freedrive branch from 9b8a52d to 0d31e32 Compare May 20, 2026 09:41
Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes using default mode and found 1 potential issue.

Fix All in Cursor

Reviewed by Cursor Bugbot for commit f664193. Configure here.

Comment thread tests/test_reverse_interface.cpp
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