|
|
|
|
|
|
|
## Received data from a external surveillance station
|
|
|
|
|
|
|
|
1. Connecting via websocket to wss://{env}-usim.airus-suite.com/ws2/ and send the authorization json:
|
|
|
|
|
|
|
|
````json
|
|
|
|
{
|
|
|
|
"type": "auth",
|
|
|
|
"data": {
|
|
|
|
"token": "{token}"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
````
|
|
|
|
|
|
|
|
* token: access_token string obtained through the valid user: [Get token in airus](get_token_in_airus)
|
|
|
|
|
|
|
|
|
|
|
|
This will answer us:
|
|
|
|
|
|
|
|
```json
|
|
|
|
{"authenticated": true}
|
|
|
|
```
|
|
|
|
|
|
|
|
Finally we will send a specific json for dsdp type requests:
|
|
|
|
|
|
|
|
````json
|
|
|
|
|
|
|
|
{
|
|
|
|
'type': 'dsdp',
|
|
|
|
'data': {
|
|
|
|
'area': {
|
|
|
|
'type': 'Feature',
|
|
|
|
'geometry': {
|
|
|
|
'type': 'Polygon',
|
|
|
|
'coordinates': [{coordinates}]
|
|
|
|
}
|
|
|
|
},
|
|
|
|
'id': "{id_dsdp}",
|
|
|
|
'period': 1
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
````
|
|
|
|
|
|
|
|
* coordinates: coordinates in geojson format
|
|
|
|
* id_dsdp: sdp_id string obtained through the valid user: [Get vigilant in dsdp](get_vigilant)
|
|
|
|
|
|
|
|
2. Example, it's important to install the following package for websocket connection https://github.com/websocket-client/websocket-client, tested with 1.7.0 version :
|
|
|
|
|
|
|
|
```python
|
|
|
|
|
|
|
|
|
|
|
|
from websocket import create_connection, _exceptions
|
|
|
|
import time
|
|
|
|
import json
|
|
|
|
import requests
|
|
|
|
|
|
|
|
# Login
|
|
|
|
username = "user"
|
|
|
|
password = "password"
|
|
|
|
url = "https://dev-afim.airus-suite.com//api/get_token/?username=" + username + "&password=" + password
|
|
|
|
|
|
|
|
# Make the GET request to retrieve the token
|
|
|
|
response = requests.get(url)
|
|
|
|
|
|
|
|
# Check if the request was successful (status code 200)
|
|
|
|
if response.status_code == 200:
|
|
|
|
print("Response Data:")
|
|
|
|
token = response.content.decode('utf-8')
|
|
|
|
print(token)
|
|
|
|
else:
|
|
|
|
# Print an error message if the request was not successful
|
|
|
|
print("Error: Unable to retrieve data. Status code:", response.status_code)
|
|
|
|
|
|
|
|
url = f"wss://dev-usim.airus-suite.com/ws2/"
|
|
|
|
ws = create_connection(url)
|
|
|
|
handshake_auth = {
|
|
|
|
'type': 'auth',
|
|
|
|
'data': {
|
|
|
|
'token': token
|
|
|
|
}
|
|
|
|
}
|
|
|
|
# dsdp_id identifies the tracking instance, changes its value depending on the environment
|
|
|
|
# DEV wss://dev-usim.airus-suite.com/ws2/ or PRE wss://pre-usim.airus-suite.com/ws2/
|
|
|
|
# dsdp_id_dev = "8b0855b9-196c-4bc4-b949-8668742efb07"
|
|
|
|
# dsdp_id_pre = "9909ae9c-ccb9-4bbd-af96-5c2a3f9b374e"
|
|
|
|
|
|
|
|
dsdp_id = "8b0855b9-196c-4bc4-b949-8668742efb07"
|
|
|
|
handshake_dsdp = {
|
|
|
|
'type': 'dsdp',
|
|
|
|
'data': {
|
|
|
|
'area': {
|
|
|
|
'type': 'Feature',
|
|
|
|
'geometry': {
|
|
|
|
'type': 'Polygon',
|
|
|
|
'coordinates': [
|
|
|
|
[
|
|
|
|
[
|
|
|
|
-10.5029296875,
|
|
|
|
44.402391829093915
|
|
|
|
],
|
|
|
|
[
|
|
|
|
-11.337890625,
|
|
|
|
40.212440718286466
|
|
|
|
],
|
|
|
|
[
|
|
|
|
-4.130859375,
|
|
|
|
39.57182223734374
|
|
|
|
],
|
|
|
|
[
|
|
|
|
-0.17578125,
|
|
|
|
43.48481212891603
|
|
|
|
],
|
|
|
|
[
|
|
|
|
-10.5029296875,
|
|
|
|
44.402391829093915
|
|
|
|
]
|
|
|
|
]
|
|
|
|
],
|
|
|
|
'properties': {
|
|
|
|
'zoom': 7
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
'id': dsdp_id,
|
|
|
|
'period': 1
|
|
|
|
}
|
|
|
|
}
|
|
|
|
ws.send(json.dumps(handshake_auth))
|
|
|
|
print(ws.recv())
|
|
|
|
ws.send(json.dumps(handshake_dsdp))
|
|
|
|
print ("recibimos")
|
|
|
|
for numero in range(1, 10):
|
|
|
|
print(ws.recv())
|
|
|
|
time.sleep(1)
|
|
|
|
ws.close()
|
|
|
|
|
|
|
|
|
|
|
|
````
|
|
|
|
|
|
|
|
3. Track Json example:
|
|
|
|
|
|
|
|
````json
|
|
|
|
|
|
|
|
{
|
|
|
|
"session_id": null,
|
|
|
|
"timestamp": 1707914030,
|
|
|
|
"uuid": "fad129b7-49e7-42a9-bac0-71fb982ca587",
|
|
|
|
"data_items": {
|
|
|
|
"supplemental": {
|
|
|
|
"downlinked": {
|
|
|
|
"weather": {
|
|
|
|
"toa": 0.0,
|
|
|
|
"temperature": 15,
|
|
|
|
"wind": {
|
|
|
|
"toa": 0.0,
|
|
|
|
"en_components": {
|
|
|
|
"east": 0.0,
|
|
|
|
"north": 0.0
|
|
|
|
},
|
|
|
|
"polar_wind_components": {
|
|
|
|
"speed": 0.0,
|
|
|
|
"direction": 0.0
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"gcs": {
|
|
|
|
"location_data": {
|
|
|
|
"position": {
|
|
|
|
"longitude": -1,
|
|
|
|
"latitude": -1,
|
|
|
|
"altitude": -1
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"aircraft": {
|
|
|
|
"id": "4d11bb2e-c536-4a11-92d4-35e30cfb3f20",
|
|
|
|
"name": "",
|
|
|
|
"pilot": {
|
|
|
|
"id": "6e9acccf-d313-4fbc-82bb-711e692e729f"
|
|
|
|
},
|
|
|
|
"aircraft_type": {
|
|
|
|
"id": "89486f21-e6f9-4281-8373-2e3c94248836",
|
|
|
|
"name": "",
|
|
|
|
"type": "MULTIROTOR"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"route": {
|
|
|
|
"take_off_data": {
|
|
|
|
"location_data": {
|
|
|
|
"position": {
|
|
|
|
"latitude": 43.70603,
|
|
|
|
"longitude": -7.47552
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"emergency": {}
|
|
|
|
},
|
|
|
|
"contingency_trajectory": {
|
|
|
|
"type": "FeatureCollection",
|
|
|
|
"features": []
|
|
|
|
},
|
|
|
|
"cuav_threat": {
|
|
|
|
"threat": 0.0
|
|
|
|
},
|
|
|
|
"identification": {
|
|
|
|
"remote_identification": "f8bda647-4941-4915-bad6-cd22f2db5ec1",
|
|
|
|
"target_address_24": 0,
|
|
|
|
"drone_serial": "M600SCR",
|
|
|
|
"uas_operator_reg_num": 0.0,
|
|
|
|
"operator_uuid": null,
|
|
|
|
"observing_surveillance_stations": [
|
|
|
|
{
|
|
|
|
"uuid": "GCS_DEFAULT",
|
|
|
|
"type": "TELEMETRY",
|
|
|
|
"period": 1,
|
|
|
|
"time_last_observation": 1707914031.946017,
|
|
|
|
"tracked": false,
|
|
|
|
"track_number": null,
|
|
|
|
"aircraft_local_uuid": null
|
|
|
|
}
|
|
|
|
],
|
|
|
|
"utm_transponder_uuid": null,
|
|
|
|
"pilot_uuid": null
|
|
|
|
},
|
|
|
|
"kinematic": {
|
|
|
|
"statistics": {
|
|
|
|
"total_flight_time": 0.0
|
|
|
|
},
|
|
|
|
"state_vector": {
|
|
|
|
"attitude": {
|
|
|
|
"yaw": 0
|
|
|
|
},
|
|
|
|
"toa": 0.0,
|
|
|
|
"horizontal": {
|
|
|
|
"mean": {
|
|
|
|
"position": {
|
|
|
|
"geodetic": {
|
|
|
|
"longitude": -7.47552,
|
|
|
|
"latitude": 43.70613
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"velocity": {
|
|
|
|
"polar": {
|
|
|
|
"ground_speed": 0.0029238401530398705,
|
|
|
|
"course": -6.651099738702847
|
|
|
|
},
|
|
|
|
"en": {
|
|
|
|
"east": -0.00033864809240948066,
|
|
|
|
"north": 0.0029041623077981769
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"acceleration": {
|
|
|
|
"apa": {
|
|
|
|
"longitudinal": -1,
|
|
|
|
"lateral": -1
|
|
|
|
},
|
|
|
|
"en": {
|
|
|
|
"east": 0.0,
|
|
|
|
"north": 0.0
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"error": {
|
|
|
|
"covariance": {
|
|
|
|
"pos_e_pos_e": 0.0,
|
|
|
|
"pos_n_pos_n": 0.0,
|
|
|
|
"vel_e_vel_e": 0.0,
|
|
|
|
"vel_n_vel_n": 0.0,
|
|
|
|
"acc_e_acc_e": 0.0,
|
|
|
|
"acc_n_acc_n": 0.0,
|
|
|
|
"pos_e_pos_n": 0.0,
|
|
|
|
"pos_e_vel_e": 0.0,
|
|
|
|
"pos_e_vel_n": 0.0,
|
|
|
|
"pos_e_acc_e": 0.0,
|
|
|
|
"pos_e_acc_n": 0.0,
|
|
|
|
"pos_n_vel_e": 0.0,
|
|
|
|
"pos_n_vel_n": 0.0,
|
|
|
|
"pos_n_acc_e": 0.0,
|
|
|
|
"pos_n_acc_n": 0.0,
|
|
|
|
"vel_e_vel_n": 0.0,
|
|
|
|
"vel_e_acc_e": 0.0,
|
|
|
|
"vel_e_acc_n": 0.0,
|
|
|
|
"vel_n_acc_e": 0.0,
|
|
|
|
"vel_n_acc_n": 0.0,
|
|
|
|
"acc_e_acc_n": 0.0
|
|
|
|
},
|
|
|
|
"outliers": {
|
|
|
|
"probability": 0.0,
|
|
|
|
"scale": true,
|
|
|
|
"degrees_freedom_t_student": 2.0
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"vertical": {
|
|
|
|
"mean": {
|
|
|
|
"position": {
|
|
|
|
"altitude_agl": 10,
|
|
|
|
"alt_source": [
|
|
|
|
"alt_agl"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
"velocity": {
|
|
|
|
"u": {
|
|
|
|
"up": 0.0
|
|
|
|
},
|
|
|
|
"polar": {
|
|
|
|
"vertical_speed": 0.0
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"acceleration": {
|
|
|
|
"u": {
|
|
|
|
"up": 0.0
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"error": {
|
|
|
|
"covariance": {
|
|
|
|
"pos_u_pos_u": 0.0,
|
|
|
|
"vel_u_vel_u": 0.0,
|
|
|
|
"acc_u_acc_u": 0.0,
|
|
|
|
"pos_u_vel_u": 0.0,
|
|
|
|
"pos_u_acc_u": 0.0,
|
|
|
|
"vel_u_acc_u": 0.0
|
|
|
|
},
|
|
|
|
"outliers": {
|
|
|
|
"probability": 0.0,
|
|
|
|
"scale": true,
|
|
|
|
"degrees_freedom_t_student": 2.0
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"flight_plan_data": {
|
|
|
|
"flight_plan_uuid": "",
|
|
|
|
"flight_plan_priority": false
|
|
|
|
},
|
|
|
|
"conformance_info": {},
|
|
|
|
"alarm": []
|
|
|
|
},
|
|
|
|
"end_of_track": 0,
|
|
|
|
"track_number_16": 1501
|
|
|
|
}
|
|
|
|
|
|
|
|
````
|
|
|
|
|
|
|
|
4. See data model: [Tracker documentation](reference) |
|
|
|
\ No newline at end of file |