Documentation may be out of date or incomplete. Always see our Discord for the most up-to-date information.
Python Library
Overview
The OpenLCH platform provides a simple, easy-to-use Python API to interact with various functions of the robot - servo control, IMU data, audio/video streaming and more.
This means Zeroth-01 is universally accessible to anyone with Python capabilities.
Installation
pip install openlch
Usage
To learn more about functions and parameters, refer to the API reference.
To connect to Zeroth-01, you can either use a USB-C cable or set up a wifi connection.
Wi-Fi configuration
Connect your machine running OpenLCH to the robot with a USB-C cable and run the following command to set the wifi credentials.
openlch set-wifi <ssid> <password>
Restart the robot for the changes to take effect. After that, you can get the IP address of the robot.
openlch get-ip
Code example
Getting the position of and controlling servos, plus IMU data:
from openlch.hal import HAL
# Default IP is 192.168.42.1, which is the IP of the USB interface
robot = HAL(ip="192.168.42.1")
# Get current positions of all servos
positions = robot.get_positions()
print(positions)
## ID, position, velocity [(1, 0, 0), (2, -50, 0), (3, 5, 20)...]
# Set position of individual servos
robot.servo.set_position(1, 90) # Move servo ID 1 to 90 degrees
robot.servo.set_position(2, -45, 20) # Move servo ID 2 to -45 degrees at speed 20 deg/s
# Set position of multiple servos
robot.servo.enable_movement() # Enable continuous position control
robot.servo.set_positions([(1, 90), (2, -45), (3, 5)]) # Move servos to specified positions
# Get IMU data
imu_data = robot.imu.get_data()
print(imu_data)
## {gyro: [x, y, z], accel: [x, y, z]}; units are deg/s and m/s^2 respectively
Update SDK
OpenLCH SDK can be updated using pip.
pip install openlch -U