-
Notifications
You must be signed in to change notification settings - Fork 0
Communication Protocol
Sebastian Sarbora edited this page Feb 13, 2015
·
7 revisions
The protocol has the following requirements:
- motor commands
- configuration commands for peripherals
- raw sensor data
- computed sensor data
- Peripheral control commands (Lights, claws, etc)
- semi-autonomous commands
- emergency alerts (leak in hull, pressure to high, overheating, etc.)
Each packet will have have a header, and then the data.
| Transmitted Packet |
|---|
| TCP |
| Neptune Header |
| Neptune data |
| TCP |
| Field | Type | Purpose |
|---|---|---|
| Packet Type | unsigned byte | Essentially an enumeration for the types described above |
| Priority | unsigned byte | How quickly should the receiver be handling this |
| Sequence | unsigned byte | potentially necessary for order is we use udp instead of tcp |
| Field | Type | Purpose |
|---|---|---|
| Motor ID | unsigned byte | The specific motor to run |
| Direction | bool | true=forward false=reverse |
| Speed | float | The raw speed to set (0.0-1.0) |
| Duration | int | How many cycles to stay at the speed |
| Field | Type | Purpose |
|---|---|---|
| Motor ID | unsigned byte | The motor to run |
| Degree | float | Amount of rotation, can be in degree's or Radians depending on motor config. Can be more than a full rotation for multiple rotations, and negative for reverse. |
| Speed | float | the raw speed to set (0.0-1.0) |
| Field | Type | Purpose |
|---|---|---|
| Relay ID | unsigned byte | |
| Enable | bool |
Request Peripheral Status - requests a property from a peripheral, such as a motors speed, a lights status, or a sensor value.
| Field | Type | Purpose |
|---|---|---|
| Peripheral type | unsigned byte | motor, light, servo, claw, limit switch |
| Peripheral ID | unsigned byte | which specific one |
| Property ID | unsigned byte | enabled, speed, position, triggered |
| Field | Type | Purpose |
|---|---|---|
| Sensor Type | int | |
| Sensor ID | int | |
| Data | char* |
| Field | Type | Purpose |
|---|---|---|
| Data Type | int | |
| Data | char* |
| Field | Type | Purpose |
|---|---|---|
| Peripheral type | unsigned byte | motor, light, servo, claw, limit switch |
| Peripheral ID | unsigned byte | |
| Property ID | unsigned byte | enabled, speed, position, triggered |
| Data | char* | responsibility of the other side to parse into a struct |
| Field | Type | Purpose |
|---|---|---|
| Alert Type | int | Error, interrupt, hardware malfunction? |
| Threat Level | int | how serious is it? |
| Subsystem | int | Is it software, motors, main board, power? |
| ID | int | Specific part of the subsystem (motor ID, sensor ID, IC, etc) |
The device emulator will essentially be a c++ program that connects to the host application and sends and receives data via tcp over the device protocol. It will most likely not include camera functionality, but should be able to emulate all of the other functions. It could also potentially be used as a unit testing platform.