> For the complete documentation index, see [llms.txt](https://cap-policy.gitbook.io/guide/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://cap-policy.gitbook.io/guide/xarm.md).

# xArm

## Gripper hardware setup

Follow this guide to assemble the gripper: [Assembly Guide](https://nyu-gripper.pages.dev/robot-gripper)

Have the following materials ready:

* Download and print the [gripper mount](https://nyu-gripper.pages.dev/cad/Robot%20_Gripper/xarm7_print%20with%20tpu.stl) in **TPU**
* 4 M6 x 10mm Screws
* 4 M2.5 x 10mm Screws
* The [Dynamixel Starter Set](https://www.robotis.us/dynamixel-starter-set-us/), which includes parts 2-6 in the photo below:

<figure><img src="/files/3yD4fZhHGy3PTt9c9cFL" alt=""><figcaption></figcaption></figure>

1. Connect the Dynamixel Motor to the U2D2 Power Hub. You will hear a clicking sound when connected:

<figure><img src="/files/5S5DLs5dBH6bD3zvR4OR" alt="" width="563"><figcaption></figcaption></figure>

2. Connect the Power Hub to the U2D2 Board

<figure><img src="/files/ioEy35xD60ROM8kQ1V0X" alt="" width="563"><figcaption></figcaption></figure>

3. Connect the U2D2 and your computer with the USB cable. A red light will turn on.

<figure><img src="/files/BuGIpAEEK9VqtUSfIYGI" alt="" width="563"><figcaption></figcaption></figure>

4. Plug the 12V 5A power supply into the U2D2 Power Hub board and switch on the power. A red LED should turn on.

<figure><img src="/files/GPZAxWm8efyid6GSaJO9" alt="" width="563"><figcaption></figcaption></figure>

Go to the `robot-server` directory and run this script to initialize the gripper:

```bash
cd robot-server
python gripper_init.py
```

## Hardware Setup

1. **Power on** the xArm.
2. Ensure the **safety button is disengaged**:

<figure><img src="/files/c4eRxgbQY2o8AXa8yjeA" alt=""><figcaption></figcaption></figure>

3. **Attach gripper to the mount** with M2.5 x 10mm screws

<figure><img src="/files/brF1KUiZ8jHCvTza0TTJ" alt="" width="375"><figcaption></figcaption></figure>

4. **Mount your 3D printed TPU xArm mount** with M6 x 10mm screws

<figure><img src="/files/UmOPJCsyEXB5ClKWpYwF" alt="" width="375"><figcaption></figcaption></figure>

## Deploying a Trained Policy

1. **Set up the iPhone** on the robot:
   * Slide the iPhone into the gripper mount until the camera block hits the mount, then tighten the knob (snug, not over-tight).

<figure><img src="/files/D97xk587weTPejbywUWi" alt="" width="563"><figcaption></figcaption></figure>

* Connect the iPhone to the robot via USB.

<figure><img src="/files/FghQXNCe3CWU2kRuvYGq" alt="" width="563"><figcaption></figcaption></figure>

* In **Record3D** app settings: set **RGBD Streaming** mode to **USB** and **FPS** to **30**.

<figure><img src="/files/ULtWZKVcYHdqnDAzubJe" alt="" width="375"><figcaption></figcaption></figure>

* Press **Record** to enter “stream-ready” mode.

2. **Calibrate Gripper**:

   ```bash
   cd robot-server
   conda activate home_robot
   python auto_calibrate_gripper.py
   ```
3. **Start the robot server**:(Make sure to edit xArm IP):

   ```bash
   python3 start_server.py controller=xarm network.xarm_ip=???
   ```

   This starts streaming images from the iPhone and the robot begins listening for action commands. If you have missing imports, try `pip3 install hydra-core record3d` (and any other missing packages).
4. **Run the policy** in another terminal (requires display):

   ```bash
   cd imitation-in-homes
   conda activate home_robot
   python run.py
   ```
5. Head to the [Playbook](https://docs.google.com/document/d/1nq0DX-a31FvFr1TDDIrt1seIKJJO8ftYRcByZvWp9IE/edit?tab=t.0)

### Available Policy Checkpoints

When running `python run.py`, you can select from these preconfigured checkpoints:

* **`run_vqbet_pick`**: default checkpoint for picking task.
* **`run_vqbet_open`**: default checkpoint for opening task.
* **`run_vqbet_close`**: default checkpoint for closing task.
* **`run_vqbet_pick_exp`**: experimental pick checkpoint.

Choose the config that matches your task and substitute it in:

```bash
python run.py --config-name=<one_of_the_above>
```

***
