File size: 4,640 Bytes
5a6766e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
# I/O Devices

Devices are used to read user input and teleoperate simulated robots in real-time. This is achieved by either using a keyboard, a [SpaceMouse](https://www.3dconnexion.com/spacemouse_compact/en/) or a [DualSense](https://www.playstation.com/en-us/accessories/dualsense-wireless-controller/) joystick, and whose teleoperation capabilities can be demonstrated with the [demo_device_control.py](../demos.html#teleoperation) script. More generally, we support any interface that implements the [Device](../simulation/device) abstract base class. In order to support your own custom device, simply subclass this base class and implement the required methods.

## Keyboard

We support keyboard input through the OpenCV2 window created by the mujoco renderer. 

**Keyboard controls**

Note that the rendering window must be active for these commands to work.

|        Keys         |                   Command                  |
| :------------------ | :----------------------------------------- |
|      Ctrl+q         |               reset simulation             |
|     spacebar        |          toggle gripper (open/close)       |
| up-right-down-left  |       move horizontally in x-y plane       |
|        .-;          |                move vertically             |
|        o-p          |                 rotate (yaw)               |
|        y-h          |                rotate (pitch)              |
|        e-r          |                 rotate (roll)              |
|         b           |     toggle arm/base mode (if applicable)  |
|         s           |  switch active arm (if multi-armed robot)  |
|         =           | switch active robot (if multi-robot env)   |
|       Ctrl+C           |                    quit                    |


## 3Dconnexion SpaceMouse

We support the use of a [SpaceMouse](https://www.3dconnexion.com/spacemouse_compact/en/) as well.

**3Dconnexion SpaceMouse controls**

|          Control          |                Command                |
| :------------------------ | :------------------------------------ |
|       Right button        |           reset simulation            |
|    Left button (hold)     |             close gripper             |
|   Move mouse laterally    |  move arm horizontally in x-y plane   |
|   Move mouse vertically   |          move arm vertically          |
| Twist mouse about an axis | rotate arm about a corresponding axis |
|           b               |  toggle arm/base mode (if applicable) |
|           s               |  switch active arm (if multi-armed robot)  |
|           =               |  switch active robot (if multi-robot environment)   |
|      Ctrl+C (keyboard)    |                 quit                  |

## Sony DualSense

we support the use of a [Sony DualSense](https://www.playstation.com/en-us/accessories/dualsense-wireless-controller/) as well.

**Sony DualSense controls**

|          Control             |                Command                |
| :--------------------------- | :------------------------------------ |
|       Square button          |           reset simulation            |
|    Circle button (hold)      |             close gripper             |
|      Move LX/LY Stick        |  move arm horizontally in x-y plane   |
|   Press L2 Trigger with or without L1 button   |          move arm vertically          |
|   Move RX/RY Stick           |  rotate arm about x/y axis (roll/pitch)   |
|   Press R2 Trigger with or without R1 button   |          rotate arm about z axis (yaw)          |
|      Triangle button         |           toggle arm/base mode (if applicable)             |
|   Left/Right Direction Pad   |   switch active arm (if multi-armed robot)  |
|    Up/Down Direction Pad     |    switch active robot (if multi-robot environment)  |
|      Ctrl+C (keyboard)       |                 quit                  |

## Mujoco GUI Device

To use the Mujoco GUI device for teleoperation, follow these steps:

1. Set renderer as `"mjviewer"`. For example:

```python
env = suite.make(
    **options,
    renderer="mjviewer",
    has_renderer=True,
    has_offscreen_renderer=False,
    ignore_done=True,
    use_camera_obs=False,
)
```

Note: if using Mac, please use `mjpython` instead of `python`. For example:

```mjpython robosuite/scripts/collect_human_demonstrations.py --environment Lift --robots Panda --device mjgui --camera frontview --controller WHOLE_BODY_IK```

2. Double click on a mocap body to select a body to drag, then:

On Linux: `Ctrl` + right click to drag the body's position. `Ctrl` + left click to control the body's orientation.
On Mac: `fn` + `Ctrl` + right click.