preflight_calibration

PX4 capability domain: system-control. PX4 mapping: MAV_CMD_PREFLIGHT_CALIBRATION. Trigger calibration. This command will be only accepted if in pre-flight mode. Except for Temperature Calibration, only one sensor should be set in a single message and all others should be zero.

Request Params

vendor
string
必填
Fixed value px4
device_id
string
必填
Target PX4 device ID
command_type
string
必填
Fixed value preflight_calibration
idempotency_key
string
必填
Idempotency key; repeated requests return the same command
timeout_seconds
integer
Timeout in seconds, range 0~300
payload
object
必填
Typed request payload for this command. Field names are generated from PX4 MAVLink XML labels, but callers do not send raw param1..param7 fields.
payload.gyro_temperature
number
Meaning: Gyro Temperature; maps to MAVLink parameter 1 in the PX4 frame.
payload.magnetometer
number
Meaning: Magnetometer, enum PREFLIGHT_CALIBRATION_MAGNETOMETER; maps to MAVLink parameter 2 in the PX4 frame.
payload.ground_pressure
number
Meaning: Ground Pressure, enum MAV_BOOL; maps to MAVLink parameter 3 in the PX4 frame.
payload.remote_control
number
Meaning: Remote Control; maps to MAVLink parameter 4 in the PX4 frame.
payload.accelerometer
number
Meaning: Accelerometer, enum PREFLIGHT_CALIBRATION_ACCELEROMETER; maps to MAVLink parameter 5 in the PX4 frame.
payload.compmot_or_airspeed
number
Meaning: Compmot or Airspeed; maps to MAVLink parameter 6 in the PX4 frame.
payload.esc_or_baro
number
Meaning: ESC or Baro; maps to MAVLink parameter 7 in the PX4 frame.

PX4 Frame Mapping

  • MAVLink command: MAV_CMD_PREFLIGHT_CALIBRATION
  • Command ID: 241
  • Default transport: COMMAND_LONG
  • Source XML: common.xml
  • Completion: COMMAND_ACK
  • Guard: real PX4 downlink is disabled by default; guarded mode requires explicit authorization and a ready transport.

Create Response

command_id
string
Platform command ID, used for follow-up queries
status
string
Acceptance status: ACCEPTED
accepted_at
string(datetime)
Command acceptance time (UTC)

Query Response

command_id
string
Platform command ID
status
string
Execution status: ACCEPTED / DELIVERED / SUCCEEDED / FAILED / TIMED_OUT / UNMATCHED_RESPONSE
vendor
string
Vendor identifier; fixed value px4
device_id
string
Target PX4 device ID
command_type
string
PX4 command type
response_code
string
Mapped COMMAND_ACK.result value
response_message
string
PX4 acknowledgement summary
vendor_response
object
Raw PX4 acknowledgement summary, including MAVLink command ID and transport

PX4 ACK Mapping

After sending the frame, the PX4 agent waits for COMMAND_ACK and correlates the response by command id. Disabled mode sends no frame and completes with a rejected lifecycle result.
curl -X POST "/api/v1/open/downlink/commands" \
  -H "Content-Type: application/json" \
  -H "X-Api-Id: YOUR_API_ID" \
  -H "X-Api-Timestamp: YOUR_UNIX_SECONDS" \
  -H "X-Api-Nonce: YOUR_NONCE" \
  -H "X-Api-Signature: YOUR_SIGNATURE" \
  -d "{\"vendor\":\"px4\",\"device_id\":\"px4-real-1\",\"command_type\":\"preflight_calibration\",\"payload\":{\"gyro_temperature\":0,\"magnetometer\":0,\"ground_pressure\":0,\"remote_control\":0,\"accelerometer\":0,\"compmot_or_airspeed\":0,\"esc_or_baro\":0},\"idempotency_key\":\"req-preflight_calibration-001\",\"timeout_seconds\":30}"

curl "/api/v1/open/downlink/commands/8cdb5bf3-8902-c5f7-f9aa-dc7fa0af1de0"
{
  "command_id": "8cdb5bf3-8902-c5f7-f9aa-dc7fa0af1de0",
  "status": "ACCEPTED",
  "accepted_at": "2026-06-15T00:00:00Z"
}