SOFTWARE SDKPython Library
⚠️

This documentation is under construction and incomplete.

Python Library

Overview

OpenLCH platform provides a simple python SDK to interact with various functions of the robot - servo control, IMU data, audio/video streaming and more.

Installation

pip install openlch

Usage

To connect to the robot, you can use either usb-c cable or wifi.

Wi-Fi configuration

Connect robot via usb-c 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 by running openlch get-ip.

Code example

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

To learn more about the functions and parameters, please refer to the API reference.

Update SDK

pip install openlch -U