Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
Communications Backbone System
backbone-message-format
Commits
a0d9c041
Commit
a0d9c041
authored
1 year ago
by
Dan Jones
Browse files
Options
Download
Plain Diff
Merge branch '43-spine-support' into 'dev'
Resolve "SPINE Support" Closes
#43
See merge request
!29
parents
421cf7e0
7785a061
dev
66-tag-current-dev-as-version-1
76-should-depth-and-altitude-be-coordinates
80-add-informational-type-primitive
87-remove-comment-for-platform-status-state
87-remove-todo-comment-from-platform-state
action-refactor-test
ci-js-test
master
v2.0.0
v2.0.0-beta.11
v2.0.0-beta.10
v2.0.0-beta.9
v2.0.0-beta.8
v2.0.0-beta.7
v2.0.0-beta.6
v2.0.0-beta.5
v2.0.0-beta.4
v2.0.0-beta.3
v2.0.0-beta.2
v2.0.0-beta.1
v1.0.0
v0.2.0
2 merge requests
!30
Resolve "Release v0.2"
,
!29
Resolve "SPINE Support"
Pipeline
#227579
passed with stages
in 57 seconds
Changes
9
Pipelines
4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
1911 additions
and
1526 deletions
+1911
-1526
examples/hydrosurv_adapter/alert.json
examples/hydrosurv_adapter/alert.json
+21
-0
examples/hydrosurv_adapter/platform_status.json
examples/hydrosurv_adapter/platform_status.json
+6
-2
formats/alert.py
formats/alert.py
+58
-0
formats/platform_status.py
formats/platform_status.py
+25
-0
generate_schema_config.py
generate_schema_config.py
+4
-0
project/soar/swagger.json
project/soar/swagger.json
+848
-761
tests-js/soar-examples.test.js
tests-js/soar-examples.test.js
+3
-0
tests/fixtures/schemas.py
tests/fixtures/schemas.py
+96
-8
tests/fixtures/swagger.json
tests/fixtures/swagger.json
+850
-755
No files found.
examples/hydrosurv_adapter/alert.json
0 → 100644
View file @
a0d9c041
{
"header"
:
{
"message_ID"
:
"b427003c-0000-11aa-a1eb-bvcdfghjgfdd"
,
"timestamp"
:
"2022-11-16T00:00:00Z"
,
"version"
:
1
,
"source"
:
"hydrosurv_adapter"
,
"destination"
:
"soar.hydrosurv.reav60.usvdecibel.from_platform.alert"
,
"delivery_type"
:
"publish"
,
"encoded"
:
false
},
"payload"
:
{
"message_type"
:
"alert"
,
"platform_ID"
:
"usvdecibel"
,
"code"
:
345
,
"platform_timestamp"
:
"2022-12-21T00:00:00Z"
,
"subsystem"
:
"Onboard Fault Monitor"
,
"summary"
:
"Steering Damage - Port Side"
,
"details"
:
"Discrepancy between rudder and actuator positions : Rudder Pos=10.31°, Steering Actuator Pos=28.65°, Discrepancy=18.33°"
,
"severity"
:
"Alarm"
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
examples/hydrosurv_adapter/platform_status.json
View file @
a0d9c041
{
"header"
:{
"header"
:
{
"message_ID"
:
"b427003c-0000-11aa-a1eb-bvcdfghjgfdd"
,
"timestamp"
:
"2022-11-16T00:00:00Z"
,
"version"
:
2
,
...
...
@@ -8,11 +8,15 @@
"delivery_type"
:
"publish"
,
"encoded"
:
false
},
"payload"
:{
"payload"
:
{
"message_type"
:
"platform_status"
,
"autonomy_engine_plan_ID"
:
1
,
"status_source"
:
"onboard_platform"
,
"battery_remaining_capacity"
:
80.2
,
"battery_output"
:
3.8
,
"fuel_volume"
:
13.2
,
"fuel_remaining_capacity"
:
65.3
,
"endurance"
:
3.4
,
"heading"
:
310.0
,
"health_status"
:
false
,
"latitude"
:
178.2
,
...
...
This diff is collapsed.
Click to expand it.
formats/alert.py
0 → 100644
View file @
a0d9c041
"""
schemas: Alert message sent on fault detection
"""
alert_schema
=
{
"type"
:
"object"
,
"properties"
:
{
"message_type"
:
{
"type"
:
"string"
,
"description"
:
"Type of message"
,
"example"
:
"alert"
,
"enum"
:
[
"alert"
],
},
"code"
:
{
"type"
:
"integer"
,
"description"
:
"Alert code"
,
"example"
:
345
,
},
"platform_ID"
:
{
"type"
:
"string"
,
"description"
:
"Unique identifier for this platform"
,
"example"
:
"usvdecibel"
,
},
"platform_timestamp"
:
{
"type"
:
"string"
,
"format"
:
"date-time"
,
"description"
:
"Timestamp for onboard platform status message"
,
"example"
:
"2022-12-21T00:00:00Z"
,
},
"subsystem"
:
{
"type"
:
"string"
,
"description"
:
"System that generated the alert"
,
"example"
:
"Onboard Fault Monitor"
,
},
"summary"
:
{
"type"
:
"string"
,
"description"
:
"High level description of the alert"
,
"example"
:
"Steering Damage - Port Side"
,
},
"details"
:
{
"type"
:
"string"
,
"description"
:
"Detailed reason for the alert "
,
"example"
:
"Discrepancy between rudder and actuator positions"
+
" : Rudder Pos=10.31°, Steering Actuator Pos=28.65°, Discrepancy=18.33°"
,
},
"severity"
:
{
"type"
:
"string"
,
"description"
:
"Severity level of alert"
,
"example"
:
"Alarm"
,
"enum"
:
[
"Emergency"
,
"Alarm"
,
"Warning"
,
"Caution"
],
},
},
"required"
:
[
"message_type"
,
"platform_ID"
,
"code"
,
"severity"
,
],
}
This diff is collapsed.
Click to expand it.
formats/platform_status.py
View file @
a0d9c041
...
...
@@ -170,6 +170,31 @@ platform_status_schema = {
"description"
:
"Battery remaining % provided by respective C2"
,
"example"
:
80.2
,
},
"battery_output"
:
{
"type"
:
"number"
,
"format"
:
"float"
,
"description"
:
"Battery output in kW"
,
"example"
:
80.2
,
},
"fuel_remaining_capacity"
:
{
"type"
:
"number"
,
"format"
:
"float"
,
"description"
:
"Percentage remaining capacity"
,
"example"
:
80.2
,
},
"fuel_volume"
:
{
"type"
:
"number"
,
"format"
:
"float"
,
"description"
:
"Litres of liquid fuel"
,
"example"
:
12.5
,
},
"endurance"
:
{
"type"
:
"number"
,
"format"
:
"float"
,
"description"
:
"Estimate of hours of operation remaining "
+
"based on present output or performance"
,
"example"
:
7.4
,
},
"sensor_config"
:
sensor_schema
,
},
"required"
:
[
...
...
This diff is collapsed.
Click to expand it.
generate_schema_config.py
View file @
a0d9c041
...
...
@@ -9,6 +9,7 @@ from formats.platform_status_encoded import platform_status_encoded_schema
from
formats.survey
import
survey_schema
from
formats.survey_encoded
import
survey_encoded_schema
from
formats.acknowledgement
import
acknowledgement_schema
from
formats.alert
import
alert_schema
from
flasgger
import
Swagger
from
flask
import
Flask
...
...
@@ -55,6 +56,7 @@ swagger_config = {
"discriminator"
:
{
"propertyName"
:
"message_type"
,
"mapping"
:
{
"alert"
:
"#/components/schemas/alert"
,
"mission_plan"
:
"#/components/schemas/mission_plan"
,
"mission_plan_encoded"
:
"#/components/schemas/"
+
"mission_plan_encoded"
,
...
...
@@ -72,6 +74,7 @@ swagger_config = {
},
},
"oneOf"
:
[
{
"$ref"
:
"#/components/schemas/alert"
},
{
"$ref"
:
"#/components/schemas/acknowledgement"
},
{
"$ref"
:
"#/components/schemas/mission_plan"
},
{
"$ref"
:
"#/components/schemas/mission_plan_encoded"
},
...
...
@@ -95,6 +98,7 @@ swagger_config = {
"survey"
:
survey_schema
,
"survey_encoded"
:
survey_encoded_schema
,
"acknowledgement"
:
acknowledgement_schema
,
"alert"
:
alert_schema
,
}
},
}
...
...
This diff is collapsed.
Click to expand it.
project/soar/swagger.json
View file @
a0d9c041
This diff is collapsed.
Click to expand it.
tests-js/soar-examples.test.js
View file @
a0d9c041
...
...
@@ -11,6 +11,9 @@ const validateSchema = (schema) => {
const
validator
=
new
OpenAPISchemaValidator
({
version
:
3
});
let
validation
=
validator
.
validate
(
schema
);
validation
.
valid
=
(
validation
.
errors
.
length
===
0
);
if
(
!
validation
.
valid
)
{
console
.
log
(
'
errors
'
,
validation
.
errors
);
}
return
validation
;
};
...
...
This diff is collapsed.
Click to expand it.
tests/fixtures/schemas.py
View file @
a0d9c041
...
...
@@ -454,6 +454,7 @@ platform_status_schema = {
"type"
:
"string"
,
"description"
:
"Type of message"
,
"example"
:
"platform_status"
,
"enum"
:
[
"platform_status"
],
},
"platform_ID"
:
{
"type"
:
"string"
,
...
...
@@ -486,7 +487,7 @@ platform_status_schema = {
"description"
:
"Current state executed by platform. E.g. "
+
"STOP, IDLE, ABORT."
,
"example"
:
"ABORT"
,
},
},
# TODO: Define enum with potential STATES of each platform
"autonomy_engine_plan_ID"
:
{
"type"
:
"integer"
,
"description"
:
"Last mission plan ID (according to Autonomy"
...
...
@@ -496,13 +497,13 @@ platform_status_schema = {
"latitude"
:
{
"type"
:
"number"
,
"format"
:
"float"
,
"description"
:
"Latitude in decimal degrees."
,
"description"
:
"Latitude
(Y-coordinate)
in decimal degrees."
,
"example"
:
178.2
,
},
"longitude"
:
{
"type"
:
"number"
,
"format"
:
"float"
,
"description"
:
"Longitude in decimal degrees."
,
"description"
:
"Longitude
(X-coordinate)
in decimal degrees."
,
"example"
:
-
10.122
,
},
"depth"
:
{
...
...
@@ -516,7 +517,7 @@ platform_status_schema = {
"type"
:
"number"
,
"format"
:
"float"
,
"description"
:
"Target altitude in metres"
,
"example"
:
20
,
"example"
:
20
.0
,
},
"mission_track_ID"
:
{
"type"
:
"integer"
,
...
...
@@ -542,7 +543,7 @@ platform_status_schema = {
"example"
:
124.3
,
},
"water_current_velocity"
:
{
"
format
"
:
"string"
,
"
type
"
:
"string"
,
"description"
:
"Water current magnitude and direction"
,
"example"
:
"124.3NE"
,
},
...
...
@@ -561,8 +562,8 @@ platform_status_schema = {
},
"health_status"
:
{
"type"
:
"boolean"
,
"description"
:
"Health status where 0 is OK, 1 is platform"
+
"
has
an ERROR"
,
"description"
:
"Health status where 0 is OK, 1 is platform
has
"
+
" an ERROR"
,
"example"
:
False
,
},
"localisation_north_error"
:
{
...
...
@@ -576,7 +577,7 @@ platform_status_schema = {
"type"
:
"number"
,
"format"
:
"float"
,
"description"
:
"Difference in EAST between deadreckoning"
+
"
and USBL update."
,
+
"and USBL update."
,
"example"
:
0.000129
,
},
"usbl_fix_seconds_ago"
:
{
...
...
@@ -591,6 +592,37 @@ platform_status_schema = {
"description"
:
"Battery remaining % provided by respective C2"
,
"example"
:
80.2
,
},
# Battery power (kw / float)
"battery_output"
:
{
# changed from battery_power
"type"
:
"number"
,
"format"
:
"float"
,
"description"
:
"Battery output in kW"
,
"example"
:
80.2
,
},
# Bunkers remaining capacity (litres, float)
# Bunkers percentage full (percentage, float)
# battery_remaining_capacity is % full if we want both these fields
# these names are going to cause confusion
"fuel_remaining_capacity"
:
{
"type"
:
"number"
,
"format"
:
"float"
,
"description"
:
"Percentage remaining capacity"
,
"example"
:
80.2
,
},
"fuel_volume"
:
{
"type"
:
"number"
,
"format"
:
"float"
,
"description"
:
"Litres of liquid fuel"
,
"example"
:
12.5
,
},
# Endurance (hours, float)
"endurance"
:
{
"type"
:
"number"
,
"format"
:
"float"
,
"description"
:
"Estimate of hours of operation remaining "
+
"based on present output or performance"
,
"example"
:
7.4
,
},
"sensor_config"
:
sensor_schema
,
},
"required"
:
[
...
...
@@ -602,3 +634,59 @@ platform_status_schema = {
"longitude"
,
],
}
alert_schema
=
{
"type"
:
"object"
,
"properties"
:
{
"message_type"
:
{
"type"
:
"string"
,
"description"
:
"Type of message"
,
"example"
:
"alert"
,
"enum"
:
[
"alert"
],
},
"code"
:
{
# changed from alert_ID because reasons
"type"
:
"integer"
,
"description"
:
"Alert code"
,
"example"
:
345
,
},
"platform_ID"
:
{
"type"
:
"string"
,
"description"
:
"Unique identifier for this platform"
,
"example"
:
"usvdecibel"
,
},
"platform_timestamp"
:
{
"type"
:
"string"
,
"format"
:
"date-time"
,
"description"
:
"Timestamp for onboard platform status message"
,
"example"
:
"2022-12-21T00:00:00Z"
,
},
"subsystem"
:
{
# changed from suggested "source" could be device / subsystem or something
"type"
:
"string"
,
"description"
:
"System that generated the alert"
,
"example"
:
"Onboard Fault Monitor"
,
},
"summary"
:
{
"type"
:
"string"
,
"description"
:
"High level description of the alert"
,
"example"
:
"Steering Damage - Port Side"
,
},
"details"
:
{
"type"
:
"string"
,
"description"
:
"Detailed reason for the alert "
,
"example"
:
"Discrepancy between rudder and actuator positions"
+
" : Rudder Pos=10.31°, Steering Actuator Pos=28.65°, Discrepancy=18.33°"
,
},
"severity"
:
{
"type"
:
"string"
,
"description"
:
"Severity level of alert"
,
"example"
:
"Alarm"
,
"enum"
:
[
"Emergency"
,
"Alarm"
,
"Warning"
,
"Caution"
],
},
},
"required"
:
[
"message_type"
,
"platform_ID"
,
"code"
,
"severity"
,
],
}
This diff is collapsed.
Click to expand it.
tests/fixtures/swagger.json
View file @
a0d9c041
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment