Commit 8541598f authored by Anton Babushkin's avatar Anton Babushkin

base_mode/custom mode support

parent 0a28c845
This diff is collapsed.
...@@ -68,7 +68,7 @@ public: ...@@ -68,7 +68,7 @@ public:
/** @brief Get short mode */ /** @brief Get short mode */
const QString& getShortMode() const; const QString& getShortMode() const;
/** @brief Translate from mode id to text */ /** @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 */ /** @brief Translate from mode id to audio text */
static QString getAudioModeTextFor(int id); static QString getAudioModeTextFor(int id);
/** @brief Get the unique system id */ /** @brief Get the unique system id */
...@@ -361,9 +361,8 @@ protected: //COMMENTS FOR TEST UNIT ...@@ -361,9 +361,8 @@ protected: //COMMENTS FOR TEST UNIT
int airframe; ///< The airframe type 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 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 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 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 int status; ///< The current status of the MAV
QString shortModeText; ///< Short textual mode description QString shortModeText; ///< Short textual mode description
QString shortStateText; ///< Short textual state description QString shortStateText; ///< Short textual state description
...@@ -505,8 +504,6 @@ public: ...@@ -505,8 +504,6 @@ public:
float getChargeLevel(); float getChargeLevel();
/** @brief Get the human-readable status message for this code */ /** @brief Get the human-readable status message for this code */
void getStatusForCode(int statusCode, QString& uasState, QString& stateDescription); 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 */ /** @brief Check if vehicle is in autonomous mode */
bool isAuto(); bool isAuto();
/** @brief Check if vehicle is armed */ /** @brief Check if vehicle is armed */
...@@ -833,7 +830,7 @@ public slots: ...@@ -833,7 +830,7 @@ public slots:
void setSelected(); void setSelected();
/** @brief Set current mode of operation, e.g. auto or manual */ /** @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 */ /** @brief Request all parameters */
void requestParameters(); void requestParameters();
......
...@@ -296,7 +296,7 @@ public slots: ...@@ -296,7 +296,7 @@ public slots:
/** @brief Start/continue the current robot action */ /** @brief Start/continue the current robot action */
virtual void go() = 0; virtual void go() = 0;
/** @brief Set the current mode of operation */ /** @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 **/ /** Stops the robot system. If it is an MAV, the robot starts the emergency landing procedure **/
virtual void emergencySTOP() = 0; 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 **/ /** 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 ...@@ -39,6 +39,18 @@ This file is part of the QGROUNDCONTROL project
#include <ui_UASControl.h> #include <ui_UASControl.h>
#include <UASInterface.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 * @brief Widget controlling one MAV
*/ */
...@@ -51,8 +63,10 @@ public: ...@@ -51,8 +63,10 @@ public:
~UASControlWidget(); ~UASControlWidget();
public slots: public slots:
/** @brief Update modes list for selected system */
void updateModesList();
/** @brief Set the system this widget controls */ /** @brief Set the system this widget controls */
void setUAS(UASInterface* uas); void setUAS(UASInterface* uasID);
/** @brief Trigger next context action */ /** @brief Trigger next context action */
void cycleContextButton(); void cycleContextButton();
/** @brief Set the operation mode of the MAV */ /** @brief Set the operation mode of the MAV */
...@@ -60,11 +74,11 @@ public slots: ...@@ -60,11 +74,11 @@ public slots:
/** @brief Transmit the operation mode */ /** @brief Transmit the operation mode */
void transmitMode(); void transmitMode();
/** @brief Update the mode */ /** @brief Update the mode */
void updateMode(int uas,QString mode,QString description); void updateMode(int uasID, QString mode, QString description);
/** @brief Update state */ /** @brief Update state */
void updateState(int state); void updateState(int state);
/** @brief Update internal state machine */ /** @brief Update internal state machine */
void updateStatemachine(); void updateArmText();
signals: signals:
void changedMode(int); void changedMode(int);
...@@ -75,9 +89,11 @@ protected slots: ...@@ -75,9 +89,11 @@ protected slots:
void setBackgroundColor(QColor color); void setBackgroundColor(QColor color);
protected: protected:
int uas; ///< Reference to the current uas int uasID; ///< Reference to the current uas
unsigned int uasMode; ///< Current uas mode struct full_mode_s *modesList; ///< Modes list for the current UAS
bool engineOn; ///< Engine state int modesNum; ///< Number of modes in list for the current UAS
int modeIdx; ///< Current uas mode index
bool armed; ///< Engine state
private: private:
Ui::uasControl ui; 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