Skip to main content

Geofence

The geofence subprotocols allow the GCS to read and update the stored geofence on the UAV.

Geofence Read

The geofence read microservice allows the GCS to read the geofence from the UAV, either initiated by the Operator or when a connection is established.

Messages

  1. GEOFENCE_READ_REQUEST
  2. GEOFENCE_ITEM_COUNT
  3. GEOFENCE_ITEM_READ_REQUEST
  4. GEOFENCE_ITEM
  5. GEOFENCE_ITEM_INVALID

Sequence

sequenceDiagram
participant GCS
participant UAV

loop n

GCS->>UAV: GEOFENCE_READ_REQUEST
GCS->>GCS: Start timeout

alt success

UAV-->>GCS: GEOFENCE_ITEM_COUNT

loop item_count

GCS->>UAV: GEOFENCE_ITEM_READ_REQUEST
GCS->>GCS: Start timeout

alt success
UAV->>GCS: GEOFENCE_ITEM<br />/GEOFENCE_ITEM_INVALID
else failure
GCS->>GCS: Timeout expires
end
end

else failure
GCS->>GCS: Timeout expires
end
end
  1. When the GCS wants to read the stored geofence from the UAV, it sends a GEOFENCE_READ_REQUEST to the UAV.
  2. The GCS starts a timeout of a fixed duration.
  3. If the UAV responds with a GOEFENCE_ITEM_COUNT message before the timeout expires, the operation moves ahead.
  4. If the timeout expires before the UAV can send a response, the GCS retries the operation upto n times before the operation is considered a failure, the error is reported and the UAV continues operations.
  5. If the UAV responded in time, the GCS sends GEOFENCE_ITEM_READ_REQUEST messages to fetch the geofence corners one by one.
  6. The GCS starts a timeout of a fixed duration.
  7. For each GEOFENCE_ITEM_READ_REQUEST, if the UAV responds with a GEOFENCE_ITEM message, the operation moves ahead. If the UAV instead responds with a GEOFENCE_ITEM_INVALID message (indicating that a corner does not exist for the request index), the operation is cancelled.
  8. If the timeout expires before the UAV can send a response, the entire operation is cancelled.

Notes

  • The geofence in-use by the GCS is not updated before the entire set of corners is received from the UAV. If the operation fails midway, the error is reported and the previous geofence continues to be displayed.
  • If reading a single geofence corner fails, the entire operation is cancelled (this is not obvious from the nested loop structure).
  • The transmission of the corner count and individual corners are kept stateless for easy error handling and recovery -
    • If the UAV does not respond with the count/GCS does not receive the count, the GCS retries the operation without affecting the subprotocol state of the UAV, since the count is sent exclusively as a response to the GEOFENCE_READ_REQUEST message.
    • If the UAV does not respond with a specific geofence corner/GCS does not receive the corner, the GCS retries the operation without affecting the subprotocol state of the UAV, since each geofence corner is sent exclusively as a response to the GEOFENCE_ITEM_READ_REQUEST message.
    • A failure at any stage is immediately made known to the Operator by the GCS so that operations can be ceased, without leaving the UAV in an invalid state.

Geofence Write

Messages

  1. GEOFENCE_WRITE_REQUEST
  2. GEOFENCE_WRITE_REQUEST_NACK
  3. GEOFENCE_ITEM_READ_REQUEST
  4. GEOFENCE_ITEM

Sequence

sequenceDiagram
participant GCS
participant UAV

loop n

GCS->>UAV: GEOFENCE_WRITE_REQUEST
GCS->>GCS: Start timeout

alt sucess

loop item_count

UAV->>GCS: GEOFENCE_ITEM_READ_REQUEST
UAV->>UAV: Start timeout

alt success
GCS-->>UAV: GEOFENCE_ITEM
else failure
UAV->>UAV: Timeout expires
end
end

else cancelled
UAV-->>GCS: GEOFENCE_WRITE_REQUEST_NACK
else failure
GCS->>GCS: Timeout expires
end
end
  1. When the GCS wants to update the stored geofence on the UAV, it sends a GEOFENCE_WRITE_REQUEST message (includes the number of corners) to the UAV.
  2. The GCS starts a timeout of a fixed duration.
  3. If the UAV responds with a GEOFENCE_ITEM_READ_REQUEST message before the timeout expires, the operation moves ahead.
  4. If the timout expires before the UAV can send a response, the GCS retries the operation upto n times, before it is considered a failure.
  5. Each time after the UAV responds with a GEOFENCE_ITEM_READ_REQUEST, it starts a timeout.
  6. If the GCS responds with a GEOFENCE_ITEM message before the timeout expires, the operation is moves ahead.
  7. If the timeout expires before GCS can send a response, the entire operation is cancelled.

Notes

  • The geofence in-use by the UAV is not updated before the entire set of corners is received from the GCS. If the operation fails midway, the error is reported and the previous geofence continues to be displayed.
  • If reading a single geofence corner fails, the entire operation is cancelled (this is not obvious from the nested loop structure).