Skip to content

Commit cd17839

Browse files
committed
Merge branch 'master' into test_10.13
2 parents 5cbb8a3 + e01f5f3 commit cd17839

32 files changed

Lines changed: 893 additions & 168 deletions

CHANGELOG.rst

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,19 @@
22
Changelog for package ur_client_library
33
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
44

5+
2.13.0 (2026-06-17)
6+
-------------------
7+
* [ScriptCommandInterface] Add set_target_payload support to ScriptCommandInterface (`#515 <https://github.com/UniversalRobots/Universal_Robots_Client_Library/issues/515>`_)
8+
* [Primary] sendScriptBlocking: Restart interface and resend script on readOnlyInterfaceException (`#522 <https://github.com/UniversalRobots/Universal_Robots_Client_Library/issues/522>`_)
9+
* [DashboardClientX] Apply httplib timeouts; wire setReceiveTimeout() (`#518 <https://github.com/UniversalRobots/Universal_Robots_Client_Library/issues/518>`_)
10+
* [Docs] Remove section about URCapX in development (`#521 <https://github.com/UniversalRobots/Universal_Robots_Client_Library/issues/521>`_)
11+
* [Primary] Send script blocking return refactor (`#520 <https://github.com/UniversalRobots/Universal_Robots_Client_Library/issues/520>`_)
12+
* Add missing robot types to helper functions (`#513 <https://github.com/UniversalRobots/Universal_Robots_Client_Library/issues/513>`_)
13+
* [RTDE] Add new controller_step RTDE field (`#514 <https://github.com/UniversalRobots/Universal_Robots_Client_Library/issues/514>`_)
14+
* [Primary] Primary client script execution feedback (`#484 <https://github.com/UniversalRobots/Universal_Robots_Client_Library/issues/484>`_)
15+
* Add robotSeriesString function (`#510 <https://github.com/UniversalRobots/Universal_Robots_Client_Library/issues/510>`_)
16+
* Contributors: Felix Exner, Sergi Romero, URJala, Vinicius de Oliveira, dependabot[bot]
17+
518
2.12.0 (2026-05-19)
619
-------------------
720
* [CI] Make circular motion in example more compatible (`#508 <https://github.com/UniversalRobots/Universal_Robots_Client_Library/issues/508>`_)

doc/architecture/primary_client.rst

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,17 +26,21 @@ Method signature:
2626
.. code-block:: c++
2727

2828
bool sendScriptBlocking(
29-
std::string program,
30-
std::string script_name = "",
31-
std::chrono::milliseconds timeout = std::chrono::seconds(1),
32-
bool fail_on_warnings = true
29+
const std::string& program,
30+
const std::string& script_name = "",
31+
const std::chrono::milliseconds start_timeout = std::chrono::seconds(1),
32+
const bool fail_on_warnings = true,
33+
const bool retry_on_readonly_interface = true
3334
);
3435

3536
| The ``sendScriptBlocking`` method will also accept valid URScript code, but blocks until the execution result of the given program is available.
36-
| Prior to transferring the program it will first check that the robot is in a state where it can execute programs, if not it returns false.
37+
| Prior to transferring the program it will first check that the robot is in a state where it can execute programs, otherwise an exception is thrown.
3738
| If the robot is ready, the program is then transferred, and the method will wait for the robot to report that the program has either started, finished or encountered an error.
38-
| If the program has not started within the given ``timeout``, the method returns false.
39-
| If the robot encounters an error or runtime exception during program execution the method also returns false.
40-
| If ``fail_on_warnings`` is true, it will also return false, if the robot reports a warning during program execution. Note: protective stops are reported as warnings by the robot.
41-
| The method only returns true if the program is successfully executed on the robot.
39+
| If the program has not started within the given ``start_timeout``, the method throws an exception.
40+
| If the robot encounters an error or runtime exception during program execution the method also throws an exception.
41+
| If ``fail_on_warnings`` is true, it will also throw an exception, if the robot reports a warning during program execution. Note: protective stops are reported as warnings by the robot.
42+
| If ``retry_on_readonly_interface`` is true, the method will restart the primary interface and retry sending the program, if the primary interface is read-only. It will retry once, and if the interface is still read-only, an exception will be thrown. If false, the exception will be thrown, without restarting/retrying.
43+
| If no exceptions are thrown, the script has been executed successfully.
4244
| This method also accepts secondary programs, but no feedback is available for those, so it will behave similarly to the ``sendScript`` method in those cases, except for the pre-transfer checks.
45+
| The exact exceptions that are thrown in various cases can be seen in the `primary client header file <https://github.com/UniversalRobots/Universal_Robots_Client_Library/blob/master/include/ur_client_library/primary/primary_client.h>`_.
46+
| Note: This method clears all stored error codes in the client during execution.

