Browse Source

Add new waypoints based on the UAV airframe type

QGC4.4
Lorenz Meier 11 years ago
parent
commit
d32650bf7d
  1. 3
      src/qgcunittest/MockUAS.h
  2. 26
      src/uas/UAS.cc
  3. 3
      src/uas/UAS.h
  4. 9
      src/uas/UASInterface.h
  5. 10
      src/ui/WaypointList.cc

3
src/qgcunittest/MockUAS.h

@ -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)
{ 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;

26
src/uas/UAS.cc

@ -2178,6 +2178,32 @@ void UAS::readParametersFromStorage() @@ -2178,6 +2178,32 @@ void UAS::readParametersFromStorage()
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
*/

3
src/uas/UAS.h

@ -306,6 +306,9 @@ public: @@ -306,6 +306,9 @@ public:
return nedAttGlobalOffset;
}
bool isRotaryWing();
bool isFixedWing();
#if defined(QGC_PROTOBUF_ENABLED) && defined(QGC_USE_PIXHAWK_MESSAGES)
px::GLOverlay getOverlay()
{

9
src/uas/UASInterface.h

@ -267,6 +267,9 @@ public: @@ -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: @@ -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: @@ -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;

10
src/ui/WaypointList.cc

@ -269,6 +269,16 @@ void WaypointList::addEditable(bool onCurrentPosition) @@ -269,6 +269,16 @@ void WaypointList::addEditable(bool onCurrentPosition)
// Create waypoint with last frame
Waypoint *last = waypoints.last();
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);
MAV_FRAME frame = (MAV_FRAME)last->getFrame();
wp->setFrame(frame);

Loading…
Cancel
Save