Firmware
Classes | Public Types | Public Member Functions | List of all members
Geofence Class Reference
Inheritance diagram for Geofence:
ModuleParams ListNode< ModuleParams *>

Public Types

enum  { GF_ALT_MODE_WGS84 = 0, GF_ALT_MODE_AMSL = 1 }
 
enum  { GF_SOURCE_GLOBALPOS = 0, GF_SOURCE_GPS = 1 }
 

Public Member Functions

 Geofence (Navigator *navigator)
 
 Geofence (const Geofence &)=delete
 
Geofenceoperator= (const Geofence &)=delete
 
void updateFence ()
 update the geofence from dataman. More...
 
bool check (const vehicle_global_position_s &global_position, const vehicle_gps_position_s &gps_position, const home_position_s home_pos, bool home_position_set)
 Return whether the system obeys the geofence. More...
 
bool check (const struct mission_item_s &mission_item)
 Return whether a mission item obeys the geofence. More...
 
int clearDm ()
 
bool valid ()
 
int loadFromFile (const char *filename)
 Load a single inclusion polygon, replacing any already existing polygons. More...
 
bool isEmpty ()
 
int getAltitudeMode ()
 
int getSource ()
 
int getGeofenceAction ()
 
bool isHomeRequired ()
 
void printStatus ()
 print Geofence status to the console
 
- Public Member Functions inherited from ModuleParams
 ModuleParams (ModuleParams *parent)
 
void setParent (ModuleParams *parent)
 Sets the parent module. More...
 
 ModuleParams (const ModuleParams &)=delete
 
ModuleParamsoperator= (const ModuleParams &)=delete
 
 ModuleParams (ModuleParams &&)=delete
 
ModuleParamsoperator= (ModuleParams &&)=delete
 
- Public Member Functions inherited from ListNode< ModuleParams *>
void setSibling (ModuleParams * sibling)
 
const ModuleParamsgetSibling () const
 

Additional Inherited Members

- Protected Member Functions inherited from ModuleParams
virtual void updateParams ()
 Call this method whenever the module gets a parameter change notification. More...
 
virtual void updateParamsImpl ()
 The implementation for this is generated with the macro DEFINE_PARAMETERS()
 
- Protected Attributes inherited from ListNode< ModuleParams *>
ModuleParams_sibling
 

Member Function Documentation

§ check() [1/2]

bool Geofence::check ( const vehicle_global_position_s &  global_position,
const vehicle_gps_position_s &  gps_position,
const home_position_s  home_pos,
bool  home_position_set 
)

Return whether the system obeys the geofence.

Returns
true: system is obeying fence, false: system is violating fence

§ check() [2/2]

bool Geofence::check ( const struct mission_item_s mission_item)

Return whether a mission item obeys the geofence.

Returns
true: system is obeying fence, false: system is violating fence

§ loadFromFile()

int Geofence::loadFromFile ( const char *  filename)

Load a single inclusion polygon, replacing any already existing polygons.

The file has one of the following formats:

  • Decimal Degrees: 0 900 47.475273548913222 8.52672100067138672 47.4608261578541359 8.53414535522460938 47.4613484218861217 8.56444358825683594 47.4830758091035534 8.53470325469970703
  • Degree-Minute-Second: 0 900 DMS -26 -34 -10.4304 151 50 14.5428 DMS -26 -34 -11.8416 151 50 21.8580 DMS -26 -34 -36.5628 151 50 28.1112 DMS -26 -34 -37.1640 151 50 24.1620

Where the first line is min, max altitude in meters AMSL.

§ updateFence()

void Geofence::updateFence ( )

update the geofence from dataman.

It's generally not necessary to call this as it will automatically update when the data is changed.


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