Commit d32650bf authored by Lorenz Meier's avatar Lorenz Meier

Add new waypoints based on the UAV airframe type

parent e53822a0
...@@ -168,6 +168,9 @@ public slots: ...@@ -168,6 +168,9 @@ public slots:
virtual void sendHilGps(quint64 time_us, double lat, double lon, double alt, int fix_type, float eph, float epv, float vel, float vn, float ve, float vd, float cog, int satellites) virtual void sendHilGps(quint64 time_us, double lat, double lon, double alt, int fix_type, float eph, float epv, float vel, float vn, float ve, float vd, float cog, int satellites)
{ Q_UNUSED(time_us); Q_UNUSED(lat); Q_UNUSED(lon); Q_UNUSED(alt); Q_UNUSED(fix_type); Q_UNUSED(eph); Q_UNUSED(epv); Q_UNUSED(vel); Q_UNUSED(vn); Q_UNUSED(ve); Q_UNUSED(vd); Q_UNUSED(cog); Q_UNUSED(satellites); Q_ASSERT(false); }; { Q_UNUSED(time_us); Q_UNUSED(lat); Q_UNUSED(lon); Q_UNUSED(alt); Q_UNUSED(fix_type); Q_UNUSED(eph); Q_UNUSED(epv); Q_UNUSED(vel); Q_UNUSED(vn); Q_UNUSED(ve); Q_UNUSED(vd); Q_UNUSED(cog); Q_UNUSED(satellites); Q_ASSERT(false); };
virtual bool isRotaryWing() { Q_ASSERT(false); return false; }
virtual bool isFixedWing() { Q_ASSERT(false); return false; }
private: private:
int _systemType; int _systemType;
int _systemId; int _systemId;
......
...@@ -2178,6 +2178,32 @@ void UAS::readParametersFromStorage() ...@@ -2178,6 +2178,32 @@ void UAS::readParametersFromStorage()
sendMessage(msg); sendMessage(msg);
} }
bool UAS::isRotaryWing()
{
switch (airframe) {
case MAV_TYPE_QUADROTOR:
/* fallthrough */
case MAV_TYPE_COAXIAL:
case MAV_TYPE_HELICOPTER:
case MAV_TYPE_HEXAROTOR:
case MAV_TYPE_OCTOROTOR:
case MAV_TYPE_TRICOPTER:
return true;
default:
return false;
}
}
bool UAS::isFixedWing()
{
switch (airframe) {
case MAV_TYPE_FIXED_WING:
return true;
default:
return false;
}
}
/** /**
* @param rate The update rate in Hz the message should be sent * @param rate The update rate in Hz the message should be sent
*/ */
......
...@@ -306,6 +306,9 @@ public: ...@@ -306,6 +306,9 @@ public:
return nedAttGlobalOffset; return nedAttGlobalOffset;
} }
bool isRotaryWing();
bool isFixedWing();
#if defined(QGC_PROTOBUF_ENABLED) && defined(QGC_USE_PIXHAWK_MESSAGES) #if defined(QGC_PROTOBUF_ENABLED) && defined(QGC_USE_PIXHAWK_MESSAGES)
px::GLOverlay getOverlay() px::GLOverlay getOverlay()
{ {
......
...@@ -267,6 +267,9 @@ public: ...@@ -267,6 +267,9 @@ public:
*/ */
virtual QList<QAction*> getActions() const = 0; virtual QList<QAction*> getActions() const = 0;
static const unsigned int WAYPOINT_RADIUS_DEFAULT_FIXED_WING = 25;
static const unsigned int WAYPOINT_RADIUS_DEFAULT_ROTARY_WING = 5;
public slots: public slots:
/** @brief Set a new name for the system */ /** @brief Set a new name for the system */
...@@ -376,6 +379,11 @@ public slots: ...@@ -376,6 +379,11 @@ public slots:
virtual void startGyroscopeCalibration() = 0; virtual void startGyroscopeCalibration() = 0;
virtual void startPressureCalibration() = 0; virtual void startPressureCalibration() = 0;
/** @brief Return if this a rotary wing */
virtual bool isRotaryWing() = 0;
/** @brief Return if this is a fixed wing */
virtual bool isFixedWing() = 0;
/** @brief Set the current battery type and voltages */ /** @brief Set the current battery type and voltages */
virtual void setBatterySpecs(const QString& specs) = 0; virtual void setBatterySpecs(const QString& specs) = 0;
/** @brief Get the current battery type and specs */ /** @brief Get the current battery type and specs */
...@@ -393,7 +401,6 @@ public slots: ...@@ -393,7 +401,6 @@ public slots:
/** @brief Send raw GPS for sensor HIL */ /** @brief Send raw GPS for sensor HIL */
virtual void sendHilGps(quint64 time_us, double lat, double lon, double alt, int fix_type, float eph, float epv, float vel, float vn, float ve, float vd, float cog, int satellites) = 0; virtual void sendHilGps(quint64 time_us, double lat, double lon, double alt, int fix_type, float eph, float epv, float vel, float vn, float ve, float vd, float cog, int satellites) = 0;
protected: protected:
QColor color; QColor color;
......
...@@ -269,6 +269,16 @@ void WaypointList::addEditable(bool onCurrentPosition) ...@@ -269,6 +269,16 @@ void WaypointList::addEditable(bool onCurrentPosition)
// Create waypoint with last frame // Create waypoint with last frame
Waypoint *last = waypoints.last(); Waypoint *last = waypoints.last();
wp = WPM->createWaypoint(); wp = WPM->createWaypoint();
if (uas)
{
if (uas->isRotaryWing()) {
wp->setAcceptanceRadius(UASInterface::WAYPOINT_RADIUS_DEFAULT_FIXED_WING);
}
else if (uas->isFixedWing())
{
wp->setAcceptanceRadius(UASInterface::WAYPOINT_RADIUS_DEFAULT_ROTARY_WING);
}
}
// wp->blockSignals(true); // wp->blockSignals(true);
MAV_FRAME frame = (MAV_FRAME)last->getFrame(); MAV_FRAME frame = (MAV_FRAME)last->getFrame();
wp->setFrame(frame); wp->setFrame(frame);
......
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