Commit fb7d8413 authored by Lorenz Meier's avatar Lorenz Meier

Merge branch 'new_state_machine_modes' of https://github.com/DrTon/qgroundcontrol into config

parents c5bed07a 8541598f
This diff is collapsed.
......@@ -69,7 +69,7 @@ public:
/** @brief Get short mode */
const QString& getShortMode() const;
/** @brief Translate from mode id to text */
static QString getShortModeTextFor(int id);
static QString getShortModeTextFor(uint8_t base_mode, uint32_t custom_mode, int autopilot);
/** @brief Translate from mode id to audio text */
static QString getAudioModeTextFor(int id);
/** @brief Get the unique system id */
......@@ -362,9 +362,8 @@ protected: //COMMENTS FOR TEST UNIT
int airframe; ///< The airframe type
int autopilot; ///< Type of the Autopilot: -1: None, 0: Generic, 1: PIXHAWK, 2: SLUGS, 3: Ardupilot (up to 15 types), defined in MAV_AUTOPILOT_TYPE ENUM
bool systemIsArmed; ///< If the system is armed
uint8_t mode; ///< The current mode of the MAV
uint8_t base_mode; ///< The current mode of the MAV
uint32_t custom_mode; ///< The current mode of the MAV
uint32_t navMode; ///< The current navigation mode of the MAV
int status; ///< The current status of the MAV
QString shortModeText; ///< Short textual mode description
QString shortStateText; ///< Short textual state description
......@@ -506,8 +505,6 @@ public:
float getChargeLevel();
/** @brief Get the human-readable status message for this code */
void getStatusForCode(int statusCode, QString& uasState, QString& stateDescription);
/** @brief Get the human-readable navigation mode translation for this mode */
QString getNavModeText(int mode);
/** @brief Check if vehicle is in autonomous mode */
bool isAuto();
/** @brief Check if vehicle is armed */
......@@ -834,7 +831,7 @@ public slots:
void setSelected();
/** @brief Set current mode of operation, e.g. auto or manual */
void setMode(int mode);
void setMode(uint8_t newBaseMode, uint32_t newCustomMode);
/** @brief Request all parameters */
void requestParameters();
......
......@@ -295,7 +295,7 @@ public slots:
/** @brief Start/continue the current robot action */
virtual void go() = 0;
/** @brief Set the current mode of operation */
virtual void setMode(int mode) = 0;
virtual void setMode(uint8_t newBaseMode, uint32_t newCustomMode) = 0;
/** Stops the robot system. If it is an MAV, the robot starts the emergency landing procedure **/
virtual void emergencySTOP() = 0;
/** Kills the robot. All systems are immediately shut down (e.g. the main power line is cut). This might lead to a crash **/
......
This diff is collapsed.
......@@ -39,6 +39,18 @@ This file is part of the QGROUNDCONTROL project
#include <ui_UASControl.h>
#include <UASInterface.h>
enum PX4_CUSTOM_MODE {
PX4_CUSTOM_MODE_MANUAL = 1,
PX4_CUSTOM_MODE_SEATBELT,
PX4_CUSTOM_MODE_EASY,
PX4_CUSTOM_MODE_AUTO
};
struct full_mode_s {
uint8_t baseMode;
uint32_t customMode;
};
/**
* @brief Widget controlling one MAV
*/
......@@ -51,8 +63,10 @@ public:
~UASControlWidget();
public slots:
/** @brief Update modes list for selected system */
void updateModesList();
/** @brief Set the system this widget controls */
void setUAS(UASInterface* uas);
void setUAS(UASInterface* uasID);
/** @brief Trigger next context action */
void cycleContextButton();
/** @brief Set the operation mode of the MAV */
......@@ -60,11 +74,11 @@ public slots:
/** @brief Transmit the operation mode */
void transmitMode();
/** @brief Update the mode */
void updateMode(int uas,QString mode,QString description);
void updateMode(int uasID, QString mode, QString description);
/** @brief Update state */
void updateState(int state);
/** @brief Update internal state machine */
void updateStatemachine();
void updateArmText();
signals:
void changedMode(int);
......@@ -75,9 +89,11 @@ protected slots:
void setBackgroundColor(QColor color);
protected:
int uas; ///< Reference to the current uas
unsigned int uasMode; ///< Current uas mode
bool engineOn; ///< Engine state
int uasID; ///< Reference to the current uas
struct full_mode_s *modesList; ///< Modes list for the current UAS
int modesNum; ///< Number of modes in list for the current UAS
int modeIdx; ///< Current uas mode index
bool armed; ///< Engine state
private:
Ui::uasControl ui;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment