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
GEOFENCE_READ_REQUESTGEOFENCE_ITEM_COUNTGEOFENCE_ITEM_READ_REQUESTGEOFENCE_ITEMGEOFENCE_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
- When the GCS wants to read the stored geofence from the UAV, it sends a
GEOFENCE_READ_REQUESTto the UAV. - The GCS starts a timeout of a fixed duration.
- If the UAV responds with a
GOEFENCE_ITEM_COUNTmessage before the timeout expires, the operation moves ahead. - If the timeout expires before the UAV can send a response, the GCS retries the operation upto
ntimes before the operation is considered a failure, the error is reported and the UAV continues operations. - If the UAV responded in time, the GCS sends
GEOFENCE_ITEM_READ_REQUESTmessages to fetch the geofence corners one by one. - The GCS starts a timeout of a fixed duration.
- For each
GEOFENCE_ITEM_READ_REQUEST, if the UAV responds with aGEOFENCE_ITEMmessage, the operation moves ahead. If the UAV instead responds with aGEOFENCE_ITEM_INVALIDmessage (indicating that a corner does not exist for the request index), the operation is cancelled. - 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_REQUESTmessage. - 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_REQUESTmessage. - 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.
- 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 Write
Messages
GEOFENCE_WRITE_REQUESTGEOFENCE_WRITE_REQUEST_NACKGEOFENCE_ITEM_READ_REQUESTGEOFENCE_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
- When the GCS wants to update the stored geofence on the UAV, it sends a
GEOFENCE_WRITE_REQUESTmessage (includes the number of corners) to the UAV. - The GCS starts a timeout of a fixed duration.
- If the UAV responds with a
GEOFENCE_ITEM_READ_REQUESTmessage before the timeout expires, the operation moves ahead. - If the timout expires before the UAV can send a response, the GCS retries the operation upto
ntimes, before it is considered a failure. - Each time after the UAV responds with a
GEOFENCE_ITEM_READ_REQUEST, it starts a timeout. - If the GCS responds with a
GEOFENCE_ITEMmessage before the timeout expires, the operation is moves ahead. - 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).