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
754ed22e
Commit
754ed22e
authored
8 years ago
by
dawehr
Browse files
Options
Downloads
Patches
Plain Diff
Added the IDs for the valuetypes and PID constants to commands.c/h
also added some more comments in both files
parent
80230d2f
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
groundStation/src/backend/commands.c
+10
-2
10 additions, 2 deletions
groundStation/src/backend/commands.c
groundStation/src/backend/commands.h
+51
-17
51 additions, 17 deletions
groundStation/src/backend/commands.h
with
61 additions
and
19 deletions
groundStation/src/backend/commands.c
+
10
−
2
View file @
754ed22e
...
...
@@ -37,7 +37,8 @@
*
*/
/* List of callbacks. DO NOT MODIFY THESE IN THIS FILE -
/*
* List of callbacks. DO NOT MODIFY THESE IN THIS FILE -
* Simply implement a function with the same name
* in a different file (callbacks.c) and these will
* be overridden.
...
...
@@ -60,7 +61,14 @@ command_cb cb_setval __attribute__((weak, alias("cb_default")));
command_cb
cb_getval
__attribute__
((
weak
,
alias
(
"cb_default"
)));
command_cb
cb_respval
__attribute__
((
weak
,
alias
(
"cb_default"
)));
/* Command structure */
/*
* Command structure.
* This array is used to keep track of the callback functions
* for commands between the quad and the ground station.
*
* There is one callback function pointer associated with each
* element in this struct array.
*/
struct
MessageType
MessageTypes
[
MAX_TYPE
]
=
{
// DEBUG
...
...
This diff is collapsed.
Click to expand it.
groundStation/src/backend/commands.h
+
51
−
17
View file @
754ed22e
...
...
@@ -7,15 +7,17 @@
#include
"callbacks.h"
// ----------------------
// Helper stuff
#define MAX_CMD_TEXT_LENGTH 100
enum
Message
{
BEGIN_CHAR
=
0xBE
,
END_CHAR
=
0xED
};
// This should also have double to avoid confusion with float values.
/*
* Enumeration of the data types that a callback function may use
* doubleType should get added here at some point
*/
enum
DataType
{
floatType
,
...
...
@@ -23,27 +25,59 @@ enum DataType
stringType
};
// message type IDs used to know what kind of message we are dealing with
// DO NOT change this enum or you will break backwards compatibility.
/*
* Message type IDs used to know what kind of message we are dealing with
* Enumeration used to index the MessageTypes array in commands.c
* DO NOT change this enum or you will break backwards compatibility.
*/
enum
MessageTypeID
{
DEBUG_TYPE_ID
,
PACKETLOG_TYPE_ID
,
GETPACKETLOGS_TYPE_ID
,
UPDATE_TYPE_ID
,
BEGINUPDATE_TYPE_ID
,
LOG_TYPE_ID
,
RESPONSE_TYPE_ID
,
SETVAL_TYPE_ID
,
GETVAL_TYPE_ID
,
RESPVAL_TYPE_ID
,
DEBUG_TYPE_ID
,
//
PACKETLOG_TYPE_ID
,
//
GETPACKETLOGS_TYPE_ID
,
//
UPDATE_TYPE_ID
,
//
BEGINUPDATE_TYPE_ID
,
//
LOG_TYPE_ID
,
//
RESPONSE_TYPE_ID
,
//
SETVAL_TYPE_ID
,
// setting values. Example: PID constants
GETVAL_TYPE_ID
,
// getting values. Example: PID constants
RESPVAL_TYPE_ID
,
// responding with values. Example: PID constants
// This last type is just used to keep track of the size
MAX_TYPE
};
// MESSAGE SUBTYPES
/*
* Value types used to know which value the command is referencing
*/
enum
ValueType
{
// PID controllers. Each one has a P, I, D, setpoint value option
ROLL
,
PITCH
,
YAW
,
ROLL_RATE
,
PITCH_RATE
,
YAW_RATE
,
LOCAL_X
,
LOCAL_Y
,
ALT
,
};
/*
* Enumeration of PID constants
*/
enum
PIDType
{
KP
,
// P constant
KI
,
// I constant
KD
,
// D constant
SP
,
// Setpoint value
};
/*
* Message type struct used to keep track of the callback function
* pointers located in commands.c
*/
struct
MessageType
{
char
ID
;
char
cmdText
[
100
];
char
cmdText
[
MAX_CMD_TEXT_LENGTH
];
char
cmdDataType
;
command_cb
*
functionPtr
;
};
...
...
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