Skip to content

Commit 9a72ff4

Browse files
author
Johannes Hechtl
committed
update code
1 parent 5c2aad5 commit 9a72ff4

File tree

3 files changed

+43
-1
lines changed

3 files changed

+43
-1
lines changed
File renamed without changes.
File renamed without changes.

extensions/rcs_ur5e/src/rcs_ur5e/readme.md

Lines changed: 43 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,46 @@ pip install -ve rcs_ur5e
1717
```
1818

1919
## Usage
20-
TODO(j.hechtl)
20+
```python
21+
import numpy as np
22+
from rcs.envs.base import ControlMode, RelativeTo
23+
from rcs_ur5e.creators import RCSUR5eEnvCreator
24+
from rcs_ur5e.hw import UR5eConfig
25+
26+
ROBOT_IP = "192.168.1.15"
27+
robot_cfg = UR5eConfig()
28+
robot_cfg.async_control = False
29+
30+
env_rel = RCSUR5eEnvCreator()(
31+
robot_cfg=robot_cfg,
32+
control_mode=ControlMode.CARTESIAN_TRPY,
33+
ip=ROBOT_IP,
34+
camera_set=None,
35+
max_relative_movement=0.2,
36+
relative_to=RelativeTo.LAST_STEP,
37+
)
38+
39+
obs, info = env_rel.reset()
40+
41+
act = {"xyzrpy": [0.0, 0, 0.0, 0, 0, np.deg2rad(45)], "gripper": 0}
42+
obs, reward, terminated, truncated, info = env_rel.step(act)
43+
```
44+
45+
For more examples see the [examples](../../examples/) folder.
46+
You can switch to hardware by setting the following flag:
47+
```python
48+
ROBOT_INSTANCE = RobotPlatform.HARDWARE
49+
# ROBOT_INSTANCE = RobotPlatform.SIMULATION
50+
```
51+
52+
You can initially test the connection to the robot and basic movements by running the scripts in the `scripts` folder.
53+
54+
55+
56+
57+
TODO(j.hechtl):
58+
- test usage script
59+
- test examples
60+
- add usage section to documentation page
61+
- make ready for tools repo merge
62+
- simulation gripper?

0 commit comments

Comments
 (0)