Skip to content

Add support for the g-Series 48V T2 tool connector - #592

Draft
urrsk wants to merge 4 commits into
UniversalRobots:masterfrom
urrsk:48v
Draft

urrsk wants to merge 4 commits into
UniversalRobots:masterfrom
urrsk:48v

Conversation

@urrsk

@urrsk urrsk commented Oct 9, 2026

Copy link
Copy Markdown
Member

No description provided.

urrsk added 2 commits October 8, 2026 13:14
Connector T2 is only available on robots that report Tool Flange V2 through the
RTDE robot properties, which requires PolyScope X 10.15.0 or later. PolyScope 5
does not support it.

- Add ToolVoltage::_48V and SET_TOOL_T2_VOLTAGE (13) to the script command
  interface and external_control.urscript, using set_power_output("T2_V", ...).
- UrDriver::setToolVoltageT2() checks the flange type from the RTDE writer before
  using the script command interface or the plain script fallback.
- ScriptCommandInterface::setToolVoltage() and setToolVoltageT2() reject
  voltages that are not valid for the connector.
- Add the tool_output_voltage_2 / tool_output_current_2 fields to the fake RTDE
  server and cover the writer flange reset on reconnect.
On a robot that reports Tool Flange V2, set connector T2 to 24 V, 48 V and 0 V
through the script command interface, and to 24 V and 0 V through the plain
script fallback. Each step is checked against RTDE tool_output_voltage_2, read
by a separate RTDE client because older controllers reject that field.

tool_output_voltage_2 is a measured value: on a 10.16.0 robot it read 23 V for
24 V and took about a second to decay after switching off. The check therefore
accepts 5 V around the setpoint and waits up to 5 s.

Robots that do not report Tool Flange V2 must refuse the command.

Verified on a 10.16.0 robot with Tool Flange V2. The 10.15.0 URSim tested so far
reports 0 V on tool_output_voltage_2 for every setpoint, so the V2 tests fail
there.
@urrsk
urrsk requested a balanced review from Copilot October 9, 2026 13:15
@codecov

codecov Bot commented Oct 9, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 96.42857% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 83.79%. Comparing base (525e107) to head (63dbf64).
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
src/ur/ur_driver.cpp 93.75% 0 Missing and 2 partials ⚠️
src/control/script_command_interface.cpp 96.87% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #592      +/-   ##
==========================================
+ Coverage   83.26%   83.79%   +0.52%     
==========================================
  Files         126      126              
  Lines        8153     8238      +85     
  Branches     3745     3779      +34     
==========================================
+ Hits         6789     6903     +114     
+ Misses        957      925      -32     
- Partials      407      410       +3     
Flag Coverage Δ
python_scripts 75.90% <ø> (ø)
start_ursim 91.64% <ø> (-1.42%) ⬇️
unit 61.17% <96.42%> (+2.38%) ⬆️
ur5-3.14.3 80.59% <96.42%> (+0.68%) ⬆️
ur5e-10.11.0 75.90% <96.42%> (+0.68%) ⬆️
ur5e-10.12.0 77.02% <96.42%> (+0.77%) ⬆️
ur5e-10.7.0 75.39% <96.42%> (+0.74%) ⬆️
ur5e-5.9.4 80.77% <96.42%> (+0.60%) ⬆️
ur7e-10.13.0 77.49% <96.42%> (+0.64%) ⬆️

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

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

Copilot AI 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.

🟡 Changes recommended

The shared 48 V enum can reach T0 during startup, and the plain-script fallback omits the required software-version check.

2 open findings
What changed in this PR

Adds 48 V T2 tool-connector support across the driver, script interface, RTDE integration, documentation, and tests.

Changes:

  • Adds T2 voltage APIs, validation, and script command handling.
  • Adds Tool Flange V2 and T2 telemetry checks.
  • Extends integration/unit tests and examples.
File Description
include/​ur_client_library/​ur/​tool_communication.h Adds the 48 V enum value.
include/​ur_client_library/​ur/​ur_driver.h Declares and documents T2 voltage control.
include/​ur_client_library/​control/​script_command_interface.h Extends the script command API and protocol.
src/​ur/​ur_driver.cpp Implements validated T2 voltage control and fallback.
src/​control/​script_command_interface.cpp Serializes T2 commands and checks software versions.
resources/​external_control.urscript Handles the new T2 command in URScript.
examples/​script_command_interface.cpp Demonstrates T2 voltage switching.
doc/​architecture/​script_command_interface.rst Documents the command and protocol payload.
tests/​test_ur_driver.cpp Adds hardware-level voltage and validation tests.
tests/​test_script_reader.cpp Tests version-dependent script rendering.
tests/​test_script_command_interface.cpp Tests command encoding and validation.
tests/​test_rtde_client_reconnect.cpp Tests flange-state reset during reconnection.
tests/​test_rtde_client_fake_server.cpp Tests T2 RTDE output fields.
tests/​fake_rtde_server.cpp Adds fake-server T2 field types.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread include/ur_client_library/ur/tool_communication.h
Comment thread src/ur/ur_driver.cpp
urrsk added 2 commits October 9, 2026 13:38
ToolCommSetup::setToolVoltage now rejects voltages connector T0 does not
support, so the UrDriver startup script can no longer render
set_tool_voltage(48). ToolCommSetup also gets an optional T2 voltage
(0, 24 or 48 V) which UrDriver applies at startup with
set_power_output("T2_V", ...) when the robot reports Tool Flange V2, and
throws otherwise.
Run UrDriver against the fake primary and RTDE servers to cover the tool
voltage paths no CI URSim reaches: the T2 voltage in the startup program,
the startup check for Tool Flange V2, and setToolVoltage /
setToolVoltageT2 through the script command interface and the script
fallback. The fake RTDE server can now report the tool flange type and
the URControl version. The tests skip if the default robot ports are in
use.
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