Python library to control the AK60-6 motor via CAN in servo mode.
- Full servo mode support (duty cycle, current, velocity, position control)
- Type-safe API with comprehensive type hints
- Simple, minimal interface
- Tested with pytest
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# Clone the repository
git clone https://github.com/Robotics-Technology/PyLSS.git
cd PyLSS
# Install dependencies
uv sync
# Or install in development mode with all dependencies
uv sync --all-groupsimport can
from pyakmotorctrl import AK60_6Motor
# Initialize CAN bus
bus = can.Bus(interface="socketcan", channel="can0", bitrate=1000000)
# Create motor instance (motor ID 0x68)
motor = AK60_6Motor(motor_id=0x68, bus=bus)
# Move to position
motor.set_position(180.0) # Move to 180 degrees
# Read motor status
status = motor.read_status()
if status:
print(f"Position: {status['position']:.1f}°")
print(f"Speed: {status['speed']:.0f} ERPM")
print(f"Current: {status['current']:.2f} A")
print(f"Temperature: {status['temperature']}°C")
bus.shutdown()# Basic position control example
uv run examples/basic_position_control.py# Run all tests
uv run pytest
# Type checking
uv run ty check# Install with dev dependencies
uv sync --group dev
# Run tests
uv run pytest
# Run type checker
uv run ty check
# Run linter
uv run ruff checkLGPL-3.0-or-later
Based on the CubeMars AK Series Module Product Manual V3.0.1.