Files
lerobot/docs/source/koch.md

8.9 KiB

Koch v1.1

In the steps below we explain how to assemble the Koch v1.1 robot.

Order and Assemble the parts

Follow the sourcing and assembling instructions provided in this README. This will guide you through setting up both the follower and leader arms, as shown in the image below.

For a visual walkthrough of the assembly process, you can refer to this video tutorial.

Warning

Since the production of this video, we simplified the configuration phase. Because of this, two things differ from the instructions in that video:

  • Don't plug all the motors cables right away and wait for being instructed to do so in Configure the motors.
  • Don't screw in the controller board (PCB) to the base right away and wait for being instructed to do so in Configure the motors.

Install LeRobot 🤗

To install LeRobot follow our Installation Guide

In addition to these instructions, you need to install the Dynamixel sdk:

pip install -e ".[dynamixel]"

Configure the motors

1. Find the USB ports associated to each arm

To find the port for each bus servo adapter, run this script:

python lerobot/find_port.py

Example output:

Finding all available ports for the MotorBus.
['/dev/tty.usbmodem575E0032081', '/dev/tty.usbmodem575E0031751']
Remove the USB cable from your MotorsBus and press Enter when done.

[...Disconnect corresponding leader or follower arm and press Enter...]

The port of this MotorsBus is /dev/tty.usbmodem575E0032081
Reconnect the USB cable.

Where the found port is: /dev/tty.usbmodem575E0032081 corresponding to your leader or follower arm.

On Linux, you might need to give access to the USB ports by running:

sudo chmod 666 /dev/ttyACM0
sudo chmod 666 /dev/ttyACM1

Example output:

Finding all available ports for the MotorBus.
['/dev/ttyACM0', '/dev/ttyACM1']
Remove the usb cable from your MotorsBus and press Enter when done.

[...Disconnect corresponding leader or follower arm and press Enter...]

The port of this MotorsBus is /dev/ttyACM1
Reconnect the USB cable.

Where the found port is: /dev/ttyACM1 corresponding to your leader or follower arm.

2. Set the motors ids and baudrates

Each motor is identified by a unique id on the bus. When brand new, motors usually come with a default id of 1. For the communication to work properly between the motors and the controller, we first need to set a unique, different id to each motor. Additionally, the speed at which data is transmitted on the bus is determined by the baudrate. In order to talk to each other, the controller and all the motors need to be configured with the same baudrate.

To that end, we first need to connect to each motor individually with the controller in order to set these. Since we will write these parameters in the non-volatile section of the motors' internal memory (EEPROM), we'll only need to do this once.

If you are repurposing motors from another robot, you will probably also need to perform this step as the ids and baudrate likely won't match.

Follower

Connect the usb cable from your computer and the 5V power supply to the follower arm's controller board. Then, run the following command or run the API example with the port you got from the previous step. You'll also need to give your leader arm a name with the id parameter.

TODO(pepijn): refer to video instruction here from SO101

