QGroundControl
Ground Control Station for MAVLink Drones
Loading...
Searching...
No Matches
GeoFenceManager Class Reference

#include <GeoFenceManager.h>

+ Inheritance diagram for GeoFenceManager:
+ Collaboration diagram for GeoFenceManager:

Public Types

enum  ErrorCode_t {
  InternalError , PolygonTooFewPoints , PolygonTooManyPoints , IncompletePolygonLoad ,
  UnsupportedCommand , BadPolygonItemFormat , InvalidCircleRadius
}
 Error codes returned in error signal. More...
 
- Public Types inherited from PlanManager
enum  ErrorCode_t {
  InternalError , AckTimeoutError , ProtocolError , RequestRangeError ,
  ItemMismatchError , VehicleAckError , MissingRequestsError , MaxRetryExceeded ,
  MissionTypeMismatch
}
 Error codes returned in error signal. More...
 

Signals

void loadComplete (void)
 
void inProgressChanged (bool inProgress)
 
void error (int errorCode, const QString &errorMsg)
 
void removeAllComplete (bool error)
 
void sendComplete (bool error)
 
- Signals inherited from PlanManager
void newMissionItemsAvailable (bool removeAllRequested)
 
void inProgressChanged (bool inProgress)
 
void error (int errorCode, const QString &errorMsg)
 
void currentIndexChanged (int currentIndex)
 
void lastCurrentIndexChanged (int lastCurrentIndex)
 
void progressPctChanged (double progressPercentPct)
 
void removeAllComplete (bool error)
 
void sendComplete (bool error)
 
void resumeMissionReady (void)
 
void resumeMissionUploadFail (void)
 

Public Member Functions

 GeoFenceManager (Vehicle *vehicle)
 
 ~GeoFenceManager ()
 
bool supported (void) const
 
void sendToVehicle (const QGeoCoordinate &breachReturn, QmlObjectListModel &polygons, QmlObjectListModel &circles)
 Signals sendComplete when done.
 
void removeAll (void)
 Signals removeAllComplete when done.
 
bool polygonEnabled (void) const
 
const QList< QGCFencePolygon > & polygons (void)
 
const QList< QGCFenceCircle > & circles (void)
 
const QGeoCoordinate & breachReturnPoint (void) const
 
- Public Member Functions inherited from PlanManager
 PlanManager (Vehicle *vehicle, MAV_MISSION_TYPE planType)
 
 ~PlanManager ()
 
bool inProgress (void) const
 
const QList< MissionItem * > & missionItems (void)
 
int currentIndex (void) const
 Current mission item as reported by MISSION_CURRENT.
 
int lastCurrentIndex (void) const
 Last current mission item reported while in Mission flight mode.
 
void loadFromVehicle (void)
 
void writeMissionItems (const QList< MissionItem * > &missionItems)
 
void removeAll (void)
 

Additional Inherited Members

- Static Public Attributes inherited from PlanManager
static constexpr int _ackTimeoutMilliseconds = 1500
 
static constexpr int _retryTimeoutMilliseconds = 250
 
static constexpr int _maxRetryCount = 5
 
static constexpr int kTestAckTimeoutMs = 50
 Ack timeout used in unit tests (much shorter for faster tests)
 
- Protected Types inherited from PlanManager
enum  AckType_t {
  AckNone , AckMissionCount , AckMissionItem , AckMissionRequest ,
  AckMissionClearAll , AckGuidedItem
}
 
enum  TransactionType_t { TransactionNone , TransactionRead , TransactionWrite , TransactionRemoveAll }
 
- Protected Member Functions inherited from PlanManager
void _startAckTimeout (AckType_t ack)
 
bool _checkForExpectedAck (AckType_t receivedAck)
 
void _readTransactionComplete (void)
 
void _handleMissionCount (const mavlink_message_t &message)
 
void _handleMissionItem (const mavlink_message_t &message)
 
void _handleMissionRequest (const mavlink_message_t &message)
 
void _handleMissionAck (const mavlink_message_t &message)
 
void _requestNextMissionItem (void)
 
void _clearMissionItems (void)
 
void _sendError (ErrorCode_t errorCode, const QString &errorMsg)
 
QString _ackTypeToString (AckType_t ackType)
 
QString _missionResultToString (MAV_MISSION_RESULT result)
 
void _finishTransaction (bool success, bool apmGuidedItemWrite=false)
 
void _requestList (void)
 Internal call to request list of mission items. May be called during a retry sequence.
 
void _writeMissionCount (void)
 This begins the write sequence with the vehicle. This may be called during a retry.
 
void _writeMissionItemsWorker (void)
 
void _clearAndDeleteMissionItems (void)
 
void _clearAndDeleteWriteMissionItems (void)
 
