# Use Teleoperation Devices ## Spacemouse ### Intro

In our codebase, the default teleoperation device is the SpaceMouse. The Spacemouse provides a 6DoF control over both positions and orientation, and the two keys on the side provide grasping functionality and resetting functions. This codebase majorly inherit from the infrastructure from robosuite.

### Installation

Assitive Note - Setup spacemouse

We've provided a list of checkboxes for you to keep track of all the necessary steps.


Step 1. Setup a udev rule Installation (Linux): Before using a SpaceMouse in the system, you need to install: 1) `hidapi` python package and 2) `udev` system (in order to avoid sudo). You might need to install `libmotif-dev`. `udev` rules: In order for hidapi to open the device without sudo, we need to do the following steps: Step 1. First of all, create a rule file `xx-spacemouse.rules` under the folder `/etc/udev/rules.d/` (Replace xx with a number larger than 50). ```shell KERNEL=="hidraw*", ATTRS{idVendor}=="256f", ATTRS{idProduct}=="c62e", MODE="0666", GROUP="plugdev" SUBSYSTEM=="usb", ATTRS{idVendor}=="256f", ATTRS{idProduct}=="c62e", MODE="0666", GROUP="plugdev" ``` Step 2. Reload the udev rule We need to reload the defined udev rule to take effect. Reload can be done through: ```shell sudo udevadm control --reload-rules ``` Step 3. Get vendor_id and product_id of your Spacemouse Then let's install `hidapi`, which is for getting the device information (`vendor_id` and `product_id`) of Spacemouse using python. To acquire `hidapi`, install it in your virtual environment through: ``` shell pip install hidapi ``` And to find out the spacemouse configuration, connect the spacemouse to the machine, and do: ``` shell import hid hid.enumerate() ``` This will show the information for a list of devices connected. Locate the information about the spacemouse, and take a note on the `vendor_id` and `product_id`. If there is no device shown as Spacemouse, that means there is some installation process done inappropriately. Please check the installation process. ### Example Usage We've provided a example script that allow users to control the robot through spacemouse. Make sure you are under the parent `Deoxys` folder, and run: Commands on Desktop Under `Deoxys`, run ```shell python examples/run_deoxys_with_spacemouse.py ``` You might need to change the following configurations: - spacemouse vendor_id and product_id ([here](https://github.com/UT-Austin-RPL/deoxys_control/blob/33d9fd446023f86a99a17f65ee81784786267396/deoxys/examples/run_deoxys_with_space_mouse.py#L19)) - the config file for configuring `FrankaInterface` ([here](https://github.com/UT-Austin-RPL/deoxys_control/blob/33d9fd446023f86a99a17f65ee81784786267396/deoxys/examples/run_deoxys_with_space_mouse.py#L16)) if necessary. You might also check and change the PC / NUC names [here](https://github.com/UT-Austin-RPL/deoxys_control/blob/main/deoxys/config/charmander.yml).