Skip to content

Commit c27a2ca

Browse files
committed
Tested on Ubuntu, updated comments, small fixes
1 parent d7f1c7c commit c27a2ca

File tree

2 files changed

+15
-10
lines changed

2 files changed

+15
-10
lines changed

lerobot/common/robot_devices/controllers/joysticks.py

+7-6
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
1-
# pyhidapi is used to read inputs from the PS4 controller.
2-
# pip install pyhidapi
1+
# hid is used to read inputs from the PS4 controller.
2+
# pip install hid
3+
# Requires installing hidapi library: https://github.com/libusb/hidapi
34
# The PS4 controller should be connected via USB
4-
# So far only tested on Mac
5+
# Bluetooth connection can partially work but may require some changes
6+
# So far only tested on Mac and Ubuntu
7+
# When running on ubuntu make sure that the user has access to the USB device (joystick)
58

69
import logging
710
import math
@@ -139,7 +142,7 @@ def __init__(
139142
def connect(self):
140143
try:
141144
self.device = hid.Device(self.VENDOR_ID, self.PRODUCT_ID)
142-
logging.info(f"Connected to {self.device.get_product_string()}")
145+
logging.info(f"Connected to PS4 controller: {self.device.manufacturer} {self.device.product}")
143146
self.running = True
144147
except OSError as e:
145148
logging.error(f"Unable to open device: {e}")
@@ -343,8 +346,6 @@ def _update_positions(self, axes, buttons):
343346
correct_inverse_kinematics = True
344347
except ValueError as e:
345348
logging.error(f"Error computing inverse kinematics: {e}")
346-
self.indicate_error()
347-
348349
# Perform eligibility check
349350
if self._is_position_valid(temp_positions, temp_x, temp_y) and correct_inverse_kinematics:
350351
# Atomic update: all positions are valid, apply the changes

lerobot/configs/robot/so100_ps4.yaml

+8-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
11
# [SO-100 robot arm with ps4 controller]
22

3-
# requires installing pygame
4-
# With pip: `pip install pygame`
3+
# hid is used to read inputs from the PS4 controller.
4+
# pip install hid
5+
# Requires installing hidapi library: https://github.com/libusb/hidapi
6+
# The PS4 controller should be connected via USB
7+
# Bluetooth connection can partially work but may require some changes
8+
# So far only tested on Mac and Ubuntu
9+
# When running on ubuntu make sure that the user has access to the USB device (joystick)
510

611
_target_: lerobot.common.robot_devices.robots.manipulator.ManipulatorRobot
712
robot_type: so100
@@ -23,7 +28,7 @@ controller:
2328
- wrist_flex
2429
- wrist_roll
2530
- gripper
26-
initial_position: [90, 180, 180, 0, 0, 10] # Configurable initial positions
31+
initial_position: [90, 170, 170, 0, 0, 10] # Configurable initial positions
2732
l1: 117.0 # Length of first lever in mm
2833
l2: 136.0 # Length of second lever in mm
2934

@@ -54,4 +59,3 @@ cameras:
5459
fps: 30
5560
width: 640
5661
height: 480
57-

0 commit comments

Comments
 (0)