Skip to content

Commit 4323bdc

Browse files
authored
updating config instructions for koch 1v1 motors (#658)
1 parent 5daa454 commit 4323bdc

File tree

2 files changed

+37
-6
lines changed

2 files changed

+37
-6
lines changed

examples/7_get_started_with_real_robot.md

Lines changed: 34 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,24 +54,53 @@ Then plug the 12V power supply to the motor bus of the follower arm. It has two
5454

5555
Finally, connect both arms to your computer via USB. Note that the USB doesn't provide any power, and both arms need to be plugged in with their associated power supply to be detected by your computer.
5656

57-
*Copy pasting python code*
57+
Now you are ready to configure your motors for the first time, as detailed in the sections below. In the upcoming sections, you'll learn about our classes and functions by running some python code in an interactive session, or by copy-pasting it in a python file.
5858

59-
In the upcoming sections, you'll learn about our classes and functions by running some python code, in an interactive session, or by copy-pasting it in a python file. If this is your first time using the tutorial., we highly recommend going through these steps to get deeper intuition about how things work. Once you're more familiar, you can streamline the process by directly running the teleoperate script (which is detailed further in the tutorial):
59+
If you have already configured your motors the first time, you can streamline the process by directly running the teleoperate script (which is detailed further in the tutorial):
6060
```bash
6161
python lerobot/scripts/control_robot.py teleoperate \
6262
--robot-path lerobot/configs/robot/koch.yaml \
6363
--robot-overrides '~cameras' # do not instantiate the cameras
6464
```
6565

6666
It will automatically:
67-
1. Detect and help you correct any motor configuration issues.
68-
2. Identify any missing calibrations and initiate the calibration procedure.
69-
3. Connect the robot and start teleoperation.
67+
1. Identify any missing calibrations and initiate the calibration procedure.
68+
2. Connect the robot and start teleoperation.
7069

7170
### a. Control your motors with DynamixelMotorsBus
7271

7372
You can use the [`DynamixelMotorsBus`](../lerobot/common/robot_devices/motors/dynamixel.py) to communicate with the motors connected as a chain to the corresponding USB bus. This class leverages the Python [Dynamixel SDK](https://emanual.robotis.com/docs/en/software/dynamixel/dynamixel_sdk/sample_code/python_read_write_protocol_2_0/#python-read-write-protocol-20) to facilitate reading from and writing to the motors.
7473

74+
**First Configuration of your motors**
75+
76+
You will need to unplug each motor in turn and run a command the identify the motor. The motor will save its own identification, so you only need to do this once. Start by unplugging all of the motors.
77+
78+
Do the Leader arm first, as all of its motors are of the same type. Plug in your first motor on your leader arm and run this script to set its ID to 1.
79+
```bash
80+
python lerobot/scripts/configure_motor.py \
81+
--port /dev/tty.usbmodem58760432961 \
82+
--brand dynamixel \
83+
--model xl330-m288 \
84+
--baudrate 1000000 \
85+
--ID 1
86+
```
87+
88+
Then unplug your first motor and plug the second motor and set its ID to 2.
89+
```bash
90+
python lerobot/scripts/configure_motor.py \
91+
--port /dev/tty.usbmodem58760432961 \
92+
--brand dynamixel \
93+
--model xl330-m288 \
94+
--baudrate 1000000 \
95+
--ID 2
96+
```
97+
98+
Redo the process for all your motors until ID 6.
99+
100+
The process for the follower arm is almost the same, but the follower arm has two types of motors. For the first two motors, make sure you set the model to `xl430-w250`. _Important: configuring follower motors requires plugging and unplugging power. Make sure you use the 5V power for the XL330s and the 12V power for the XL430s!_
101+
102+
After all of your motors are configured properly, you're ready to plug them all together in a daisy-chain as shown in the original video.
103+
75104
**Instantiate the DynamixelMotorsBus**
76105

77106
To begin, create two instances of the [`DynamixelMotorsBus`](../lerobot/common/robot_devices/motors/dynamixel.py), one for each arm, using their corresponding USB ports (e.g. `DynamixelMotorsBus(port="/dev/tty.usbmodem575E0031751"`).

lerobot/scripts/configure_motor.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ def configure_motor(port, brand, model, motor_idx_des, baudrate_des):
7676
"Error: More than one motor ID detected. This script is designed to only handle one motor at a time. Please disconnect all but one motor."
7777
)
7878
motor_index = present_ids[0]
79+
break
7980

8081
if motor_index == -1:
8182
raise ValueError("No motors detected. Please ensure you have one motor connected.")
@@ -102,7 +103,8 @@ def configure_motor(port, brand, model, motor_idx_des, baudrate_des):
102103
raise OSError("Failed to write baudrate.")
103104

104105
print(f"Setting its index to desired index {motor_idx_des}")
105-
motor_bus.write_with_motor_ids(motor_bus.motor_models, motor_index, "Lock", 0)
106+
if brand == "feetech":
107+
motor_bus.write_with_motor_ids(motor_bus.motor_models, motor_index, "Lock", 0)
106108
motor_bus.write_with_motor_ids(motor_bus.motor_models, motor_index, "ID", motor_idx_des)
107109

108110
present_idx = motor_bus.read_with_motor_ids(motor_bus.motor_models, motor_idx_des, "ID", num_retry=2)

0 commit comments

Comments
 (0)