Skip to content

Commit be37471

Browse files
committed
Add script command interface documentation
1 parent 6104c8f commit be37471

File tree

2 files changed

+138
-0
lines changed

2 files changed

+138
-0
lines changed

doc/architecture.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,10 @@ fully functioning robot interface. For details on how to use it, please see the
1818

1919
architecture/dashboard_client
2020
architecture/rtde_client
21+
architecture/script_command_interface
2122
architecture/script_sender
2223

24+
2325
The ``UrDriver``'s modules will be explained in the following.
2426

2527

Lines changed: 136 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,136 @@
1+
.. _script_command_interface:
2+
3+
Script Command Interface
4+
========================
5+
6+
The ``ScriptCommandInterface`` allows using functionality of the robot that would normally
7+
interrupt program execution. For this purpose a subset of the robot's functionality is made
8+
available in specific API calls.
9+
10+
At the time of writing the ``ScriptCommandInterface`` provides the following functions:
11+
12+
- ``zeroFTSensor()``: Zeros the force/torque sensor.
13+
- ``setPayload()``: Set the active payload mass and center of gravity.
14+
- ``setToolVoltage()``: Set the voltage of the tool output.
15+
- ``startForceMode()`` / ``endForceMode()``: Start and end a force mode. See the `force mode
16+
example <https://github.com/UniversalRobots/Universal_Robots_Client_Library/blob/master/examples/force_mode_example.cpp>`_ for more information.
17+
- ``startToolContact()`` / ``endToolContact()``: Start and end a tool contact mode. See the `tool
18+
contact example
19+
<https://github.com/UniversalRobots/Universal_Robots_Client_Library/blob/master/examples/tool_contact_example.cpp>`_
20+
for more information.
21+
22+
Communication protocol
23+
----------------------
24+
25+
The ``ScriptCommandInterface`` communication is part of the protocol implemented in the
26+
`external_control.urscript
27+
<https://github.com/UniversalRobots/Universal_Robots_Client_Library/blob/master/resources/external_control.urscript>`_.
28+
29+
Data sent to the robot
30+
^^^^^^^^^^^^^^^^^^^^^^
31+
32+
The robot reads from the "script_command_socket" expecting a 32 bit integer representation of up to
33+
28 datafields.
34+
35+
.. table:: script_command_socket to_robot message format
36+
:widths: auto
37+
38+
===== =====
39+
index meaning
40+
===== =====
41+
0 script command functionality. Can be either of
42+
- 0: zeroFTSensor
43+
- 1: setPayload
44+
- 2: setToolVoltage
45+
- 3: startForceMode
46+
- 4: endForceMode
47+
- 5: startToolContact
48+
- 6: endToolContact
49+
1-27 data fields specific to the command
50+
===== =====
51+
52+
.. table:: With zeroFTSensor command
53+
:widths: auto
54+
55+
===== =====
56+
index meaning
57+
===== =====
58+
1-27 No specific meaning / values ignored
59+
===== =====
60+
61+
.. table:: With setPayload command
62+
:widths: auto
63+
64+
===== =====
65+
index meaning
66+
===== =====
67+
1 Payload mass in kg (floating point)
68+
2-4 Payload center of gravity in m, displacement from the toolmpount (floating point)
69+
===== =====
70+
71+
.. table:: With setToolVoltage command
72+
:widths: auto
73+
74+
===== =====
75+
index meaning
76+
===== =====
77+
1 Voltage in V (Has to be 0, 12 or 24)
78+
===== =====
79+
80+
.. table:: With startForceMode command
81+
:widths: auto
82+
83+
===== =====
84+
index meaning
85+
===== =====
86+
1-6 task frame (floating point, see script manual for details)
87+
7-12 selection vector (floating point, see script manual for details)
88+
13-18 wrench (floating point, see script manual for details)
89+
19 force_type(one of 1, 2 and 3, see script manual for details)
90+
20-25 limits (floating point, see script manual for details)
91+
26 damping_factor (floating point, see script manual for details)
92+
27 gain_scaling (not on CB3 robots) (floating point, see script manual for details)
93+
===== =====
94+
95+
.. table:: With endForceMode command
96+
:widths: auto
97+
98+
===== =====
99+
index meaning
100+
===== =====
101+
1 No specific meaning / values ignored
102+
===== =====
103+
104+
.. table:: With startToolContact command
105+
:widths: auto
106+
107+
===== =====
108+
index meaning
109+
===== =====
110+
1 No specific meaning / values ignored
111+
===== =====
112+
113+
.. table:: With endToolContact command
114+
:widths: auto
115+
116+
===== =====
117+
index meaning
118+
===== =====
119+
1 No specific meaning / values ignored
120+
===== =====
121+
122+
.. note::
123+
In URScript the ``socket_read_binary_integer()`` function is used to read the data from the
124+
script command socket. The first index in that function's return value is the number of integers read,
125+
so the actual data starts at index 1. The indices in the table above are shifted by one when
126+
accessing the result array of the URScript function.
127+
128+
All floating point data is encoded into an integer representation and has to be divided by the
129+
``MULT_JOINTSTATE`` constant to get the actual floating point value. This constant is defined in
130+
``ReverseInterface`` class.
131+
132+
Data sent from the robot
133+
^^^^^^^^^^^^^^^^^^^^^^^^
134+
135+
Data is being sent from the robot to the ``ScriptCommandInterface`` only when tool contact is used.
136+
It will send either ``UNTIL_TOOL_CONTACT_RESULT_SUCCESS`` when tool contact has been established while tool contact was active or ``UNTIL_TOOL_CONTACT_RESULT_CANCELED`` if tool contact mode was ended without establishing physical contact.

0 commit comments

Comments
 (0)