Improve comments in Autopilot

Issue: https://denyspopov.atlassian.net/browse/AZ-14
Type: Improvement
This commit is contained in:
Tuomas Järvinen
2024-05-19 19:49:39 +02:00
parent f0c8a1334a
commit b0b17d7fcc
8 changed files with 131 additions and 105 deletions
+22 -2
View File
@@ -1,7 +1,6 @@
#pragma once
#include <QObject>
#include <memory.h>
#include <mavsdk/mavsdk.h>
@@ -13,7 +12,7 @@
using namespace mavsdk;
typedef enum {
typedef enum {
AZ_DRONE_STATE_DISCONNECTED,
AZ_DRONE_STATE_CONNECTED,
AZ_DRONE_STATE_AUTOPILOT,
@@ -32,7 +31,11 @@ class AzDroneController : public QObject
Q_OBJECT
public:
explicit AzDroneController(AzMission &mission, QObject *parent = nullptr);
// Starts the autopilot.
void start();
// Specify the methods that will be called one at a time to initialise the drone and fly the mission.
bool stateConnect(void);
bool stateAutopilot(void);
bool stateTelemetryModule(void);
@@ -42,15 +45,32 @@ public:
bool stateTakeoff(void);
bool stateFlyMission(void);
// Slots that are called by the emitted Qt signals.
private slots:
// Launches a state machine that progressively initialises the drone without blocking.
void droneStateMachineSlot(void);
// ArduPilot seems to require some delay between calls. This method uses QTimer internally
// to call each new state method with some delay without blocking the main thread.
void delayedStateCallSlot(int ms);
// Slot that is called when the newPosition() signal below is emitted.
void newPositionSlot(Telemetry::Position);
// A mission file contains several action points. This is called
// when the action point is reached. Indexing starts at 1.
void missionIndexChangedSlot(int currentIndex, int totalIndexes);
// Called at the end of the mission. Lands and disarms the drone.
void missionFinishedSlot(void);
// Disarms the drone and exits the application. TODO!! Discuss quitting the application.
void disarmDroneSlot(void);
signals:
// Signal is emitted when Ardupilot sends a new position from the
// MAVSDK thread. Signal goes through the main event loop and is
// captured in the main thread to avoid threading issues.
void newPosition(Telemetry::Position);
private: