Skip to content

motius/pyLSS

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Lynxmotion Smart Servo (LSS) Python Library

Official Lynxmotion Smart Servo (LSS) libraries for Python

Read more about the LSS on our wiki.

If you want more details about the LSS protocol, go here.

To configure your LSS easily, we recommend you try out the LSS Config. More details about it on the wiki.

Purchase any LSS model on and accessories at RobotShop!

Check out blogs, tutorials and post questions on the RobotShop community site.

Installation

This project uses uv for dependency management. If you don't have uv installed:

# Install uv (Linux/macOS)
curl -LsSf https://astral.sh/uv/install.sh | sh

# Or using pip
pip install uv

Install the library

# Clone the repository
git clone https://github.com/motius/pyLSS
cd PyLSS

# Install dependencies
uv sync

# Or install in development mode with all dependencies
uv sync --all-groups

Using the library in your project

import serial
from pylss import LSS

# Create and open a serial connection
bus = serial.Serial('/dev/ttyUSB0', 115200, timeout=0.1)

# Create an LSS servo controller for servo ID 5
servo = LSS(5, bus)

# Move to 45 degrees
servo.move_deg(45.0)

# Get current position
position = servo.get_position_deg()
print(f"Current position: {position}°")

# Get servo information
model = servo.get_model()
voltage = servo.get_voltage()
temperature = servo.get_temperature()

print(f"Model: {model}")
print(f"Voltage: {voltage}mV")
print(f"Temperature: {temperature/10}°C")

# Clean up
bus.close()

Running Examples

The repository includes several example scripts in the examples directory:

Testing

The library includes a comprehensive test suite using pytest with mocked serial communication, so no hardware is required to run tests.

Run all tests

# Run all tests
uv run pytest tests/

# Run with verbose output
uv run pytest tests/ -v

# Run with coverage report
uv run pytest tests/ --cov=pylss

# Run specific test class
uv run pytest tests/test.py::TestLSSActionMethods -v

All tests use mocked serial objects, making them fast and reliable without requiring physical hardware.

About

Lynxmotion Smart Servos (LSS) Library for Python

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%