Create initial message schemas
11 unresolved threads
formats
acknowledgement.py +9 -0
.gitignore +1 -0
generate_swagger.py +23 -25
+ 9
- 0
+ 1
- 0
+ 23
- 25
added Status: In Progress Weight::2 labels
changed title from Create intial message schemas to Create initial message schemas
Note: Ignore all the files under examples/*
. Main files are:
Another thing to consider is the sensor data for perception or scientific observation, and whether it should go under platform status or a separate status message/topic for on-board sensor payload. Another thing we discussed previously is if this could be made generic or if we should allow customised data/messages for some platforms.
For SoAR, this would be for the pings/targets/feature-of-interests detected by the AUVs.
added 1 commit
added 1 commit
[Alvaro] Add message format version
added 7 commits
master
added 1 commit
added 1 commit
added 1 commit
added 1 commit
To add separate message schema for usbl_position_updates
latitude: <>
longitude: <>
depth: <>
timestamp: <>
comms_quality: <>
ref_platform_ID: <>
added 1 commit
requested review from @jamki
1 | { | |
2 | "message_ID": "b427003c-0000-11aa-a1eb-bvcdfghjgfdd", | |
3 | "timestamp": "2022-11-16T00:00:00Z", | |
4 | "version": 2, | |
5 | "source": "hermes", | |
6 | "destination": "autonomy_engine", | |
7 | "delivery_type": "publish", | |
8 | "encoded": false, | |
9 | "message_type": "platform_status", | |
10 | "platform_ID": 1, | |
Please register or sign in to reply |
1 | { | |
2 | "message_ID": "b427003c-0000-11aa-a1eb-bvcdfghjgfdd", | |
3 | "timestamp": "2022-11-16T00:00:00Z", | |
4 | "version": 2, | |
5 | "source": "ecosub_c2", | |
6 | "destination": "autonomy_engine", | |
7 | "delivery_type": "publish", | |
8 | "encoded": false, | |
9 | "message_type": "observation", | |
10 | "platform_ID": 3, | |
|
added 1 commit
96 | "safe_command": "go_home", | |
97 | "target_depth": 10.0 | |
98 | }, | |
99 | "max_velocity": 0.9, | |
100 | "min_altitude": 15.2, | |
101 | "min_velocity": 0.1, | |
102 | "additional_data": { | |
103 | "scan_type": "DVL", | |
104 | "swath_width": 10 | |
105 | } | |
106 | }, | |
107 | { | |
108 | "platform_ID": 10, | |
109 | "serial": "ecosub-5", | |
110 | "model": "ecosub", | |
111 | "emergency": { | |
|
[DAN] Useful to add a heading value in the vehicle status updates
added 1 commit
42 | "example": 15.0, | |
43 | }, | |
44 | "activate_payload": { | |
45 | "type": "boolean", | |
46 | "description": "To activate/deactivate sensor for Autosub " | |
47 | + "Hover-1 --> `MBES` sensor and for EcoSUB --> `Sidescan`", | |
48 | "example": True, | |
49 | }, | |
50 | "send_environmental_data": { | |
51 | "type": "boolean", | |
52 | "description": "To trigger the platform to send list of" | |
53 | + " observations if any found", | |
54 | "example": False, | |
55 | }, | |
56 | }, | |
57 | "required": [ | |
|
Few comments of little bits I think have been from copy + pasting
Can we have a chat about the structure of the messages maybe after stand-up tomorrow? This (I think) is the opposite way round from the schema I've based the prototype on. In the prototype schema every message is an instance of Message and the anyOf defines which payload schema it contains. The idea is that the backbone only deals in messages and passes the message on to the protocol handler which cares about what a message contains.
The model here is there are a bunch of different top-level schemas which each contain the content of the "Message" schema. It may well be fine or even preferable but it doesn't match the thing I've currently got working so it's probably worth a conversation.
[TO DISCUSS] Interesting. Let's discuss this (need to clarify). If we need to change it from this end instead of the core, we should make the changes sooner since the partners will be working with this schemas as a start
added Status::In Review label and removed Status::In Progress label
added 1 commit
changed milestone to %SoAR-2023W01
So with openapi-spec-validator
it was validated successfully. Let's chat. That being said, I will add a task to build some tests
Oh wait a minute. openapi-spec-validator
is validating that the swagger.json
conforms to the open api standard. It's not parsing a messaging and validating that the message conforms to the schema definition. What I'm talking about is validating that the example platform_status.json
messages validate against the PlatformStatus definition
defined in the schema.
I think the python version of what I'm talking about is here: https://github.com/p1c2u/openapi-schema-validator
The swagger.json
is also curiously different in structure to all out existing APIs. Normally the models are under definitions
but here they're under components/schemas
and definitions
is there but empty.
added 1 commit
7 | action_schema = { | |
8 | "type": "object", | |
9 | "properties": { | |
10 | "action": { | |
11 | "type": "string", | |
12 | "description": "Autonomy Engine's action from `move`, `payload`," | |
13 | + " `dive`, `send_hits`, `scanline`, `scanpoint`.", | |
14 | "example": "move", | |
15 | }, | |
16 | "flight_style": { | |
17 | "type": "string", | |
18 | "description": "Platform-specific modes/flight styles to perform" | |
19 | + " next action", | |
20 | "example": "orbit", | |
21 | }, | |
22 | "latitude_waypoint": { | |
|
added 1 commit
22 | "example": {"payload": [1.2, 434]}, | |
23 | }, | |
24 | }, | |
25 | "required": [], | |
26 | } | |
27 | ||
28 | platform_status_message_schema = { | |
29 | "allOf": [{"$ref": "#/components/schemas/Message"}], | |
30 | "type": "object", | |
31 | "properties": { | |
32 | "platform_ID": { | |
33 | "type": "integer", | |
34 | "description": "Identifier for platform", | |
35 | "example": 1, | |
36 | }, | |
37 | "status_source": { | |
|
66 | "description": "Minimum altitude set for squad.", | |
67 | "example": 15.2, | |
68 | }, | |
69 | "min_velocity": { | |
70 | "type": "number", | |
71 | "format": "float", | |
72 | "description": "Minimum velocity set for squad.", | |
73 | "example": 0.1, | |
74 | }, | |
75 | "max_velocity": { | |
76 | "type": "number", | |
77 | "format": "float", | |
78 | "description": "Maximum altitude set for squad.", | |
79 | "example": 0.9, | |
80 | }, | |
81 | "additional_data": { | |
|
added 1 commit
removed Status::In Review label
added 1 commit
added 1 commit
1 | Flask | |
2 | flask-restx | |
3 | flasgger | |
4 | flask-marshmallow | |
|
18 | """ | |
19 | schema, spec_url = read_from_filename("fixtures/swagger.json") | |
20 | errors_iterator = openapi_v3_spec_validator.iter_errors(schema) | |
21 | print(errors_iterator) | |
22 | print(openapi_v30_spec_validator.validate(schema)) | |
23 | ||
24 | """ | |
25 | Test schema - Hydrosurv Messages | |
26 | """ | |
27 | message_types = ["acknowledgement", "mission_plan", "platform_status"] | |
28 | for item in message_types: | |
29 | f = open("mock_data/hydrosurv_adapter/%s.json" % item) | |
30 | mock_data = json.load(f) | |
31 | header_data = mock_data["header"] | |
32 | payload_data = mock_data["payload"] | |
33 | print(validate(header_data, message_header, format_checker=FormatChecker())) | |
|
added 2 commits
merged
mentioned in commit fd3f162a
Files with large changes are collapsed by default.
Files with large changes are collapsed by default.