Skip to content

Commit 7e06117

Browse files
committed
Add primary client to documentation
1 parent 77881a0 commit 7e06117

2 files changed

Lines changed: 43 additions & 0 deletions

File tree

doc/architecture.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ well as a couple of standalone modules to directly use subsets of the library's
1010
:maxdepth: 1
1111

1212
architecture/dashboard_client
13+
architecture/primary_client
1314
architecture/reverse_interface
1415
architecture/rtde_client
1516
architecture/script_command_interface
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
:github_url: https://github.com/UniversalRobots/Universal_Robots_Client_Library/blob/master/doc/architecture/primary_client.rst
2+
3+
.. _primary_client:
4+
5+
PrimaryClient
6+
=============
7+
8+
The Primary Client serves as an interface to the robot's `primary interface <https://docs.universal-robots.com/tutorials/communication-protocol-tutorials/primary-secondary-guide.html>`_, present on port 30001.
9+
The ``PrimaryClient`` class supports, among other things, sending URScript code for execution on the robot through the primary interface. Currently it offers two methods of script execution: ``sendScript`` and ``sendScriptBlocking``.
10+
11+
Script execution without feedback
12+
---------------------------------
13+
Method signature:
14+
15+
.. code-block:: c++
16+
17+
bool sendScript(std::string program);
18+
19+
The ``sendScript`` method will accept valid URScript code, and send it to the robot through the primary interface. This is a non-blocking method, as it will return as soon as the program has been transferred to the robot. It returns true when the program is successfully transferred to the robot, and false otherwise.
20+
There is no feedback on whether the program is actually executed on the robot.
21+
22+
Script execution with feedback
23+
------------------------------
24+
Method signature:
25+
26+
.. code-block:: c++
27+
28+
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
33+
);
34+
35+
| 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+
| 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.
41+
| The method only returns true if the program is successfully executed on the robot.
42+
| 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.

0 commit comments

Comments
 (0)