|
Arduino Mavlink
|
A simple MAVLink drone controller for Arduino/ESP32. More...
#include <MavlinkController.h>

Public Types | |
| typedef bool(* | MessageCallback) (MavlinkController &, mavlink_message_t &) |
| Callback type for MAVLink message handling. | |
Public Member Functions | |
| MavlinkController (Stream *str=nullptr, ParameterStore *parameters=nullptr) | |
| Constructor with optional Stream and ParameterStore. | |
| MavlinkController (Stream &str) | |
| Constructor with Stream reference. | |
| virtual | ~MavlinkController () |
| Destructor. | |
| virtual float | getValue (uint16_t id) |
| Get a parameter value by id. | |
| virtual void | setValue (uint16_t id, float value) |
| Set a parameter value by id. | |
| virtual void | loop () |
| Main loop: processes MAVLink messages and telemetry. | |
| virtual void | reconnect (Stream *str) |
| Assign a new Stream for MAVLink communication. | |
| bool | isArmed () |
| Returns true if the drone is armed. | |
| void | setMessageCallback (MessageCallback cb) |
| Set the callback for custom MAVLink message handling. | |
| bool | setSystemId (int id) |
| Defines the system ID for incoming MAVLink messages (1-255) | |
| int | getSystemId () const |
| Get the current system ID. | |
Protected Member Functions | |
| virtual size_t | transmitMessage (mavlink_message_t *mvl_msg_ptr) |
| Transmit a MAVLink message, returns bytes written or 0 on error. | |
| void | transmitAck (uint16_t command, bool accepted) |
| trasmit a command acknowledgment message | |
| virtual void | handleManualControl (mavlink_message_t *mvl_msg_ptr) |
| virtual void | handleParamRequestList (mavlink_message_t *mvl_msg_ptr) |
| virtual void | handleCommandLong (mavlink_message_t *mvl_msg_ptr) |
| virtual void | handleMissionRequestList (mavlink_message_t *mvl_msg_ptr) |
| virtual void | processRequest () |
| virtual void | processHeartbeat () |
| virtual void | processStat () |
| virtual void | processStatSystem () |
| virtual void | processStatGPS () |
| virtual void | processStatRadioStatus () |
Protected Attributes | |
| int | mavlink_system_id |
| MessageCallback | messageCallback = nullptr |
| Stream * | stream = nullptr |
| ParameterStore * | parameterStore = nullptr |
| bool | releaseParameterStore = false |
| mavlink_message_t | mvl_tx_message |
| mavlink_message_t | mvl_rx_message |
| mavlink_status_t | mvl_rx_status |
| const uint8_t | mvl_compid = 1 |
| const uint8_t | mvl_sysid = 1 |
| const uint8_t | mvl_chan = MAVLINK_COMM_0 |
| const uint32_t | hb_interval = 1000 |
| uint32_t | t_last_hb = 0 |
| const uint32_t | sys_stat_interval = 100 |
| uint32_t | t_last_sys_stat = 0 |
| int16_t | sys_stat_count = 0 |
| uint8_t | mvl_armed = 0 |
| uint8_t | mvl_packet_received = 0 |
| uint32_t | timestamp = 0 |
| bool | camera_active = false |
Static Protected Attributes | |
| static constexpr size_t | TX_BUFFER_SIZE = 512 |
A simple MAVLink drone controller for Arduino/ESP32.
This class implements a minimal MAVLink drone interface, handling message reception, parameter storage, and basic telemetry/command processing. It is based on Dan Zimmerman's barebones_MAVLink example and provides hooks for custom parameter storage and logging.
Features:
Usage:
| typedef bool(* MessageCallback) (MavlinkController &, mavlink_message_t &) |
Callback type for MAVLink message handling.
|
inline |
Constructor with optional Stream and ParameterStore.
|
inline |
Constructor with Stream reference.
|
inlinevirtual |
Destructor.
|
inline |
Get the current system ID.
|
inlinevirtual |
Get a parameter value by id.
|
inlineprotectedvirtual |
|
inlineprotectedvirtual |
|
inlineprotectedvirtual |
|
inlineprotectedvirtual |
|
inline |
Returns true if the drone is armed.
|
inlinevirtual |
Main loop: processes MAVLink messages and telemetry.
|
inlineprotectedvirtual |
|
inlineprotectedvirtual |
|
inlineprotectedvirtual |
|
inlineprotectedvirtual |
|
inlineprotectedvirtual |
|
inlineprotectedvirtual |
|
inlinevirtual |
Assign a new Stream for MAVLink communication.
|
inline |
Set the callback for custom MAVLink message handling.
|
inline |
Defines the system ID for incoming MAVLink messages (1-255)
|
inlinevirtual |
Set a parameter value by id.
|
inlineprotected |
trasmit a command acknowledgment message
|
inlineprotectedvirtual |
Transmit a MAVLink message, returns bytes written or 0 on error.
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
staticconstexprprotected |