QString _lastMissionReqestString (MAV_MISSION_RESULT result)
 
void _removeAllWorker (void)
 
void _connectToMavlink (void)
 
void _disconnectFromMavlink (void)
 
QString _planTypeString (void)
 
- Protected Attributes inherited from PlanManager
Vehicle_vehicle = nullptr
 
MAV_MISSION_TYPE _planType
 
QTimer * _ackTimeoutTimer = nullptr
 
AckType_t _expectedAck
 
int _retryCount
 
TransactionType_t _transactionInProgress
 
bool _resumeMission
 
QList< int > _itemIndicesToWrite
 List of mission items which still need to be written to vehicle.
 
QList< int > _itemIndicesToRead
 List of mission items which still need to be requested from vehicle.
 
int _lastMissionRequest
 Index of item last requested by MISSION_REQUEST.
 
int _missionItemCountToRead
 Count of all mission items to read.
 
QList< MissionItem * > _missionItems
 Set of mission items on vehicle.
 
QList< MissionItem * > _writeMissionItems
 Set of mission items currently being written to vehicle.
 
int _currentMissionIndex
 
int _lastCurrentIndex
 

Detailed Description

This is the base class for firmware specific geofence managers. A geofence manager is responsible for communicating with the vehicle to set/get geofence settings.

Definition at line 18 of file GeoFenceManager.h.

Member Enumeration Documentation

◆ ErrorCode_t

Error codes returned in error signal.

Enumerator
InternalError 
PolygonTooFewPoints 

Too few points for valid fence polygon.

PolygonTooManyPoints 

Too many points for valid fence polygon.

IncompletePolygonLoad 

Incomplete polygon loaded.

UnsupportedCommand 

Usupported command in mission type.

BadPolygonItemFormat 

Error re-creating polygons from mission items.

InvalidCircleRadius 

Definition at line 45 of file GeoFenceManager.h.

Constructor & Destructor Documentation

◆ GeoFenceManager()

◆ ~GeoFenceManager()

GeoFenceManager::~GeoFenceManager ( )

Definition at line 18 of file GeoFenceManager.cc.

Member Function Documentation

◆ breachReturnPoint()

const QGeoCoordinate & GeoFenceManager::breachReturnPoint ( void  ) const
inline

Definition at line 42 of file GeoFenceManager.h.

◆ circles()

const QList< QGCFenceCircle > & GeoFenceManager::circles ( void  )
inline

Definition at line 41 of file GeoFenceManager.h.

Referenced by sendToVehicle().

◆ error

void GeoFenceManager::error ( int  errorCode,
const QString &  errorMsg 
)
signal

Referenced by GeoFenceManager().

◆ inProgressChanged

void GeoFenceManager::inProgressChanged ( bool  inProgress)
signal

Referenced by GeoFenceManager().

◆ loadComplete

void GeoFenceManager::loadComplete ( void  )
signal

◆ polygonEnabled()

bool GeoFenceManager::polygonEnabled ( void  ) const
inline

Returns true if polygon fence is currently enabled on this vehicle Signal: polygonEnabledChanged

Definition at line 38 of file GeoFenceManager.h.

◆ polygons()

const QList< QGCFencePolygon > & GeoFenceManager::polygons ( void  )
inline

Definition at line 40 of file GeoFenceManager.h.

Referenced by sendToVehicle().

◆ removeAll()

void GeoFenceManager::removeAll ( void  )

Signals removeAllComplete when done.

Definition at line 96 of file GeoFenceManager.cc.

References PlanManager::removeAll().

Referenced by GeoFenceController::removeAllFromVehicle().

◆ removeAllComplete

void GeoFenceManager::removeAllComplete ( bool  error)
signal

Referenced by GeoFenceManager().

◆ sendComplete

void GeoFenceManager::sendComplete ( bool  error)
signal

◆ sendToVehicle()

void GeoFenceManager::sendToVehicle ( const QGeoCoordinate &  breachReturn,
QmlObjectListModel polygons,
QmlObjectListModel circles 
)

Signals sendComplete when done.

List of QGCFenceCircles

Parameters
breachReturnBreach return point
polygonsList of QGCFencePolygons

Definition at line 23 of file GeoFenceManager.cc.

References QGCMapCircle::center(), circles(), QGCMapPolygon::count(), QGCFenceCircle::inclusion(), QGCFencePolygon::inclusion(), QGCMapPolygon::path(), polygons(), QGCMapCircle::radius(), and PlanManager::writeMissionItems().

Referenced by GeoFenceController::sendToVehicle().

◆ supported()

bool GeoFenceManager::supported ( void  ) const

Definition at line 185 of file GeoFenceManager.cc.

References PlanManager::_vehicle, and Vehicle::capabilityBits().


The documentation for this class was generated from the following files: