Skip to content

Commit 2fa8991

Browse files
Initial commit
First published library version: 2.7.0
1 parent 6b21c5a commit 2fa8991

21 files changed

+2586
-0
lines changed

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
.idea
2+
.vscode
3+
dist
4+
build
5+
target
6+
UrRtde.egg-info

README.md

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# RTDE client library - Python
2+
Library implements API for Universal Robots RTDE realtime interface.
3+
4+
Full RTDE description is available on [Universal Robots support site](https://www.universal-robots.com/support/)
5+
# Project structure
6+
## rtde
7+
RTDE core library
8+
9+
- rtde.py:
10+
RTDE connection management object
11+
12+
- rtde_config.py:
13+
XML configuration files parser
14+
15+
- csv_writer.py, csv_reader.py:
16+
read and write rtde data objects to text csv files
17+
18+
## examples
19+
- record.py - example of recording realtime data from selected channels.
20+
- example_control_loop.py - example for controlling robot motion. Program moves robot between 2 setpoints.
21+
Copy rtde_control_loop.urp to the robot. Start python script before starting program.
22+
- example_plotting.py - example for using csv_reader, and plotting selected data.
23+
24+
### Running examples
25+
It's recommended to run examples in [virtual environment](https://docs.python.org/3/library/venv.html).
26+
Some require additional libraries.
27+
```
28+
python record.py -h
29+
python record.py --host 192.168.0.1 --frequency 10
30+
```
31+
### Using robot simulator in VirtualBox
32+
RTDE can connect from host system to controller running in VirtualBox
33+
when RTDE port 30004 is forwarded.
34+
1. Download simulator from [Universal Robots support site](https://www.universal-robots.com/support/)
35+
2. Run simulator in VirtualBox
36+
3. Open menu Devices->Network Settings
37+
4. Open Advanced settings for NAT
38+
5. Open Port Forwarding
39+
6. Add new rule, setting host, and guest ports to 30004.
40+
Leave host, and guest IP fields blank.
41+
42+
# Using rtde library
43+
Copy rtde folder python project
44+
Library is compatible with Python 2.7+, and Python 3.6+
45+
46+
# Build release package
47+
```
48+
mvn deploy
49+
```
50+
# Contributor guidelines
51+
Code is formatted with [black](https://github.com/psf/black).
52+
Run code formatter before submitting pull request.
53+

assembly-dev.xml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
2+
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
3+
<formats>
4+
<format>tar.gz</format>
5+
</formats>
6+
<id>dev</id>
7+
<includeBaseDirectory>false</includeBaseDirectory>
8+
<fileSets>
9+
<fileSet>
10+
<directory>${project.build.directory}/dev</directory>
11+
<outputDirectory>/rtde-${version}/</outputDirectory>
12+
<includes>
13+
<include>**/*</include>
14+
</includes>
15+
</fileSet>
16+
</fileSets>
17+
</assembly>

assembly-release.xml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
2+
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
3+
<formats>
4+
<format>zip</format>
5+
</formats>
6+
<id>release</id>
7+
<includeBaseDirectory>false</includeBaseDirectory>
8+
<fileSets>
9+
<fileSet>
10+
<directory>${project.build.directory}/dev</directory>
11+
<outputDirectory>/rtde-${version}/</outputDirectory>
12+
<includes>
13+
<include>**/*</include>
14+
</includes>
15+
<excludes>
16+
<exclude>setup.py</exclude>
17+
<exclude>setup.cfg</exclude>
18+
</excludes>
19+
</fileSet>
20+
</fileSets>
21+
</assembly>

examples/__init__.py

Whitespace-only changes.
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?xml version="1.0"?>
2+
<rtde_config>
3+
<recipe key="state">
4+
<field name="target_q" type="VECTOR6D"/>
5+
<field name="target_qd" type="VECTOR6D"/>
6+
<field name="output_int_register_0" type="INT32"/>
7+
</recipe>
8+
9+
<recipe key="setp">
10+
<field name="input_double_register_0" type="DOUBLE"/>
11+
<field name="input_double_register_1" type="DOUBLE"/>
12+
<field name="input_double_register_2" type="DOUBLE"/>
13+
<field name="input_double_register_3" type="DOUBLE"/>
14+
<field name="input_double_register_4" type="DOUBLE"/>
15+
<field name="input_double_register_5" type="DOUBLE"/>
16+
</recipe>
17+
18+
<recipe key="watchdog">
19+
<field name="input_int_register_0" type="INT32"/>
20+
</recipe>
21+
</rtde_config>

examples/example_plotting.py

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
#!/usr/bin/env python
2+
# Copyright (c) 2016-2022, Universal Robots A/S,
3+
# All rights reserved.
4+
# Redistribution and use in source and binary forms, with or without
5+
# modification, are permitted provided that the following conditions are met:
6+
# * Redistributions of source code must retain the above copyright
7+
# notice, this list of conditions and the following disclaimer.
8+
# * Redistributions in binary form must reproduce the above copyright
9+
# notice, this list of conditions and the following disclaimer in the
10+
# documentation and/or other materials provided with the distribution.
11+
# * Neither the name of the Universal Robots A/S nor the names of its
12+
# contributors may be used to endorse or promote products derived
13+
# from this software without specific prior written permission.
14+
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
15+
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
16+
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
17+
# DISCLAIMED. IN NO EVENT SHALL UNIVERSAL ROBOTS A/S BE LIABLE FOR ANY
18+
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
19+
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
20+
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
21+
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22+
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
23+
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24+
25+
import matplotlib.pyplot as plt
26+
27+
import sys
28+
29+
sys.path.append("..")
30+
import rtde.csv_reader as csv_reader
31+
32+
with open("robot_data.csv") as csvfile:
33+
r = csv_reader.CSVReader(csvfile)
34+
35+
# plot
36+
plt.plot(r.timestamp, r.target_q_1)
37+
plt.show()

0 commit comments

Comments
 (0)