Commit 6c50f796 authored by Lorenz Meier's avatar Lorenz Meier

Merge pull request #510 from mavlink/wp_radius

Add new waypoints based on the UAV airframe type
parents 898f2c28 56aea879
......@@ -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)
{ 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:
int _systemType;
int _systemId;
......
......@@ -2170,6 +2170,32 @@ void UAS::readParametersFromStorage()
sendMessage(msg);
}
bool UAS::isRotaryWing()
{
switch (type) {
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 (type) {
case MAV_TYPE_FIXED_WING:
return true;
default:
return false;
}
}
/**
* @param rate The update rate in Hz the message should be sent
*/
......
......@@ -306,6 +306,9 @@ public:
return nedAttGlobalOffset;
}
bool isRotaryWing();
bool isFixedWing();
#if defined(QGC_PROTOBUF_ENABLED) && defined(QGC_USE_PIXHAWK_MESSAGES)
px::GLOverlay getOverlay()
{
......
......@@ -267,6 +267,9 @@ public:
*/
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:
/** @brief Set a new name for the system */
......@@ -376,6 +379,11 @@ public slots:
virtual void startGyroscopeCalibration() = 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 */
virtual void setBatterySpecs(const QString& specs) = 0;
/** @brief Get the current battery type and specs */
......@@ -393,7 +401,6 @@ public slots:
/** @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;
protected:
QColor color;
......
......@@ -1063,11 +1063,23 @@ int UASWaypointManager::getFrameRecommendation()
float UASWaypointManager::getAcceptanceRadiusRecommendation()
{
if (waypointsEditable.count() > 0) {
if (waypointsEditable.count() > 0)
{
return waypointsEditable.last()->getAcceptanceRadius();
} else {
return 10.0f;
}
else
{
if (uas->isRotaryWing())
{
return UASInterface::WAYPOINT_RADIUS_DEFAULT_ROTARY_WING;
}
else if (uas->isFixedWing())
{
return UASInterface::WAYPOINT_RADIUS_DEFAULT_FIXED_WING;
}
}
return 10.0f;
}
float UASWaypointManager::getHomeAltitudeOffsetDefault()
......
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