Telemetry helper for Cosmos API.
Project description
COSMOS telemetry
This is a simple package to help you connect your drone to COSMOS API by:
- Generating End-Point.
- Generating and processing Post-Request to the End-point.
For a complete API description, please refer to COSMOS-API.
How to use
After getting the token from COSMOS: api_token_example, you can connect and update the telemetry with:
import cosmos_api
api_token = "api_token_example"
telemetry_updater = cosmos_api.Telemetry(api_token)
vehicle_state = {"activity": "idle","battery": "90%"}
response = telemetry_updater.send_telemetry(vehicle_state)
How to build your vehicle_state
vehicle_state is a python dict variable which include the essential telemetry from the drone. This variable will be passed to the server as a json dump.
A basic template can be:
vehicle_state = {
"activity": "idle",
"stamp": 1602,
"gps_0": {
"fix": 3,
"numsat": 10},
"mode": "STABILIZE",
"velocity": [0.0, -0.01, 0.0],
"battery": {
"level": 100,
"current": 0.0,
"voltage": 12.587},
"state": "STANDBY",
"location": {
"global_frame": {
"lat": 35.9341147,
"lon": 139.5689006,
"alt": 0}},
"ground_speed": 0.0,
"attitude": {
"pitch": 0.0004752922395709902,
"roll": 0.0007311428198590875,
"yaw": -3.1402206420898438},
"armed": False,
"order_feedback": {
"message": "",
"type": ""},
"heading": 180}
API description
constructor
- Description
Send the telemetry to COSMOS server, .
Parameters
----------
api_token : str
A string of the shared api token obtained from the server.
Returns
-------
cosmos_api.Telemetry Object
A helper to send drone telemetry to cosmos server.
- Use with:
telemetry_updater = cosmos_api.Telemetry(api_token)
send_telemetry
- Description
Post the telemetry to COSMOS server, to the correct EndPoint with a functional header generated with the shared token.
Parameters
----------
vehicle_state : dict
vehicle_state a dictionary including drone telemetry field.
Returns
-------
requests.Response Object
The response to the post request. Please refer to requests documentation and bellow for error codes.
- Use with:
response = telemetry_updater.send_telemetry(vehicle_state)
- Server Code:
OK = 200: Telemetry posted correctly.
WRONGTELEMETRY = 400: Wrong or incomplete telemetry format.
WRONGTOKEN = 401: No drone registered under the used token.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pycosmosapi-0.0.2.tar.gz.
File metadata
- Download URL: pycosmosapi-0.0.2.tar.gz
- Upload date:
- Size: 3.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.55.0 CPython/3.6.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4efcbde6becb73e4543c0b7e06e83d7e7372f52fa8e06122bd4500abb7b50548
|
|
| MD5 |
ef5a92a41490176da0a5c4425f1429ef
|
|
| BLAKE2b-256 |
1695c366d9f5cabbb652d01307f4e7a76edbdd8a71960d2167cbcbc6759cad0c
|
File details
Details for the file pycosmosapi-0.0.2-py3-none-any.whl.
File metadata
- Download URL: pycosmosapi-0.0.2-py3-none-any.whl
- Upload date:
- Size: 7.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.55.0 CPython/3.6.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1dfaa7cfda620cd3a4d289a9b4c5d539207b82d6ba4ac9a939a2d55de4b8b01f
|
|
| MD5 |
04f4eac7aa3bcf4b4b5721620dda7390
|
|
| BLAKE2b-256 |
78b57893368a0c7155101fa2f8679583fcfeef4b3f37c15d518bb1d06229358e
|