Communication Libraries¶
This section covers MAVLink communication, RC protocols, telemetry, and serial interfaces.
MAVLink Protocol¶
GCS_MAVLink (Ground Control Station Communication)¶
Header: libraries/GCS_MAVLink/GCS_MAVLink.h
Description: MAVLink protocol implementation for communication with ground stations (QGroundControl, Mission Planner, etc.).
-
class GCS_MAVLINK¶
MAVLink transport control class.
Subclassed by GCS_MAVLINK_Dummy
Public Functions
- void void queued_param_send ()
Send the next pending parameter, called from deferred message handling code.
-
inline uint16_t txspace() const¶
Check for available transmit space.
Protected Functions
-
void handle_serial_control(const mavlink_message_t &msg)¶
handle a SERIAL_CONTROL message
Private Members
-
AP_HAL::UARTDriver *_port¶
The stream we are communicating over.
-
enum ap_var_type _queued_parameter_type¶
type of the next
Perform queued sending operations
-
uint16_t _queued_parameter_count¶
saved count of
-
struct deferred_message_bucket_t¶
-
struct deferred_message_t¶
-
struct LastRadioStatus¶
-
struct pending_param_reply¶
-
struct pending_param_request¶
-
struct stream_entries¶
Usage Example:
// Send message to ground station
gcs().send_text(MAV_SEVERITY_INFO, "Hello World");
gcs().send_location(location);
gcs().send_heartbeat();
Common Messages:
send_text() - Send text message
send_location() - Send GPS location
send_heartbeat() - Send heartbeat
send_statustext() - Send status text
Related Types:
mavlink_message_t
MAV_SEVERITY
MAV_CMD_*
GCS (GCS Base Class)¶
Header: libraries/GCS_MAVLink/GCS.h
Base GCS class for common GCS functionality.
-
class GCS¶
global GCS object
Subclassed by GCS_Dummy
-
struct statustext_t¶
-
class StatusTextQueue : public ObjectArray<statustext_t>¶
-
struct statustext_t¶
RC Input Protocols¶
AP_RCProtocol (RC Input)¶
Header: libraries/AP_RCProtocol/AP_RCProtocol.h
Description: RC (Radio Control) input protocol handler supporting multiple receiver types.
Supported Protocols:
PPM - Pulse Position Modulation
SBUS - Futaba SBUS
CRSF - Crossfire (ELRS)
DSM - DSM/DSMX (Spektrum)
SRXL - SRXL
ST24 - Spektrum ST24
SBus - SBus (inverted)
Usage Example:
#include <AP_RCProtocol.h>
AP_RCProtocol *rc_protocol = AP_RCProtocol::get_singleton();
// Get detected protocol
AP_RCProtocol::rcprotocol_t proto = rc_protocol->protocol_detected();
const char *name = rc_protocol->protocol_name_from_protocol(proto);
RC_Channel (RC Input Channel)¶
Header: libraries/RC_Channel/RC_Channel.h
Description: RC channel handling for pilot input.
Detailed Documentation:
RC_Channel Detailed Reference - Detailed RC_Channel API Reference
Usage Example:
RC_Channel *rc = RC_Channel::rc_channel(0); // Channel 1
// Get input
float input = rc->norm_input(); // -1 to 1 or 0 to 1
int16_t pwm = rc->get_radio_in(); // 1000-2000
SRV_Channel (Servo Output)¶
Header: libraries/SRV_Channel/SRV_Channel.h
Description: Servo output channel handling.
Usage Example:
SRV_Channel *servo = SRV_Channel::srv_channel(0); // Servo 1
// Set output
servo->set_output_pwm(1500); // Set PWM
Serial Communication¶
AP_SerialManager (Serial Port Manager)¶
Header: libraries/AP_SerialManager/AP_SerialManager.h
Description: Manages serial ports for GPS, telemetry, MAVLink, etc.
Usage Example:
AP_SerialManager *serial = AP_SerialManager::get_singleton();
// Get serial by protocol
AP_HAL::UARTDriver *uart = serial->get_serial(AP_SerialManager::SerialProtocol_MAVLink);
Telemetry¶
AP_RCTelemetry (RC Telemetry)¶
Header: libraries/AP_RCTelemetry/AP_RCTelemetry.h
Description: RC telemetry for reporting RSSI, link quality, etc.
MAVLink Routing¶
MAVLink messages can be routed between different interfaces:
Serial ports
UDP/TCP
CAN bus (DroneCAN)
RSSI reporting
Common MAVLink Messages:
See Also¶
RC_Channel Detailed Reference - Detailed RC Channel documentation
AP_RCProtocol - RC protocol handling
SRV_Channel - Servo output
AP_SerialManager - Serial port management