Skip to content

Commit

Permalink
Address review with Simon
Browse files Browse the repository at this point in the history
  • Loading branch information
Cadene committed Oct 24, 2024
1 parent 55a499a commit b71ca0a
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 19 deletions.
7 changes: 7 additions & 0 deletions examples/10_use_so100.md
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,13 @@ Follow step 6 of the [assembly video](https://youtu.be/ZqtPjuVFFpg) which illust
|---|---|---|
| <img src="../media/so100/leader_zero.webp?raw=true" alt="SO-100 leader arm zero position" title="SO-100 leader arm zero position" style="width:100%;"> | <img src="../media/so100/leader_rotated.webp?raw=true" alt="SO-100 leader arm rotated position" title="SO-100 leader arm rotated position" style="width:100%;"> | <img src="../media/so100/leader_rest.webp?raw=true" alt="SO-100 leader arm rest position" title="SO-100 leader arm rest position" style="width:100%;"> |

Run this script to launch manual calibration:
```bash
python lerobot/scripts/control_robot.py calibrate \
--robot-path lerobot/configs/robot/so100.yaml \
--robot-overrides '~cameras' --arms main_leader
```

## Teleoperate

**Simple teleop**
Expand Down
7 changes: 7 additions & 0 deletions examples/11_use_moss.md
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,13 @@ Follow step 6 of the [assembly video](https://youtu.be/ZqtPjuVFFpg) which illust
|---|---|---|
| <img src="../media/moss/leader_zero.webp?raw=true" alt="Moss v1 leader arm zero position" title="Moss v1 leader arm zero position" style="width:100%;"> | <img src="../media/moss/leader_rotated.webp?raw=true" alt="Moss v1 leader arm rotated position" title="Moss v1 leader arm rotated position" style="width:100%;"> | <img src="../media/moss/leader_rest.webp?raw=true" alt="Moss v1 leader arm rest position" title="Moss v1 leader arm rest position" style="width:100%;"> |

Run this script to launch manual calibration:
```bash
python lerobot/scripts/control_robot.py calibrate \
--robot-path lerobot/configs/robot/moss.yaml \
--robot-overrides '~cameras' --arms main_leader
```

## Teleoperate

**Simple teleop**
Expand Down
3 changes: 1 addition & 2 deletions lerobot/common/robot_devices/cameras/intelrealsense.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,8 +200,7 @@ class IntelRealSenseCamera:
To find the camera indices of your cameras, you can run our utility script that will save a few frames for each camera:
```bash
python lerobot/common/robot_devices/cameras/intelrealsense.py \
--images-dir outputs/images_from_intelrealsense_cameras
python lerobot/common/robot_devices/cameras/intelrealsense.py --images-dir outputs/images_from_intelrealsense_cameras
```
When an IntelRealSenseCamera is instantiated, if no specific config is provided, the default fps, width, height and color_mode
Expand Down
5 changes: 2 additions & 3 deletions lerobot/common/robot_devices/cameras/opencv.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,8 +216,7 @@ class OpenCVCamera:
To find the camera indices of your cameras, you can run our utility script that will be save a few frames for each camera:
```bash
python lerobot/common/robot_devices/cameras/opencv.py \
--images-dir outputs/images_from_opencv_cameras
python lerobot/common/robot_devices/cameras/opencv.py --images-dir outputs/images_from_opencv_cameras
```
When an OpenCVCamera is instantiated, if no specific config is provided, the default fps, width, height and color_mode
Expand Down Expand Up @@ -324,7 +323,7 @@ def connect(self):
if self.camera_index not in available_cam_ids:
raise ValueError(
f"`camera_index` is expected to be one of these available cameras {available_cam_ids}, but {self.camera_index} is provided instead. "
"To find the camera index you should use, run `python lerobot/lerobot/common/robot_devices/cameras/opencv.py`."
"To find the camera index you should use, run `python lerobot/common/robot_devices/cameras/opencv.py`."
)

raise OSError(f"Can't access OpenCVCamera({camera_idx}).")
Expand Down
10 changes: 0 additions & 10 deletions lerobot/common/robot_devices/motors/feetech.py
Original file line number Diff line number Diff line change
Expand Up @@ -298,16 +298,6 @@ def __init__(
self.logs = {}

self.track_positions = {}
self.present_pos = {
"prev": [None] * len(self.motor_names),
"below_zero": [None] * len(self.motor_names),
"above_max": [None] * len(self.motor_names),
}
self.goal_pos = {
"prev": [None] * len(self.motor_names),
"below_zero": [None] * len(self.motor_names),
"above_max": [None] * len(self.motor_names),
}

def connect(self):
if self.is_connected:
Expand Down
7 changes: 4 additions & 3 deletions lerobot/common/robot_devices/robots/manipulator.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class ManipulatorRobotConfig:
"""

# Define all components of the robot
robot_type: str = "koch"
robot_type: str | None = None
leader_arms: dict[str, MotorsBus] = field(default_factory=lambda: {})
follower_arms: dict[str, MotorsBus] = field(default_factory=lambda: {})
cameras: dict[str, Camera] = field(default_factory=lambda: {})
Expand Down Expand Up @@ -81,7 +81,7 @@ def __setattr__(self, prop: str, val):
super().__setattr__(prop, val)

def __post_init__(self):
if self.robot_type not in ["koch", "koch_bimanual", "aloha", "so100", "moss"]:
if self.robot_type is None or self.robot_type not in ["koch", "aloha", "so100", "moss"]:
raise ValueError(f"Provided robot type ({self.robot_type}) is not supported.")


Expand Down Expand Up @@ -292,7 +292,7 @@ def connect(self):
self.follower_arms[name].write("Torque_Enable", 1)

if self.config.gripper_open_degree is not None:
if self.robot_type in ["aloha", "so100", "moss"]:
if self.robot_type != "koch":
raise NotImplementedError(
f"{self.robot_type} does not support position AND current control in the handle, which is require to set the gripper open."
)
Expand Down Expand Up @@ -328,6 +328,7 @@ def load_or_run_calibration_(name, arm, arm_type):
with open(arm_calib_path) as f:
calibration = json.load(f)
else:
# TODO(rcadene): display a warning in __init__ if calibration file not available
print(f"Missing calibration file '{arm_calib_path}'")

if self.robot_type in ["koch", "aloha"]:
Expand Down
2 changes: 1 addition & 1 deletion tests/test_control_robot.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ def test_record_and_replay_and_policy(tmpdir, request, robot_type, mock):
if robot_type == "aloha":
env_name = "aloha_real"
policy_name = "act_aloha_real"
elif robot_type in ["koch", "koch_bimanual", "so100", "moss"]:
elif robot_type in ["koch", "so100", "moss"]:
env_name = "koch_real"
policy_name = "act_koch_real"
else:
Expand Down

0 comments on commit b71ca0a

Please sign in to comment.