Files
RDC_Simulation/docs/protocol.md
2026-01-04 00:24:46 +00:00

1.4 KiB

Communication Protocol

Message formats for drone operation.

Commands

{
    "thrust": 0.5,
    "pitch": 0.1,
    "roll": -0.2,
    "yaw": 0.0
}
Field Range Effect
thrust ±1.0 Up/down
pitch ±0.5 Forward/back
roll ±0.5 Left/right
yaw ±0.5 Rotation

Telemetry

{
    "imu": {
        "orientation": {"roll": 0.0, "pitch": 0.0, "yaw": 0.0},
        "angular_velocity": {"x": 0.0, "y": 0.0, "z": 0.0}
    },
    "altimeter": {
        "altitude": 5.0,
        "vertical_velocity": -0.1
    },
    "velocity": {"x": 0.0, "y": 0.0, "z": -0.1},
    "landing_pad": {
        "relative_x": 0.5,
        "relative_y": -0.2,
        "distance": 4.5,
        "confidence": 0.85
    },
    "camera": {
        "width": 320,
        "height": 240,
        "image": "<base64 JPEG>"
    }
}

Sensors

Sensor Fields
IMU orientation (roll, pitch, yaw), angular_velocity
Altimeter altitude, vertical_velocity
Velocity x, y, z (m/s)
Landing Pad relative_x, relative_y, distance, confidence
Camera Base64 JPEG image

Decoding Camera

import base64
import cv2
import numpy as np

image_b64 = telemetry['camera']['image']
image_bytes = base64.b64decode(image_b64)
nparr = np.frombuffer(image_bytes, np.uint8)
image = cv2.imdecode(nparr, cv2.IMREAD_COLOR)