Skip to content

Latest commit

 

History

4 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Delibot-Controller-RPi-Library

Raspberry Pi Python client for the Delibot STM32 motor controller's UART protocol (USART2, 115200 8N1, App/Src/rpi_link.c / host_commands.c in Delibot-Controller).

Install

pip install delibot

or from source:

pip install -e .

Usage

from delibot import DelibotController, Param

with DelibotController("/dev/ttyAMA0") as robot:
    robot.set_velocity(linear_mm_s=300, angular_mrad_s=0)

    telemetry = robot.telemetry
    if telemetry is not None:
        print(telemetry.yaw_deg, telemetry.left_wheel_mm_s, telemetry.motors_on)

    track_width = robot.get_param(Param.WHEEL_TRACK_WIDTH_MM)
    robot.set_param(Param.WHEEL_TRACK_WIDTH_MM, 210.0)
    robot.save_params()

    ticks = robot.get_encoder_ticks()
    robot.zero_encoders()

    robot.stop()

set_velocity is kept alive internally by a background heartbeat thread, so the STM32's 500 ms deadman watchdog (RPI_LINK_TIMEOUT_MS) never trips between calls — call it once per desired speed change, not on every control-loop tick.

telemetry is updated asynchronously from a background reader thread at the firmware's 50 Hz push rate; pass on_telemetry= / on_debug= callbacks to DelibotController to react to updates and firmware debug prints as they arrive instead of polling the property.

Protocol

  • Frame: SOF(0xFF) LEN CMD PAYLOAD... CRC, CRC = CMD ^ PAYLOAD[0] ^ ... ^ PAYLOAD[n-1].
  • No sequence numbers or NACKs on the wire — request/response calls (get_param, get_encoder_ticks, get_crsf_channels, ping) apply a client-side timeout (DelibotTimeoutError) instead.
  • See src/delibot/protocol.py for the full command and parameter ID tables.

About

RPi python library for controlling delibot!

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages