#gimbal #serial #storm32 #bgc

app turret

Command-line tool for controlling STorM32 turret controllers via RC Commands protocol

2 releases

0.1.1 Sep 30, 2025
0.1.0 Sep 12, 2025

#191 in Hardware support

Download history 111/week @ 2025-09-10 7/week @ 2025-09-17 73/week @ 2025-09-24 73/week @ 2025-10-01

264 downloads per month

GPL-3.0 license

105KB
2K SLoC

Turret

Command-line tool for STorM32 gimbal controllers. Uses the RC Commands protocol.

Features

  • CLI Mode: Direct command-line control
  • Daemon Mode: Background service with Unix socket IPC and MAVLink
  • Auto-detects STorM32 devices
  • Set gimbal angles, pan modes, standby
  • Query status and firmware info
  • Structured logging with verbosity levels
  • Priority-based command arbitration

Installation

Download Binary

Download the latest release from Releases for your platform.

OR:

From source

With a recent Rust installed:

cargo install turret

Usage

CLI Mode (Direct Control)

# Basic commands (auto-detects device)
turret status
turret set 10.0 0.0 -15.0
turret set -10,0,15          # comma-separated
turret set 1.5:-2.3:0        # colon-separated
turret center
turret version

# Manual device specification
turret --device /dev/ttyUSB0 status

# Verbose output for debugging
turret -v status          # info
turret -vv status         # debug
turret -vvv status        # trace (shows raw protocol)

# Individual axis control
turret pitch 1500         # RC values 700-2300, 0 to recenter
turret roll 0             # recenter roll

# Pan mode and standby
turret pan-mode 3         # PANPANPAN mode
turret standby true

Daemon Mode (Background Service)

# Start daemon (auto-detects device)
turret --daemon

# Or with custom config
turret --daemon --config turret.yaml

# Connect via Unix socket (JSON commands)
echo '{"cmd": "status"}' | nc -U /tmp/turret.sock
echo '{"cmd": "set", "pitch": 10.0, "roll": 0.0, "yaw": -15.0}' | nc -U /tmp/turret.sock
echo '{"cmd": "center"}' | nc -U /tmp/turret.sock

# MAVLink on UDP:14550 - use pymavlink or QGroundControl
# Implements Gimbal Manager protocol

Configuration (turret.yaml):

device:
  path: auto

ipc:
  socket_path: /tmp/turret.sock

mavlink:
  enabled: true
  udp_port: 14550
  sysid: 1
  compid: 154

Priority System: MAVLink autopilot (highest) > GCS > Unix socket > CLI (lowest)

Develop

With a recent Rust installed:

# Clone and build
git clone https://github.com/luofang34/turret
cd turret
cargo build --release

Protocol

Uses STorM32 RC Commands protocol over serial (115200 baud).

Message format: [0xFA][len][cmd][payload][crc16]

Supports: version query, angle setting, status reading, pan modes.

Device Detection

Auto-detects STM32 Virtual COM Port (VID:0x0483, PID:0x5740). Falls back to common patterns: /dev/ttyACM*, /dev/ttyUSB*, COM*

Troubleshooting

  • No device found: Check USB connection and power
  • Permission denied: Add user to dialout group or use sudo
  • Communication errors: Verify 115200 baud rate and cable quality

Dependencies

~11–25MB
~316K SLoC