Skip to content

Commit f201dcb

Browse files
- Add devcontainer configuration
- Update README file to point to docs website - Minor updates to README
1 parent 243f2d2 commit f201dcb

File tree

4 files changed

+95
-20
lines changed

4 files changed

+95
-20
lines changed

.devcontainer/Dockerfile

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
FROM python:3
2+
3+
# Install python development requirements
4+
COPY requirements-dev.txt /tmp/requirements-dev.txt
5+
RUN pip install --no-cache-dir -r /tmp/requirements-dev.txt
6+
7+
# Install maven and clean up
8+
RUN apt-get update \
9+
&& apt-get install -y maven \
10+
&& apt-get clean \
11+
&& rm -rf /var/lib/apt/lists/*
12+
13+
# set the working directory
14+
WORKDIR /workspace
15+
16+
# Add normal user. USER_UID, and USER_GID are passed from local environment by devcontainer.json.
17+
# Otherwise all files are created with root privileges.
18+
ARG USER_UID
19+
ARG USER_GID
20+
21+
RUN groupadd --gid $USER_GID devuser \
22+
&& useradd --uid $USER_UID --gid $USER_GID --create-home --shell /bin/bash devuser
23+
24+
USER devuser

.devcontainer/devcontainer.json

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"name": "Python 3 & Maven Dev Container",
3+
"build": {
4+
"dockerfile": "Dockerfile",
5+
"args": {
6+
"USER_UID": "${localEnv:UID:1000}",
7+
"USER_GID": "${localEnv:GID:1000}"
8+
}
9+
},
10+
"customizations": {
11+
"vscode": {
12+
"extensions": [
13+
"ms-python.python"
14+
],
15+
"settings": {
16+
"python.formatting.provider": "black"
17+
}
18+
}
19+
},
20+
"runArgs": [
21+
"--add-host=controller:host-gateway"
22+
]
23+
}

.devcontainer/requirements-dev.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
black

README.md

Lines changed: 47 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# RTDE client library - Python
22
Library implements API for Universal Robots RTDE realtime interface.
33

4-
Full RTDE description is available on [Universal Robots support site](https://www.universal-robots.com/support/)
4+
Full RTDE description is available on [Universal Robots documentation site](https://docs.universal-robots.com/tutorials/communication-protocol-tutorials/rtde-guide.html)
55
# Project structure
66
## rtde
77
RTDE core library
@@ -22,18 +22,24 @@ Copy rtde_control_loop.urp to the robot. Start python script before starting pro
2222
- example_plotting.py - example for using csv_reader, and plotting selected data.
2323

2424
### 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-
```
25+
It's recommended to run examples in [virtual environment](https://docs.python.org/3/library/venv.html) or [devcontainer](#using-devcontainer).
26+
```bash
27+
# Example for recording realtime data from the robot
28+
# NOTE: RTDE interface has to be enabled in the robot security settings
29+
cd examples
2830
python record.py -h
2931
python record.py --host 192.168.0.1 --frequency 10
3032
```
31-
# Using robot simulator in Docker
32-
RTDE can connect from host system to controller running in Docker
33+
# Using robot simulator in a Docker
34+
RTDE can connect from host system or [devcontainer](#using-devcontainer) to controller running in a Docker
3335
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
36+
```bash
37+
# 1. Get latest ursim docker image
38+
docker pull universalrobots/ursim_e-series
39+
# 2. Run docker container:
40+
docker run --rm -dit -p 30004:30004 -p 5900:5900 -p 6080:6080 universalrobots/ursim_e-series
41+
# 3. open vnc client in browser, and confirm safety: http://localhost:6080/vnc.html?host=docker_ip&port=6080
42+
```
3743

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

@@ -49,43 +55,64 @@ when RTDE port 30004 is forwarded.
4955
Leave host, and guest IP fields blank.
5056

5157
# Using rtde library
52-
Copy rtde folder python project
58+
Copy rtde folder to python project or install with
59+
```bash
60+
pip install .
61+
# or use pre-built package from github
62+
pip install ./rtde-<version>-release.zip
63+
pip install https://github.com/UniversalRobots/RTDE_Python_Client_Library/releases/download/[version]/rtde-[version]-release.zip
64+
```
65+
5366
Library is compatible with Python 2.7+, and Python 3.6+
5467

5568
# Build release package
56-
```
69+
```bash
5770
mvn package
5871
```
59-
## Using with virtual environment
72+
## Using pre-built package with virtual environment
6073
Create virtual environment, and install wheel package
6174

6275
### Linux & MacOS
63-
```
76+
```bash
6477
python -m venv venv
6578
source venv/bin/activate
6679
pip install wheel
67-
```
68-
Install rtde package
69-
```
80+
# Install pre-built rtde package
7081
pip install target/rtde-<version>-release.zip
7182
```
7283

7384
### Windows PowerShell
7485
If Python3 is not installed, then just run python3 from powershell. Microsoft store will launch the installation.
7586

7687
Permission to run scripts in console is needed to activate virtual envrionment.
77-
```
88+
```PowerShell
7889
set-executionpolicy -Scope CurrentUser -ExecutionPolicy Unrestricted
7990
python -m venv venv
8091
venv/Scripts/Activate.ps1
8192
pip install wheel
82-
```
83-
Install rtde package
84-
```
93+
# Install pre-built rtde package
8594
pip install target/rtde-<version>-release.zip
8695
```
8796

97+
## Using devcontainer
98+
Open project in VSCode and select to "reopen in devcontainer".
99+
Execute build command from terminal
100+
101+
Running record.py against simulator:
102+
```bash
103+
# first start simulator exposing RTDE port 30004
104+
# docker run --rm -dit -p 30004:30004 -p 5900:5900 -p 6080:6080 universalrobots/ursim_e-series
105+
106+
# in devcontainer terminal type
107+
cd examples
108+
./record.py --host controller --frequency 10 --verbose
109+
```
110+
88111
# Contributor guidelines
89112
Code is formatted with [black](https://github.com/psf/black).
90113
Run code formatter before submitting pull request.
91114

115+
```bash
116+
# open project in devcontainer
117+
python -m black .
118+
```

0 commit comments

Comments
 (0)