LLUAV WebSocket Protocol Specification

This document describes the wire protocol used by the LLUAV drone firmware's built-in WebSocket server and consumed by the SDK clients.

Transport

Connection Lifecycle

  1. Client opens a WebSocket connection to ws://<host>:53001.
  2. If password protection is enabled, the client must send login <password> before any other command.
  3. The server processes commands in the order received and replies with one JSON response per command.
  4. The server does not push unsolicited messages; every response is triggered by a client command.

Request Format

A request is a single text frame containing a command name optionally followed by arguments:

cmd [args]

Authentication

login <password>

Special passwords: - "1025" โ†’ grants admin privileges. - Any other matching password โ†’ standard user. - "0315" โ†’ explicitly logs the session out.

Response Format

Every command produces exactly one JSON response:

{
  "ret": 0,
  "cmd": 52,
  "ts": 1714233600000,
  ...
}
Field Type Description
ret int Return code. 0 = success. Negative values indicate errors.
cmd int Internal command enum ID (useful for correlation).
ts int64 Response timestamp in milliseconds (Unix epoch).

On success, additional command-specific fields are included (see Command Reference below).

On failure:

{
  "ret": -1,
  "cmd": 52,
  "ts": 1714233600000,
  "msg": "Not allow when vehicle is ARMED!"
}

Special Error Codes

Code Meaning
0 Success
-1 General failure (see msg for details)
-2 Invalid arguments / unsupported command
-3 External system call failed (e.g., sysinfo(), disk I/O)
-100 Unhandled exception during command processing

State & Permission Checks

The server enforces two gate checks before executing a command:

  1. Login Gate: If a password is configured and the session is not logged in, all commands except login return {"ret":-1,"msg":"Login first!"}.
  2. Armed Gate: If the vehicle is armed, commands marked runOnArm=false return {"ret":-1,"msg":"Not allow when vehicle is ARMED!"}.
  3. Lock Gate: If lockMode=true and the user is not admin, commands marked runInLock=false return {"ret":-1,"msg":"CMD not permitted to run in LOCK mode!"}.

Command Reference

State & Telemetry

Command Args Response Fields
state โ€” state: full FSM state JSON
param โ€” param: all parameters JSON
get_param name param: single parameter JSON
ver โ€” version: version info JSON
sysinfo โ€” sysinfo: uptime, RAM, loads
diskusage โ€” available_MB: free space
statics โ€” comm, rosrecord, stat, node_boot_sec
machineid โ€” did: unique hardware ID
hud1 โ€” kfs, uav_pos_enu, extra
lidarpose โ€” lidar_pose: {x,y,z,yaw,roll,pitch,frame,usec}
apron_state โ€” apron_status, apron_comm
mavlink_msgs โ€” mav_msgs: message name โ†’ count map
get_submap_info โ€” kfs: map ID and keyframe count
show_sp โ€” Current setpoint data
show_apguid2 โ€” guid2
showmsg [count] msgs: recent log messages

Flight Control

Command Args Description
takeoff โ€” Initiate takeoff
land โ€” Emergency land
rtl โ€” Return to launch
mrtl โ€” Mission RTL
tether_land โ€” Tethered landing
set_sp_ned x:y:z:yaw Set NED setpoint (meters, radians)
tunnelfly 0 or 1 Enable/disable tunnel fly mode
disarm โ€” Force disarm
sleep โ€” Enter sleep mode
wakeup โ€” Wake from sleep
autosleep_enable 0 or 1 Enable auto-sleep
zyhk h1,h2,... [lx,ly,lyaw] Multi-height hover then land
relocate_pos x,y,z,yaw Relocate position (requires map_locate enabled)

Mission Management

Command Args Description
mission ext_id:path_or_json Submit a mission
plan plan_string Start a flight plan
unlock_plan โ€” Clear plan execution lock
mw_list โ€” List mission waypoints
mw_exec ext_id:wp_ids Execute waypoint IDs (comma-separated)
ai1_mission task_id:mission_file Submit AI1 mission
obs_mission 0 or 1 Toggle obstacle mission live mode
dump_missionresult [ext_id] Dump mission result
dump_missionlist โ€” Dump short mission request list
abort_report [abort_id] Abort/finish mission report
set_taskname name Set current task name

Map Management

Command Args Description
savemap path Save current map
set_maplocate 0 or 1 Enable/disable map localization
set_mappath path Set localization map path
list_maps โ€” List saved maps
rm_map name Remove a saved map

Camera & Recording

Command Args Description
capture โ€” Capture RGB + infrared photo
snapshot โ€” System snapshot
record โ€” Toggle video recording
savebag 0 or 1 Start/stop ROS bag recording
siyi_reboot โ€” Reboot SIYI camera/gimbal
siyi_format โ€” Format SIYI SD card
siyi_center โ€” Center SIYI gimbal
siyi_init โ€” Initialize SIYI (close HDMI)
siyi_downvideo [vid] Download latest video
siyi_sync โ€” Trigger SIYI sync

LED Control

Command Args Description
ledon โ€” Turn LED on
ledoff โ€” Turn LED off
ledenable โ€” Enable LED control
leddisable โ€” Disable LED control
ledpwm pwm Set LED PWM value
led_blink โ€” Start LED blinking

Parameter Management

Command Args Description
set_param name:value Set parameter
get_param name Get single parameter
reset_param โ€” Reset all to defaults
save_param 0 or 1 Save parameters persistently
passwd new_password Change WS login password

Apron (Charging Pad)

Command Args Description
apron_vol voltage Set charging voltage
apron_amp amperage Set charging amperage

System Management

Command Args Description
reboot_node โ€” Reboot flight control node
reboot_ap โ€” Reboot autopilot
reboot_system โ€” Reboot onboard computer
poweroff_system โ€” Power off onboard computer
prepare_poweroff โ€” Flush logs before poweroff
reboot_dlo โ€” Reboot DLO
restart_dlo โ€” Restart DLO pipeline
kill_livox [script] Kill Livox driver

Lidar & Perception

Command Args Description
lidaronoff 0 or 1 Turn lidar on/off
lidarwarn โ€” Get lidar warning zones
utg_get โ€” Trigger UTG thickness read
utg_set speed Set UTG sonic speed

Other

Command Args Description
grabber_ctrl pwm Control grabber PWM
ara8_center โ€” Set ARA8 to center mode
ara8_pitch angle Set ARA8 pitch (-90..90)
cv_test โ€” Trigger CV server test
preflight_check โ€” Run preflight checks
preflight_enable 0 or 1 Enable preflight before takeoff
clear_bags [min_gb] Clear old bag files
clear_images [min_gb] Clear old images
list_imagedir [size] List image directories
rm_imagedir name Remove image directory
test_wp x:y:z Test waypoint reachability
test_listwp file_path Test waypoint list from file
test_notif โ€” Test notification server
savemsg โ€” Save messages to log
bms_setpower 0 or 1 Set BMS power output
bms_setcharge 0 or 1 Set BMS charge state
help โ€” List available commands
admin_lock โ€” Enable admin lock (admin only)
admin_unlock โ€” Disable admin lock (admin only)