Skip to content

Commit 5759fca

Browse files
committed
Add reverse_interface docuemtnation
1 parent 7fca059 commit 5759fca

File tree

2 files changed

+71
-17
lines changed

2 files changed

+71
-17
lines changed

doc/architecture.rst

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -17,31 +17,16 @@ fully functioning robot interface. For details on how to use it, please see the
1717
:maxdepth: 1
1818

1919
architecture/dashboard_client
20+
architecture/reverse_interface
2021
architecture/rtde_client
2122
architecture/script_command_interface
2223
architecture/script_sender
24+
architecture/trajectory_point_interface
2325

2426

2527
The ``UrDriver``'s modules will be explained in the following.
2628

2729

28-
ReverseInterface
29-
----------------
30-
31-
The ``ReverseInterface`` opens a TCP port on which a custom protocol is implemented between the
32-
robot and the control PC. The port can be specified in the class constructor.
33-
34-
It's basic functionality is to send a vector of floating point data together with a mode. It is
35-
meant to send joint positions or velocities together with a mode that tells the robot how to
36-
interpret those values (e.g. ``SERVOJ``, ``SPEEDJ``). Therefore, this interface can be used to do
37-
motion command streaming to the robot.
38-
39-
In order to use this class in an application together with a robot, make sure that a corresponding
40-
URScript is running on the robot that can interpret the commands sent. See `this example
41-
script <../resources/external_control.urscript>`_ for reference.
42-
43-
Also see the :ref:`ScriptSender` for a way to define the corresponding URScript on the
44-
control PC and sending it to the robot upon request.
4530

4631
Other public interface functions
4732
--------------------------------
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
.. _reverse_interface:
2+
3+
ReverseInterface
4+
================
5+
6+
7+
The ``ReverseInterface`` opens a TCP port on which a custom protocol is implemented between the
8+
robot and the control PC. The port can be specified in the class constructor.
9+
10+
It's basic functionality is to send a vector of floating point data together with a mode. It is
11+
meant to send joint positions or velocities together with a mode that tells the robot how to
12+
interpret those values (e.g. ``SERVOJ``, ``SPEEDJ``). Therefore, this interface can be used to do
13+
motion command streaming to the robot.
14+
15+
In order to use this class in an application together with a robot, make sure that a corresponding
16+
URScript is running on the robot that can interpret the commands sent. See `this example
17+
script <https://github.com/UniversalRobots/Universal_Robots_Client_Library/blob/master/resources/external_control.urscript>`_ for reference.
18+
19+
The ``ReverseInterface`` together with the :ref:`script_command_interface`, the
20+
:ref:`trajectory_point_interface` and the
21+
`external_control.urscript
22+
<https://github.com/UniversalRobots/Universal_Robots_Client_Library/blob/master/resources/external_control.urscript>`_
23+
creates a communication protocol in order to control many of the robot's functionalities.
24+
25+
Also see the :ref:`ScriptSender` for a way to define the corresponding URScript on the
26+
control PC and sending it to the robot upon request.
27+
28+
Communication protocol
29+
----------------------
30+
31+
32+
The ``ReverseInterface``'s "reverse_socket" on the robot is expecting 32 bit integer
33+
representations 8 datafields frequently. The timeout with which new data is expected can vary depending
34+
on the current control mode and is set as part of the message. The data fields have the following
35+
meaning:
36+
37+
.. table:: reverse_socket message format
38+
:widths: auto
39+
40+
===== =====
41+
index meaning
42+
===== =====
43+
0 read timeout in milliseconds. The next read from the socket will use this timeout.
44+
1-6 Current motion target. depending on the control mode, this can be interpreted as joint
45+
positions or velocities or a Cartesian pose.
46+
7 Control mode. Can be either of
47+
- -2: STOPPED
48+
- -1: UNINITIALIZED
49+
- 0: IDLE -- no motion
50+
- 1: SERVOJ -- High-frequent joint position control
51+
- 2: SPEEDJ -- Low-frequent joint velocity control
52+
- 3: FORWARD -- Trajectory interpolation on the robot
53+
- 4: SPEEDL
54+
- 5: POSE
55+
- 6: FREEDRIVE
56+
- 7: TOOL_IN_CONTACT
57+
===== =====
58+
59+
.. note::
60+
In URScript the ``socket_read_binary_integer()`` function is used to read the data from the
61+
reverse socket. The first index in that function's return value is the number of integers read,
62+
so the actual data starts at index 1. The indices in the table above are shifted by one when
63+
accessing the result array of the URScript function.
64+
65+
The motion target is encoded into an integer representation and has to be divided by the
66+
``MULT_JOINTSTATE`` constant to get the actual floating point value. This constant is defined in
67+
``ReverseInterface`` class.
68+
69+
Depending on the control mode one can use the ``write()`` (SERVOJ, SPEEDJ, SPEEDL, POSE), ``writeTrajectoryControlMessage()`` (FORWARD) or ``writeFreedriveControlMessage()`` (FREEDRIVE) function to write a message to the "reverse_socket".

0 commit comments

Comments
 (0)