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
1989f492
Unverified
Commit
1989f492
authored
8 years ago
by
Jake Drahos
Browse files
Options
Downloads
Patches
Plain Diff
Reworked commands.c to support all PID constants
parent
bee97348
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
+189
-35
189 additions, 35 deletions
groundStation/src/backend/commands.c
groundStation/src/backend/communication.c
+8
-4
8 additions, 4 deletions
groundStation/src/backend/communication.c
with
197 additions
and
39 deletions
groundStation/src/backend/commands.c
+
189
−
35
View file @
1989f492
...
...
@@ -44,29 +44,29 @@ struct MessageType MessageTypes[MAX_TYPE] =
// Message Type ID
0x01
,
// Calibration Subtypes
// Calibration Subtypes
(PID coefficients)
{
// yaw
setpoi
nt subtype
// yaw
p consta
nt subtype
{
// ID
0x00
,
// Command text
"setyaw"
,
"setyaw
p
"
,
// Type of the command data
floatType
,
// Function pointer
&
setyaw
NULL
},
// yaw
p
constant subtype
// yaw
i
constant subtype
{
// ID
0x01
,
// Command text
"setyaw
p
"
,
"setyaw
i
"
,
// Type of the command data
floatType
,
// Function pointer
&
setyawp
NULL
},
// yaw d constant subtype
{
...
...
@@ -77,29 +77,29 @@ struct MessageType MessageTypes[MAX_TYPE] =
// Type of the command data
floatType
,
// Function pointer
&
setyawd
NULL
},
// roll
setpoi
nt subtype
// roll
p consta
nt subtype
{
// ID
0x03
,
// Command text
"setroll"
,
"setroll
p
"
,
// Type of the command data
floatType
,
// Function pointer
&
setroll
NULL
},
// roll
p
constant subtype
// roll
i
constant subtype
{
// ID
0x04
,
// Command text
"setroll
p
"
,
"setroll
i
"
,
// Type of the command data
floatType
,
// Function pointer
&
setrollp
NULL
},
// roll d constant subtype
{
...
...
@@ -110,29 +110,29 @@ struct MessageType MessageTypes[MAX_TYPE] =
// Type of the command data
floatType
,
// Function pointer
&
setrolld
NULL
},
// pitch
setpoi
nt subtype
// pitch
p consta
nt subtype
{
// ID
0x06
,
// Command text
"setpitch"
,
"setpitch
p
"
,
// Type of the command data
floatType
,
// Function pointer
&
setpitch
NULL
},
// pitch
p
constant subtype
// pitch
i
constant subtype
{
// ID
0x07
,
// Command text
"setpitch
p
"
,
"setpitch
i
"
,
// Type of the command data
floatType
,
// Function pointer
&
setpitchp
NULL
},
// pitch d constant subtype
{
...
...
@@ -143,51 +143,205 @@ struct MessageType MessageTypes[MAX_TYPE] =
// Type of the command data
floatType
,
// Function pointer
&
setpitchd
NULL
},
//
throttle setpoi
nt subtype
//
yawrate p consta
nt subtype
{
// ID
0x09
,
// Command text
"set
throttle
"
,
"set
yawratep
"
,
// Type of the command data
floatType
,
// Function pointer
&
setthrottle
NULL
},
//
throttl
e
p
constant subtype
//
yawrat
e
i
constant subtype
{
// ID
0x0A
,
// Command text
"set
throttlep
"
,
"set
yawratei
"
,
// Type of the command data
floatType
,
// Function pointer
&
setthrottlep
NULL
},
//
throttl
e
i
constant subtype
//
yawrat
e
d
constant subtype
{
// ID
0x0B
,
// Command text
"set
throttlei
"
,
"set
yawrated
"
,
// Type of the command data
floatType
,
// Function pointer
&
setthrottlei
NULL
},
//
throttl
e
d
constant subtype
//
rollrat
e
p
constant subtype
{
// ID
0x0C
,
// Command text
"set
throttled
"
,
"set
rollratep
"
,
// Type of the command data
floatType
,
// Function pointer
&
getthrottled
NULL
},
// rollrate i constant subtype
{
// ID
0x0D
,
// Command text
"setrollratei"
,
// Type of the command data
floatType
,
// Function pointer
NULL
},
// rollrate d constant subtype
{
// ID
0x0E
,
// Command text
"setrollrated"
,
// Type of the command data
floatType
,
// Function pointer
NULL
},
// pitchrate p constant subtype
{
// ID
0x0F
,
// Command text
"setpitchratep"
,
// Type of the command data
floatType
,
// Function pointer
NULL
},
// pitchrate i constant subtype
{
// ID
0x10
,
// Command text
"setpitchratei"
,
// Type of the command data
floatType
,
// Function pointer
NULL
},
// pitchrate d constant subtype
{
// ID
0x11
,
// Command text
"setpitchrated"
,
// Type of the command data
floatType
,
// Function pointer
NULL
},
// height p constant subtype
{
// ID
0x12
,
// Command text
"setheightp"
,
// Type of the command data
floatType
,
// Function pointer
NULL
},
// height i constant subtype
{
// ID
0x13
,
// Command text
"setheighti"
,
// Type of the command data
floatType
,
// Function pointer
NULL
},
// height d constant subtype
{
// ID
0x14
,
// Command text
"setheightd"
,
// Type of the command data
floatType
,
// Function pointer
NULL
},
// lat p constant subtype
{
// ID
0x15
,
// Command text
"setlatp"
,
// Type of the command data
floatType
,
// Function pointer
NULL
},
// lat i constant subtype
{
// ID
0x16
,
// Command text
"setlati"
,
// Type of the command data
floatType
,
// Function pointer
NULL
},
// lat d constant subtype
{
// ID
0x17
,
// Command text
"setlatd"
,
// Type of the command data
floatType
,
// Function pointer
NULL
},
// long p constant subtype
{
// ID
0x18
,
// Command text
"setlongp"
,
// Type of the command data
floatType
,
// Function pointer
NULL
},
// long i constant subtype
{
// ID
0x19
,
// Command text
"setlongi"
,
// Type of the command data
floatType
,
// Function pointer
NULL
},
// long d constant subtype
{
// ID
0x1A
,
// Command text
"setlongd"
,
// Type of the command data
floatType
,
// Function pointer
NULL
}
}
},
...
...
@@ -993,4 +1147,4 @@ int respthrottlei(unsigned char *packet, int dataLen, modular_structs_t *structs
}
int
respthrottled
(
unsigned
char
*
packet
,
int
dataLen
,
modular_structs_t
*
structs
){
return
0
;
}
\ No newline at end of file
}
This diff is collapsed.
Click to expand it.
groundStation/src/backend/communication.c
+
8
−
4
View file @
1989f492
...
...
@@ -256,12 +256,16 @@ int processCommand(unsigned char *packet, modular_structs_t *structs) {
}
if
(
metadata
.
data_len
>=
0
)
{
// Call the appropriate subtype function
(
*
(
MessageTypes
[(
unsigned
char
)
metadata
.
msg_type
].
subtypes
[(
unsigned
char
)
metadata
.
msg_subtype
].
functionPtr
))(
data
,
metadata
.
data_len
,
structs
);
/* Null check*/
if
(
MessageTypes
[(
unsigned
char
)
metadata
.
msg_type
].
subtypes
[
(
unsigned
char
)
metadata
.
msg_subtype
].
functionPtr
)
{
// Call the appropriate subtype function
(
*
(
MessageTypes
[(
unsigned
char
)
metadata
.
msg_type
].
subtypes
[(
unsigned
char
)
metadata
.
msg_subtype
].
functionPtr
))(
data
,
metadata
.
data_len
,
structs
);
}
return
0
;
}
// Only gets here if there is an error
return
-
1
;
}
\ No newline at end of file
}
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