Skip to content

Commit

Permalink
Fixed issue #3 - added tags
Browse files Browse the repository at this point in the history
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
  • Loading branch information
michal-milkowski committed Dec 20, 2022
1 parent 46093a0 commit 99a94ac
Show file tree
Hide file tree
Showing 6 changed files with 50 additions and 89 deletions.
25 changes: 23 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,16 @@ Some require additional libraries.
python record.py -h
python record.py --host 192.168.0.1 --frequency 10
```
### Using robot simulator in VirtualBox
# Using robot simulator in Docker
RTDE can connect from host system to controller running in Docker
when RTDE port 30004 is forwarded.
1. Get latest ursim docker image: docker pull universalrobots/ursim_e-series
2. Run docker container: docker run --rm -dit -p 30004:30004 -p 5900:5900 -p 6080:6080 universalrobots/ursim_e-series
3. open vnc client in browser, and confirm safet: http://localhost:6080/vnc.html?host=docker_ip&port=6080

More information about ursim docker image is available on [Dockerhub](https://hub.docker.com/r/universalrobots/ursim_e-series)

# Using robot simulator in VirtualBox
RTDE can connect from host system to controller running in VirtualBox
when RTDE port 30004 is forwarded.
1. Download simulator from [Universal Robots support site](https://www.universal-robots.com/support/)
Expand All @@ -45,8 +54,20 @@ Library is compatible with Python 2.7+, and Python 3.6+

# Build release package
```
mvn deploy
mvn package
```
## Using with virtual environment
Create virtual environment, and install wheel package
```
python -m venv venv
source venv/bin/activate
pip install wheel
```
Install rtde package
```
pip install target/rtde-<version>-release.zip
```

# Contributor guidelines
Code is formatted with [black](https://github.com/psf/black).
Run code formatter before submitting pull request.
Expand Down
17 changes: 0 additions & 17 deletions assembly-dev.xml

This file was deleted.

6 changes: 1 addition & 5 deletions assembly-release.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,11 @@
<includeBaseDirectory>false</includeBaseDirectory>
<fileSets>
<fileSet>
<directory>${project.build.directory}/dev</directory>
<directory>${project.build.directory}/release</directory>
<outputDirectory>/rtde-${version}/</outputDirectory>
<includes>
<include>**/*</include>
</includes>
<excludes>
<exclude>setup.py</exclude>
<exclude>setup.cfg</exclude>
</excludes>
</fileSet>
</fileSets>
</assembly>
34 changes: 19 additions & 15 deletions examples/example_control_loop.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,27 +23,28 @@
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

import sys
sys.path.append('..')

sys.path.append("..")
import logging

import rtde.rtde as rtde
import rtde.rtde_config as rtde_config


#logging.basicConfig(level=logging.INFO)
# logging.basicConfig(level=logging.INFO)

ROBOT_HOST = 'localhost'
ROBOT_HOST = "localhost"
ROBOT_PORT = 30004
config_filename = 'control_loop_configuration.xml'
config_filename = "control_loop_configuration.xml"

keep_running = True

logging.getLogger().setLevel(logging.INFO)

conf = rtde_config.ConfigFile(config_filename)
state_names, state_types = conf.get_recipe('state')
setp_names, setp_types = conf.get_recipe('setp')
watchdog_names, watchdog_types = conf.get_recipe('watchdog')
state_names, state_types = conf.get_recipe("state")
setp_names, setp_types = conf.get_recipe("setp")
watchdog_names, watchdog_types = conf.get_recipe("watchdog")

con = rtde.RTDE(ROBOT_HOST, ROBOT_PORT)
con.connect()
Expand All @@ -66,38 +67,41 @@
setp.input_double_register_3 = 0
setp.input_double_register_4 = 0
setp.input_double_register_5 = 0

# The function "rtde_set_watchdog" in the "rtde_control_loop.urp" creates a 1 Hz watchdog
watchdog.input_int_register_0 = 0


def setp_to_list(setp):
list = []
for i in range(0,6):
for i in range(0, 6):
list.append(setp.__dict__["input_double_register_%i" % i])
return list


def list_to_setp(setp, list):
for i in range (0,6):
for i in range(0, 6):
setp.__dict__["input_double_register_%i" % i] = list[i]
return setp

#start data synchronization

# start data synchronization
if not con.send_start():
sys.exit()

# control loop
while keep_running:
# receive the current state
state = con.receive()

if state is None:
break;
break

# do something...
if state.output_int_register_0 != 0:
new_setp = setp1 if setp_to_list(setp) == setp2 else setp2
list_to_setp(setp, new_setp)
# send new setpoint
# send new setpoint
con.send(setp)

# kick watchdog
Expand Down
49 changes: 6 additions & 43 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,8 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.ur.rtde.client</groupId>
<artifactId>python</artifactId>
<version>2.7.0</version>
<version>2.7.1</version>
<packaging>pom</packaging>
<parent>
<groupId>com.ur</groupId>
<artifactId>parent-universal</artifactId>
<version>1.0.3</version>
<relativePath/>
</parent>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
Expand Down Expand Up @@ -47,31 +41,13 @@
<directory>${project.basedir}</directory>
<includes>
<include>examples/**</include>
</includes>
</resource>
</resources>
</configuration>
</execution>

<execution>
<id>copy python files for dev / internal usage</id>
<goals>
<goal>copy-resources</goal>
</goals>
<phase>generate-sources</phase>
<configuration>
<overwrite>true</overwrite>
<outputDirectory>${project.basedir}/target/dev</outputDirectory>
<resources>
<resource>
<directory>${project.basedir}</directory>
<includes>
<include>/**/*</include>
<include>README.md</include>
<include>LICENSE</include>
<include>setup.py</include>
<include>setup.cfg</include>
</includes>
<excludes>
<exclude>pom.xml</exclude>
<exclude>assembly*.xml</exclude>
<exclude>target/**</exclude>
<exclude>**/*pyc</exclude>
</excludes>
</resource>
</resources>
Expand All @@ -98,19 +74,6 @@
</descriptors>
</configuration>
</execution>
<execution>
<id>Create development tar.gz</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<appendAssemblyId>true</appendAssemblyId>
<descriptors>
<descriptor>assembly-dev.xml</descriptor>
</descriptors>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
Expand Down
8 changes: 1 addition & 7 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,9 @@
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
from setuptools import setup


with open("../VERSION", "rb") as f:
version = f.read().decode("utf-8")
version = version.split("-")[0]


setup(
name="UrRtde",
packages=["rtde"],
version=version,
version="2.7.1",
description="Real-Time Data Exchange (RTDE) python client + examples",
)

0 comments on commit 99a94ac

Please sign in to comment.