GPS
GPS is a satellite-based global navigation system (GNNS) that provides geolocation data and enables positions to be fixed to within a few centimeters (when using differential GPS) or meters.
GPS operates through a network of 32 satellites (28 operational and 4 backups) in orbit around the globe, at 23,200 km, with synchronized paths to cover the entire surface of the Earth. To determine a position, the receiver automatically locates at least three satellites (within the network), from which it receives signals indicating the identification and clock time of each of them. Based on these signals, the apparatus synchronizes the GPS clock and calculates how much time the signals take to reach the device. This way, the distance to the satellite is measured through triangulation (inverse trilateral method). Once the distances are known, the relative position with respect to the three satellites can be easily determined. In addition, if you know the coordinates, or the position of each of these through the signals they broadcast, you can get an accurate position from the measuring point. Precise accuracy is achieved thanks to the GPS clock, which is similar to the atomic clocks on board the satellites.
Configuration
First of all, it is necessary to set a GPS interface. You can do so by using this command:
set interfaces gps gps0
Here are the settings you can set when configuring GPS in your system:
gps-advisor
: Used for geofencing. Works with user-defined zones.
zone
: A zone is a geographical area delimited by two coordinate-defined points. This lets you define zones delimited by two latitude and two longitude values (similar to a rectangle):![]()
For example, to create a zone with two points which have these coordinates:
Position A: 40º36.4740N, 3º43.4280W
Position B: 40º37.0740N, 3º44.0280W
These commands are used:
set interfaces gps gps0 gps-advisor zone 1 latitude 40º36.4740N to 40º37.0740N set interfaces gps gps0 gps-advisor zone 1 longitude 3º43.4280W to 3º44.0280WOnce a zone is defined, you can set different options for each zone:
coverage-fail-state
: State on coverage failure
coverage-fail-state-time
: State timer on coverage failure
initial-state
: Initial state at power ON
initial-state-time
: Initial state timer
latitude
: Latitude range of the zone, for example 45°30.5N. Use º or ° as degrees symbol.
longitude
: Longitude range of the zone, for example 123°45.67E. Use º or ° as degrees symbol.
time-to-false
: Time to validate OUT of zone
time-to-true
: Time to validate IN of zone
disable
: Temporarily disable the GPS interface.
log-level
: Set the log-level for all GPS related logs.
manual-location
: For debugging purposes, it is possible to set a manual latitude and longitude to use instead of the data received by the GPS module.
Geofencing
This feature allows users to define multiple zones and configure advisors to perform specific actions based on whether the device is located inside or outside a designated zone.
set interfaces gps gps0 gps-advisor zone 1 <...>