```bash python -m lerobot.setup_motors \ --robot.type=koch_follower \ --robot.port=/dev/tty.usbmodem575E0031751 # <- paste here the port found at previous step ``` ```python from lerobot.common.robots.koch_follower import KochFollower, KochFollowerConfig

config = KochFollowerConfig( port="/dev/tty.usbmodem575E0031751", id="my_awesome_follower_arm", ) follower = KochFollower(config) follower.setup_motors()

</hfoption>
</hfoptions>

You should see the following instruction

Connect the controller board to the 'gripper' motor only and press enter.


As instructed, plug the gripper's motor. Make sure it's the only motor connected to the board, and that the motor itself is not yet daisy chained to any other motor. As you press `[Enter]`, the script will automatically set the id and baudrate for that motor.

<details>
<summary>Troubleshooting</summary>

  If you get an error at that point, check your cables and make sure they are plugged-in properly:
  <ul>
    <li>Power supply</li>
    <li>USB cable between your computer and the controller board</li>
    <li>The 3-pin cable from the controller board to the motor</li>
  </ul>

  If you are using a Waveshare controller board, make sure that the two jumpers are set on the `B` channel (USB).
</details>

You should then see the following message:

'gripper' motor id set to 6


Followed by the next instruction:

Connect the controller board to the 'wrist_roll' motor only and press enter.


You can disconnect the 3-pin cable from the controller board but you can leave it connected to the gripper motor on the other end as it will already be in the right place. Now, plug-in another 3-pin cable to the wrist roll motor and connect it to the controller board. As with the previous motor, make sure it is the only motor connected to the board and that the motor itself isn't connected to any other one.

Repeat the operation for each motor as instructed.

> [!TIP]
> Check your cabling at each step before pressing Enter. For instance, as the power supply cable might disconnect as you manipulate the board.

When you are done, the script will simply finish, at which point the motors are ready to be used. You can now plug the 3-pin cable from each motor to the next one, and the cable from the first motor (the 'shoulder pan' with id=1) to the controller board, which can now be attached to the base of the arm.

#### Leader
Do the same steps for the leader arm but modify the command or script accordingly.

<hfoptions id="setup_motors">
<hfoption id="Command">
```bash
python -m lerobot.setup_motors \
    --teleop.type=koch_leader \
    --teleop.port=/dev/tty.usbmodem575E0031751 \  # <- paste here the port found at previous step
```python from lerobot.common.teleoperators.koch_leader import KochLeader, KochLeaderConfig

config = KochLeaderConfig( port="/dev/tty.usbmodem575E0031751", id="my_awesome_leader_arm", ) leader = KochLeader(config) leader.setup_motors()

</hfoption>
</hfoptions>

## Calibrate

Next, you'll need to calibrate your robot to ensure that the leader and follower arms have the same position values when they are in the same physical position.
The calibration process is very important because it allows a neural network trained on one robot to work on another.

#### Follower

Run the following command of API example to calbrate the follower arm:

<hfoptions id="calibrate_follower">
<hfoption id="Command">
```bash
python -m lerobot.calibrate \
    --robot.type=koch_follower \
    --robot.port=/dev/tty.usbmodem58760431551 \ # <- The port of your robot
    --robot.id=my_awesome_follower_arm  # <- Give the robot a unique name
```python from lerobot.common.robots.koch_follower import KochFollowerConfig, KochFollower

config = KochFollowerConfig( port="/dev/tty.usbmodem585A0076891", id="my_awesome_follower_arm", )

follower = KochFollower(config) follower.connect(calibrate=False) follower.calibrate() follower.disconnect()

</hfoption>
</hfoptions>

TODO(pepijn): write docs for doing calibration
- First step is moving to middle position (add image)
- Second step is moving all joints to full range (add video with laptop screen side by side)

#### Leader

Run the following command of API example to calbrate the leader arm:

<hfoptions id="calibrate_leader">
<hfoption id="Command">
```bash
python -m lerobot.calibrate \
    --teleop.type=koch_leader \
    --teleop.port=/dev/tty.usbmodem58760431551 \ # <- The port of your robot
    --teleop.id=my_awesome_leader_arm  # <- Give the robot a unique name
```python from lerobot.common.teleoperators.koch_leader import KochLeaderConfig, KochLeader

config = KochLeaderConfig( port="/dev/tty.usbmodem575E0031751", id="my_awesome_leader_arm", )

leader = KochLeader(config) leader.connect(calibrate=False) leader.calibrate() leader.disconnect()

</hfoption>
</hfoptions>

Congrats 🎉, your robot is all set to learn a task on its own. Start training it by following this tutorial: [Getting started with real-world robots](./getting_started_real_world_robot)

> [!TIP]
>  If you have any questions or need help, please reach out on [Discord](https://discord.com/invite/s3KuuzsPFb).