Rust driver for the ADORA lifting (leadscrew) motor.
The motor speaks a Modbus-RTU-like protocol over a serial port
(/dev/ttyACM0 @ 19200 baud) or over UDP (192.168.1.30:1232, Ethernet
gateway). The crate provides both a library API and a standalone CLI.
use lifting_motor::{LiftingMotor, UdpTransport};
let transport = UdpTransport::open("192.168.1.30", 1232)?;
let mut motor = LiftingMotor::new(transport);
motor.init()?; // enable Modbus, enable motor, set speed/accel
motor.set_position_mm(500.0)?; // move to 500 mm
motor.set_position_mm(0.0)?; // ALWAYS home to zero on first use!# UDP gateway mode
lifting-motor --mode udp read
lifting-motor --mode udp pos 500
lifting-motor --mode udp zero
# Serial mode
sudo chmod 777 /dev/ttyACM0
lifting-motor --mode serial --serial-port /dev/ttyACM0 watch 90
# Interactive shell (run `init`, `read`, `pos <mm>`, `zero`, `quit`)
lifting-motor --mode udpMillimetre commands are clamped to a configurable window before being sent: values below the minimum go to the minimum, values above the maximum go to the maximum. Defaults: min 250 mm, max 700 mm.
| Variable | Meaning | Default |
|---|---|---|
LIFTING_MOTOR_MIN_MM |
lower bound of the position window | 250 |
LIFTING_MOTOR_MAX_MM |
upper bound of the position window | 700 |
LIFTING_MOTOR_MIN_MM=100 LIFTING_MOTOR_MAX_MM=600 lifting-motor --mode udp pos 800
# 800 -> clamped to 600 mmProgrammatically, use [LiftingMotor::with_position_limits].
| Parameter | Value |
|---|---|
| Supply voltage | 24 V |
| Encoder counts per revolution | 32768 |
| Screw travel per revolution | 0.63636364 mm |
| Stroke | 700 mm (1100 revolutions, raw limit 36044800) |
Position conversions truncate towards zero, matching the behaviour of the
np.int32(...) / int(...) conversions used in the original tooling.
- Frame layout:
[slave 0x01, function, data..., crc_hi, crc_lo] 0x03read registers (0x0016, 2 words) → global position0x7Bset absolute position (signed 32-bit big endian)0x06write register for initialization:00 00enable Modbus00 01enable motor00 03 13 88acceleration 500000 02 05 DCspeed 1500
The CRC is always computed dynamically as standard Modbus CRC16
(e.g. 01 06 00 01 00 01 → 19 CA); nothing is hardcoded.
Cross compiling requires a sysroot providing libudev for the target; the simplest and most reliable option is to build directly on the Jetson:
cargo build --release
./target/release/lifting-motor --mode serial readSee .cargo/config.toml for the optional cross-compile setup.
- First use: always send position
0first and verify the screw is at the zero point (closest to the chassis/motor side) before any motion. - The motor runs at 24 V with a 700 mm stroke; software clamping is the only protection, there are no physical limit switches.
MIT