Skip to main content

Message Structure

Android Device -> NTOverAOA​

Subscribe Requests​

When the android app wants to start receiving a topic, it has to send a Subscribe request to NTOverAOA that looks like for example

{"subscribe":["/robot/pose", "FMSInfo/IsRedAlliance"]}

or

{"action":"subscribe", "keys":["/robot/pose", "FMSInfo/IsRedAlliance"]}

this will be what we will use going forward as it provides more flexibility

Send Requests (PUT Requests)​

When the android app wants to send data back like to run an action, the message will look like

{"action":"put", "key":"/RouteRoute/foo", "value": 42}
// When using structs
{"action":"put", "key":"/RoboRoute/bar", "schema":"struct Pose2d {...}", "value":{...}}

See Struct Schemas for more information on writing a schema

NTOverAOA -> Android Device​

Listing Topics​

Sometimes it is useful to know all of the currently available topics from NetworkTables, every 10 seconds a list of topics is sent

{"topics":["/foo","/bar"]}

Receiving a value​

A value from network tables will look like this over AOA

{"key":"/robot/pose","time":1234.5678,"value":42}
// When using structs
{"key":"/robot/pose","time":1234.5678,"schema":"struct Pose2d {...}","value":{...}}

See Struct Schemas for more information on writing a schema

Decoded struct value example, decoded to match the struct schema

{"translation":{"x":..,"y":..}, "rotation": {...}}

Structs​

When using a struct for either sending or receiving, there is a schema that is attached, this is an example for a Pose2d

// Example Struct Schema
"struct Pose2d {struct Translation2d {double x; double y;} translation; struct Rotation2d {double value;} rotation;}"
// A value would look like this
{"translation":{"x":1.5,"y":-2.25},"rotation":{"value":0.1234}}

To supply an array of structs, the schema is the same but the values are supplied as an array []

RoboRoute -> Robot Specific Structure​

To support sending sequences of data and custom positions, routes, and actions we have created a json structure that is sent via Network tables

A plan is sent all at once as a string via NetworkTables as /RoboRoute/Plan. A plan is counter intuitive as it is only one step, but steps can be nested using Sequences and Parallel Groups

Path

Follows a predefined PathPlanner path.

Fields

type"PATH"

Identifies this step as a path step.

Required
pathstring

The name of the path to execute.

Required
Example Plan
Plan.json
{
"type": "SEQUENCE",
"children": [
{
"type": "PATH",
"pathName": "LeaveStart"
},
{
"type": "PARALLEL",
"children": [
{
"type": "POSE",
"pose": {
"x": 2.0,
"y": 3.0,
"rotation": 1.57
}
},
{
"type": "ACTION",
"actionId": 1
}
]
},
{
"type": "ROUTE",
"routePoses": [
{
"x": 2.0,
"y": 3.0,
"rotation": 1.57
},
{
"x": 4.0,
"y": 7.0,
"rotation": 2.68
}
]
}
]
}

Robot Side Implmentation Examples​

AdvantageKit example here

Non AdvantageKit example - coming soon