doc/architecture/script_command_interface.rst

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ At the time of writing the ``ScriptCommandInterface`` provides the following fun
2525
- ``setGravity()``: Set the gravity vector for the robot.
2626
- ``setTcpOffset()``: Set the TCP offset of the robot.
2727
- ``setFrictionScales()``: Set viscous and Coulomb friction scale factors for direct torque control.
28+
- ``setTargetPayload()``: Set the active payload mass, center of gravity, inertia matrix and transition time.
2829

2930
Communication protocol
3031
----------------------
@@ -58,6 +59,7 @@ The robot reads from the "script_command_socket" expecting a 32 bit integer repr
5859
- 9: setGravity
5960
- 10: setTcpOffset
6061
- 11: setFrictionScales
62+
- 12: setTargetPayload
6163
1-27 data fields specific to the command
6264
===== =====
6365

@@ -77,7 +79,7 @@ The robot reads from the "script_command_socket" expecting a 32 bit integer repr
7779
index meaning
7880
===== =====
7981
1 Payload mass in kg (floating point)
80-
2-4 Payload center of gravity in m, displacement from the toolmpount (floating point)
82+
2-4 Payload center of gravity in m, displacement from the tool mount (floating point)
8183
===== =====
8284

8385
.. table:: With setToolVoltage command
@@ -180,6 +182,18 @@ The robot reads from the "script_command_socket" expecting a 32 bit integer repr
180182
7-12 Coulomb friction scale factors. One number per joint, range [0-1]. 0 means no compensation for that joint. 1 means full compensation. Default is [0.8, 0.8, 0.7, 0.8, 0.8, 0.8]. (floating point)
181183
===== =====
182184

185+
.. table:: With setTargetPayload command
186+
:widths: auto
187+
188+
===== =====
189+
index meaning
190+
===== =====
191+
1 Payload mass in kg (floating point)
192+
2-4 Payload center of gravity in m, displacement from the tool mount (floating point)
193+
5-10 Payload inertia matrix [Ixx, Iyy, Izz, Ixy, Ixz, Iyz] in kg·m² (floating point)
194+
11 Payload transition time in seconds (floating point)
195+
===== =====
196+
183197
.. note::
184198
In URScript the ``socket_read_binary_integer()`` function is used to read the data from the
185199
script command socket. The first index in that function's return value is the number of integers read,
@@ -188,9 +202,9 @@ The robot reads from the "script_command_socket" expecting a 32 bit integer repr
188202
function. E.g. reading the boolean value for friction compensation in the
189203
``setFrictionCompensation`` command would be done by accessing index 2 of the result array.
190204

191-
All floating point data is encoded into an integer representation and has to be divided by the
192-
``MULT_JOINTSTATE`` constant to get the actual floating point value. This constant is defined in
193-
``ReverseInterface`` class.
205+
All floating point data is encoded into an integer representation and has to be divided by either the
206+
``MULT_JOINTSTATE`` or ``MULT_TIME`` constant to get the actual floating point value. These constants
207+
are defined in the ``ReverseInterface`` class.
194208

195209
Data sent from the robot
196210
^^^^^^^^^^^^^^^^^^^^^^^^
11.3 KB
Loading

doc/polyscope_compatibility.rst

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,6 @@ table below or checkout the latest tag before the breaking changes were introduc
4646
replacing the Dashboard Server in version 10.11.0. It covers robot state control and loading
4747
and playing programs.
4848
From version 10.12, it also supports uploading programs to the robot and downloading programs from the robot, as well as listing existing programs on the robot.
49-
- Using external control on |polyscope| X requires another URCapX for making external control
50-
work. This is currently in the process of being created.
51-
See `Universal Robots External Control URCapX <https://github.com/UniversalRobots/Universal_Robots_ExternalControl_URCapX>`_
5249

5350
.. |polyscope| replace:: PolyScope
5451

examples/script_command_interface.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,9 @@ void sendScriptCommands()
8080
run_cmd("Disabling tool contact mode", []() { g_my_robot->getUrDriver()->endToolContact(); });
8181
run_cmd("Setting TCP offset to [0.0, 0.0, 0.10, 0.0, 0.0, 0.0]",
8282
[]() { g_my_robot->getUrDriver()->setTcpOffset({ 0.0, 0.0, 0.10, 0.0, 0.0, 0.0 }); });
83+
run_cmd("Setting payload to 2.0kg with custom inertia and 0.5s transition time", []() {
84+
g_my_robot->getUrDriver()->setTargetPayload(2.0, { 0.0, 0.0, 0.1 }, { 0.003, 0.003, 0.003, 0.0, 0.0, 0.0 }, 0.5);
85+
});
8386

