Communication Libraries

This section covers MAVLink communication, RC protocols, telemetry, and serial interfaces.


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.

See Also

  • RC_Channel Detailed Reference - Detailed RC Channel documentation

  • AP_RCProtocol - RC protocol handling

  • SRV_Channel - Servo output

  • AP_SerialManager - Serial port management