Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
MicroCART
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Distributed Autonomous Networked Control Lab
MicroCART
Commits
9b612398
Commit
9b612398
authored
7 years ago
by
mkelly2
Browse files
Options
Downloads
Patches
Plain Diff
Added packet data formats to packets markdown file
parent
ccc1460d
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
documentation/groundStation/packets.md
+115
-5
115 additions, 5 deletions
documentation/groundStation/packets.md
quad/src/quad_app/callbacks.c
+1
-1
1 addition, 1 deletion
quad/src/quad_app/callbacks.c
with
116 additions
and
6 deletions
documentation/groundStation/packets.md
+
115
−
5
View file @
9b612398
# Packet Information #
The MicroCART project uses custom packets to communicate with the quad. This may seem complex at first
but the structure of all packets is the same it is just the way the data is formatted that changes
between packets. The basic structure is shown below.
between packets.
## Introduction ##
All packets are the same in the sense that they have consistent headers with a start character and all end with a checksum as well as
a end character. The basic structure is shown below.
| Index | 0 | 1 | 2 | 3 | 4 | 5 | 6 |
|:-----------------:|:---------------:|:------------:|:----------:|:-----------:|:----:|:--------:|:-------------:|
| Message Parameter | Begin Character | Message Type | Message ID | Data Length | Data | Checksum | End Character |
| Bytes | 1 | 2 | 2 | 2 | var | 1 | 1 |
Both the begin and end characters are defined in (communication.h)[]. Message types are defined within an enum in
(commands.h)[]. Message ID is managed within the backend and is just a counter that is defined in (backend.c)[] of.
Data length varies with the command that is being sent, but the length of a command is constant. The data is sent
in a specific format set by commands. Lastly, checksum is computed within (backend.c)[].
\ No newline at end of file
Both the begin and end characters are defined in the Message enum in
[
commands.h
](
../../quad/src/commands/commands.h
)
. Message types
are defined within the MessageTypeID enum in
[
commands.h
](
../../quad/src/commands/commands.h
)
. Message ID is managed within the backend
[
backend.c
](
../../groundStation/src/backend/backend.c
)
and is just a counter that is used in client_recv to number packets. Data length
varies with the command that is being sent, but the length of a command is constant. The data is sent in a specific format set by commands.
Lastly, checksum is computed within
[
packet.c
](
../../groundStation/src/backend/packet.c
)
.
All packets sent within the system are commands, defined by the MessageTypeID enum referenced earlier, or a VPRN packet. Much of the time when
flying autonomously the commands that the user is responsible for are the getparam and setparam packets that are used to set waypoints or change
values within the computation graph, see
[
control_algorithm.c
](
../../quad/src/quad_app/control_algorithm.c
)
for the PID blocks.
## Adding a new packet ##
//TODO - Matt
## Data Format ##
For all commands other than the message bundle packet there is a defined length and format for sending and receiving packets. Many of the formats
will be discussed below. These packet formats are referenced from
[
callbacks.c
](
../../quad/src/quad_app/callbacks.c
)
.
**Note:**
this document may get out of date,
[
callbacks.c
](
../../quad/src/quad_app/callbacks.c
)
should have all the up to data packet formats.
### setparam ###
**
Sent from Ground Station
**
| data index | 0 - 1 | 2 - 3 | 4 - 7 |
|:----------:|:-----------:|:-----------:|:-----------:|
| parameter | node ID | node parmID | param val |
| bytes | 2 | 2 | 4 |
Does not send any response.
### getparam and getoutput ###
**
Sent from Ground Station
**
| data index | 0 - 1 | 2 - 3 |
|:-----------:|:-------------:|:-----------:|
| parameter | node ID | node parmID |
| bytes | 2 | 2 |
**
Response to Ground Station
**
The response will be of type RESPPARAM_ID.
| data index | 0 - 1 | 2 - 3 | 4 - 7 |
|:-----------:|:------------:|:-----------:|:-----------:|
| parameter | node ID | node parmID | param val |
| bytes | 2 | 2 | 4 |
### setsource ###
**
Sent from Ground Station
**
| data index | 0 - 1 | 2 - 3 | 4 - 5 | 6 - 7 |
|:----------:|:------------:|:-------------:|:-----------:|:-------------:|
| parameter | dest node ID | dest input ID | src node ID | src output ID |
| bytes | 2 | 2 | 2 | 2 |
Does not send any response.
### getsource ###
**
Sent from Ground Station
**
| data index | 0 - 1 | 2 - 3 |
|:-----------:|:-------------:|:-----------:|
| parameter | node ID | node parmID |
| bytes | 2 | 2 |
**
Response to Ground Station
**
The response will be of type RESPSOURCE_ID.
| data index | 0 - 1 | 2 - 3 | 4 - 5 | 6 - 7 |
|:----------:|:------------:|:-------------:|:-----------:|:-------------:|
| parameter | dest node ID | dest input ID | src node ID | src output ID |
| bytes | 2 | 2 | 2 | 2 |
### getnodes ###
**
Sent from Ground Station
**
//TODO - Does not list in callbacks.c, does this exist?
**
Response to Ground Station
**
| data index | 0 - 2
*N-1 | 2*
N - 4
*N-1 | 4*
N - (< 4096) |
|:-----------:|:------------:|:--------------:|:---------------:|
| parameter | Node IDs | Node type Is | Node names |
| bytes | 2
*N | 2*
N | < 4096 |
### addnode ###
**
Sent from Ground Station
**
| data index | 0 - 1 | 2 + |
|:-----------:|:------------:|:-------------:|
| parameter | type ID | New node name |
| bytes | 2 | var |
**
Response to Ground Station
**
| data index | 0 - 1 |
|:-----------:|:------------:|
| parameter | node ID |
| bytes | 2 |
This diff is collapsed.
Click to expand it.
quad/src/quad_app/callbacks.c
+
1
−
1
View file @
9b612398
...
...
@@ -389,7 +389,7 @@ int cb_getnodes(struct modular_structs *structs, struct metadata *meta, unsigned
* | data index || 0 - 1 |
* |-----------------------------|
* | parameter || node ID |
* |-----------------------------
-
* |-----------------------------
|
* | bytes || 2 |
* |-----------------------------|
*/
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment