Skip to content

Commit 99a94ac

Browse files
Fixed issue #3 - added tags
Fixed issue #2 - added setup.py and setup.cfg to release package Fixed issue #1 - removed depenency on VERSION file - Readme file update with instructions for running inside venv, and with dockerized ursim - Removed dev package intended only for internal UR use
1 parent 46093a0 commit 99a94ac

File tree

6 files changed

+50
-89
lines changed

6 files changed

+50
-89
lines changed

README.md

+23-2
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,16 @@ Some require additional libraries.
2828
python record.py -h
2929
python record.py --host 192.168.0.1 --frequency 10
3030
```
31-
### Using robot simulator in VirtualBox
31+
# Using robot simulator in Docker
32+
RTDE can connect from host system to controller running in Docker
33+
when RTDE port 30004 is forwarded.
34+
1. Get latest ursim docker image: docker pull universalrobots/ursim_e-series
35+
2. Run docker container: docker run --rm -dit -p 30004:30004 -p 5900:5900 -p 6080:6080 universalrobots/ursim_e-series
36+
3. open vnc client in browser, and confirm safet: http://localhost:6080/vnc.html?host=docker_ip&port=6080
37+
38+
More information about ursim docker image is available on [Dockerhub](https://hub.docker.com/r/universalrobots/ursim_e-series)
39+
40+
# Using robot simulator in VirtualBox
3241
RTDE can connect from host system to controller running in VirtualBox
3342
when RTDE port 30004 is forwarded.
3443
1. Download simulator from [Universal Robots support site](https://www.universal-robots.com/support/)
@@ -45,8 +54,20 @@ Library is compatible with Python 2.7+, and Python 3.6+
4554

4655
# Build release package
4756
```
48-
mvn deploy
57+
mvn package
58+
```
59+
## Using with virtual environment
60+
Create virtual environment, and install wheel package
4961
```
62+
python -m venv venv
63+
source venv/bin/activate
64+
pip install wheel
65+
```
66+
Install rtde package
67+
```
68+
pip install target/rtde-<version>-release.zip
69+
```
70+
5071
# Contributor guidelines
5172
Code is formatted with [black](https://github.com/psf/black).
5273
Run code formatter before submitting pull request.

assembly-dev.xml

-17
This file was deleted.

assembly-release.xml

+1-5
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,11 @@
77
<includeBaseDirectory>false</includeBaseDirectory>
88
<fileSets>
99
<fileSet>
10-
<directory>${project.build.directory}/dev</directory>
10+
<directory>${project.build.directory}/release</directory>
1111
<outputDirectory>/rtde-${version}/</outputDirectory>
1212
<includes>
1313
<include>**/*</include>
1414
</includes>
15-
<excludes>
16-
<exclude>setup.py</exclude>
17-
<exclude>setup.cfg</exclude>
18-
</excludes>
1915
</fileSet>
2016
</fileSets>
2117
</assembly>

examples/example_control_loop.py

+19-15
Original file line numberDiff line numberDiff line change
@@ -23,27 +23,28 @@
2323
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2424

2525
import sys
26-
sys.path.append('..')
26+
27+
sys.path.append("..")
2728
import logging
2829

2930
import rtde.rtde as rtde
3031
import rtde.rtde_config as rtde_config
3132

3233

33-
#logging.basicConfig(level=logging.INFO)
34+
# logging.basicConfig(level=logging.INFO)
3435

35-
ROBOT_HOST = 'localhost'
36+
ROBOT_HOST = "localhost"
3637
ROBOT_PORT = 30004
37-
config_filename = 'control_loop_configuration.xml'
38+
config_filename = "control_loop_configuration.xml"
3839

3940
keep_running = True
4041

4142
logging.getLogger().setLevel(logging.INFO)
4243

4344
conf = rtde_config.ConfigFile(config_filename)
44-
state_names, state_types = conf.get_recipe('state')
45-
setp_names, setp_types = conf.get_recipe('setp')
46-
watchdog_names, watchdog_types = conf.get_recipe('watchdog')
45+
state_names, state_types = conf.get_recipe("state")
46+
setp_names, setp_types = conf.get_recipe("setp")
47+
watchdog_names, watchdog_types = conf.get_recipe("watchdog")
4748

4849
con = rtde.RTDE(ROBOT_HOST, ROBOT_PORT)
4950
con.connect()
@@ -66,38 +67,41 @@
6667
setp.input_double_register_3 = 0
6768
setp.input_double_register_4 = 0
6869
setp.input_double_register_5 = 0
69-
70+
7071
# The function "rtde_set_watchdog" in the "rtde_control_loop.urp" creates a 1 Hz watchdog
7172
watchdog.input_int_register_0 = 0
7273

74+
7375
def setp_to_list(setp):
7476
list = []
75-
for i in range(0,6):
77+
for i in range(0, 6):
7678
list.append(setp.__dict__["input_double_register_%i" % i])
7779
return list
7880

81+
7982
def list_to_setp(setp, list):
80-
for i in range (0,6):
83+
for i in range(0, 6):
8184
setp.__dict__["input_double_register_%i" % i] = list[i]
8285
return setp
8386

84-
#start data synchronization
87+
88+
# start data synchronization
8589
if not con.send_start():
8690
sys.exit()
8791

8892
# control loop
8993
while keep_running:
9094
# receive the current state
9195
state = con.receive()
92-
96+
9397
if state is None:
94-
break;
95-
98+
break
99+
96100
# do something...
97101
if state.output_int_register_0 != 0:
98102
new_setp = setp1 if setp_to_list(setp) == setp2 else setp2
99103
list_to_setp(setp, new_setp)
100-
# send new setpoint
104+
# send new setpoint
101105
con.send(setp)
102106

103107
# kick watchdog

pom.xml

+6-43
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,8 @@
66
<modelVersion>4.0.0</modelVersion>
77
<groupId>com.ur.rtde.client</groupId>
88
<artifactId>python</artifactId>
9-
<version>2.7.0</version>
9+
<version>2.7.1</version>
1010
<packaging>pom</packaging>
11-
<parent>
12-
<groupId>com.ur</groupId>
13-
<artifactId>parent-universal</artifactId>
14-
<version>1.0.3</version>
15-
<relativePath/>
16-
</parent>
1711

1812
<properties>
1913
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
@@ -47,31 +41,13 @@
4741
<directory>${project.basedir}</directory>
4842
<includes>
4943
<include>examples/**</include>
50-
</includes>
51-
</resource>
52-
</resources>
53-
</configuration>
54-
</execution>
55-
56-
<execution>
57-
<id>copy python files for dev / internal usage</id>
58-
<goals>
59-
<goal>copy-resources</goal>
60-
</goals>
61-
<phase>generate-sources</phase>
62-
<configuration>
63-
<overwrite>true</overwrite>
64-
<outputDirectory>${project.basedir}/target/dev</outputDirectory>
65-
<resources>
66-
<resource>
67-
<directory>${project.basedir}</directory>
68-
<includes>
69-
<include>/**/*</include>
44+
<include>README.md</include>
45+
<include>LICENSE</include>
46+
<include>setup.py</include>
47+
<include>setup.cfg</include>
7048
</includes>
7149
<excludes>
72-
<exclude>pom.xml</exclude>
73-
<exclude>assembly*.xml</exclude>
74-
<exclude>target/**</exclude>
50+
<exclude>**/*pyc</exclude>
7551
</excludes>
7652
</resource>
7753
</resources>
@@ -98,19 +74,6 @@
9874
</descriptors>
9975
</configuration>
10076
</execution>
101-
<execution>
102-
<id>Create development tar.gz</id>
103-
<phase>package</phase>
104-
<goals>
105-
<goal>single</goal>
106-
</goals>
107-
<configuration>
108-
<appendAssemblyId>true</appendAssemblyId>
109-
<descriptors>
110-
<descriptor>assembly-dev.xml</descriptor>
111-
</descriptors>
112-
</configuration>
113-
</execution>
11477
</executions>
11578
</plugin>
11679
</plugins>

setup.py

+1-7
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,9 @@
2323
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2424
from setuptools import setup
2525

26-
27-
with open("../VERSION", "rb") as f:
28-
version = f.read().decode("utf-8")
29-
version = version.split("-")[0]
30-
31-
3226
setup(
3327
name="UrRtde",
3428
packages=["rtde"],
35-
version=version,
29+
version="2.7.1",
3630
description="Real-Time Data Exchange (RTDE) python client + examples",
3731
)

0 commit comments

Comments
 (0)