8487
if (g_support_set_friction_scales)
8588
{

examples/send_script.cpp

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,10 @@ def example_fun():
4545
relative_move = p[0,-0.1,0,0,0,0]
4646
movel(pose_trans(current_pose, relative_move), t=1)
4747
end)""";
48-
49-
if (client.sendScriptBlocking(fully_defined_script))
50-
{
51-
// The function definition can also be omitted
52-
// A function name will then be auto generated
53-
client.sendScriptBlocking(R"(textmsg("Successful program execution"))");
54-
}
48+
client.sendScriptBlocking(fully_defined_script);
49+
// The function definition can also be omitted
50+
// A function name will then be auto generated
51+
client.sendScriptBlocking(R"(textmsg("Successful program execution"))");
5552
// A script-function name can also be passed to the method
5653
// A timeout can also be given to limit the wait for the passed function to start. If timeout = 0, it will
5754
// wait indefinitely.
@@ -66,18 +63,26 @@ end
6663
)";
6764
client.sendScriptBlocking(secondary_script);
6865

69-
// Sending wrong script code will result in a clear error
66+
// Sending wrong script code will result in an exception with a clear explanation
7067
const std::string bad_script_code = R"""(
7168
def bad_code():
7269
current_pose = get_target_tcp_pose()
7370
movel(current_pos) # note pose vs pos
7471
end)""";
7572
URCL_LOG_INFO("Sending bad script code...");
76-
bool success = client.sendScriptBlocking(bad_script_code);
73+
try
7774
{
78-
std::stringstream ss;
79-
ss << "Execution of bad code successful? " << std::boolalpha << success;
80-
URCL_LOG_INFO("%s", ss.str().c_str());
75+
client.sendScriptBlocking(bad_script_code);
76+
}
77+
catch (const RobotRuntimeException& exc)
78+
{
79+
URCL_LOG_INFO("Caught expected runtime exception from sendScriptBlocking");
80+
URCL_LOG_INFO(exc.what());
81+
}
82+
catch (const UrException& exc)
83+
{
84+
URCL_LOG_ERROR("Caught unexpected exception from sendScriptBlocking");
85+
URCL_LOG_ERROR(exc.what());
8186
}
8287

8388
// We can also send script code without any checks
@@ -87,7 +92,7 @@ end)""";
8792
// E.g. sending the bad script here will not give us any information
8893
// The return value will only tell us that the script code has been sent to the robot.
8994
URCL_LOG_INFO("Sending bad script code without feedback...");
90-
success = client.sendScript(bad_script_code);
95+
bool success = client.sendScript(bad_script_code);
9196
{
9297
std::stringstream ss;
9398
ss << "Bad code sent to robot successfully? " << std::boolalpha << success;

include/ur_client_library/control/reverse_interface.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ class ReverseInterface
8282
{
8383
public:
8484
static const int32_t MULT_JOINTSTATE = 1000000;
85+
static const int32_t MULT_TIME = 1000000;
8586

8687
ReverseInterface() = delete;
8788
/*!

include/ur_client_library/control/script_command_interface.h

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,20 @@ class ScriptCommandInterface : public ReverseInterface
9191
*/
9292
bool setPayload(const double mass, const vector3d_t* cog);
9393

94+
/*!
95+
* \brief Set the target payload mass, center of gravity and inertia matrix
96+
*
97+
* \param mass mass in kilograms
98+
* \param cog Center of Gravity, a vector [CoGx, CoGy, CoGz] specifying the displacement (in meters) from the
99+
* toolmount
100+
* \param inertia Inertia matrix elements [Ixx, Iyy, Izz, Ixy, Ixz, Iyz]
101+
* \param transition_time Duration of the payload property changes in seconds
102+
*
103+
* \returns True, if the write was performed successfully, false otherwise.
104+
*/
105+
bool setTargetPayload(const double mass, const vector3d_t* cog, const vector6d_t* inertia,
106+
const double transition_time = 0.0);
107+
94108
/*!
95109
* \brief Set the gravity vector
96110
*
@@ -264,6 +278,7 @@ class ScriptCommandInterface : public ReverseInterface
264278
SET_GRAVITY = 9, ///< Set gravity vector
265279
SET_TCP_OFFSET = 10, ///< Set TCP offset
266280
SET_FRICTION_SCALES = 11, ///< Set viscous and Coulomb friction scales for direct_torque
281+
SET_TARGET_PAYLOAD = 12, ///< Set target payload
267282
};
268283

269284
/*!

include/ur_client_library/control/trajectory_point_interface.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@ std::string trajectoryResultToString(const TrajectoryResult result);
6363
class TrajectoryPointInterface : public ReverseInterface
6464
{
6565
public:
66-
static const int32_t MULT_TIME = 1000000;
6766
static const int MESSAGE_LENGTH = 21;
6867

6968
TrajectoryPointInterface() = delete;

0 commit comments

Comments
 (0)