Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
MicroCART_17-18
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container Registry
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
bbartels
MicroCART_17-18
Commits
69fe5f98
Commit
69fe5f98
authored
8 years ago
by
burneykb
Browse files
Options
Downloads
Patches
Plain Diff
Added all PID controllers to cli_getpid.c
parent
823a813d
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
groundStation/src/cli/cli_getpid.c
+69
-16
69 additions, 16 deletions
groundStation/src/cli/cli_getpid.c
groundStation/src/frontend/pid_common.h
+1
-2
1 addition, 2 deletions
groundStation/src/frontend/pid_common.h
with
70 additions
and
18 deletions
groundStation/src/cli/cli_getpid.c
+
69
−
16
View file @
69fe5f98
...
@@ -16,10 +16,10 @@ int cli_getpid(struct backend_conn * conn, int argc, char **argv) {
...
@@ -16,10 +16,10 @@ int cli_getpid(struct backend_conn * conn, int argc, char **argv) {
{
"roll"
,
no_argument
,
&
getRoll
,
1
},
{
"roll"
,
no_argument
,
&
getRoll
,
1
},
{
"pitch"
,
no_argument
,
&
getPitch
,
1
},
{
"pitch"
,
no_argument
,
&
getPitch
,
1
},
{
"yaw"
,
no_argument
,
&
getYaw
,
1
},
{
"yaw"
,
no_argument
,
&
getYaw
,
1
},
{
"rollv"
,
no_argument
,
&
get
Yaw
V
,
1
},
{
"rollv"
,
no_argument
,
&
get
Roll
V
,
1
},
{
"pitchv"
,
no_argument
,
&
get
Yaw
V
,
1
},
{
"pitchv"
,
no_argument
,
&
get
Pitch
V
,
1
},
{
"yawv"
,
no_argument
,
&
getYawV
,
1
},
{
"yawv"
,
no_argument
,
&
getYawV
,
1
},
{
"height"
,
no_argument
,
&
getHeight
,
1
},
{
"height"
,
no_argument
,
&
getHeight
,
1
},
{
"lat"
,
no_argument
,
&
getLat
,
1
},
{
"lat"
,
no_argument
,
&
getLat
,
1
},
{
"long"
,
no_argument
,
&
getLong
,
1
},
{
"long"
,
no_argument
,
&
getLong
,
1
},
{
"help"
,
no_argument
,
&
needHelp
,
1
},
{
"help"
,
no_argument
,
&
needHelp
,
1
},
...
@@ -64,17 +64,11 @@ int cli_getpid(struct backend_conn * conn, int argc, char **argv) {
...
@@ -64,17 +64,11 @@ int cli_getpid(struct backend_conn * conn, int argc, char **argv) {
int
result
;
int
result
;
if
(
getAll
)
{
if
(
getAll
)
{
pid_data
.
controller
=
PID_ROLL
;
for
(
int
i
=
0
;
i
<
PID_NUM_PIDS
;
++
i
)
{
if
((
result
=
getValues
(
conn
,
&
pid_data
)))
{
pid_data
.
controller
=
i
;
return
result
;
if
((
result
=
getValues
(
conn
,
&
pid_data
)))
{
}
return
result
;
pid_data
.
controller
=
PID_PITCH
;
}
if
((
result
=
getValues
(
conn
,
&
pid_data
)))
{
return
result
;
}
pid_data
.
controller
=
PID_YAW
;
if
((
result
=
getValues
(
conn
,
&
pid_data
)))
{
return
result
;
}
}
}
else
{
}
else
{
if
(
getPitch
)
{
if
(
getPitch
)
{
...
@@ -95,6 +89,43 @@ int cli_getpid(struct backend_conn * conn, int argc, char **argv) {
...
@@ -95,6 +89,43 @@ int cli_getpid(struct backend_conn * conn, int argc, char **argv) {
return
result
;
return
result
;
}
}
}
}
if
(
getPitchV
)
{
pid_data
.
controller
=
PID_PITCH_RATE
;
if
((
result
=
getValues
(
conn
,
&
pid_data
)))
{
return
result
;
}
}
if
(
getRollV
)
{
pid_data
.
controller
=
PID_ROLL_RATE
;
if
((
result
=
getValues
(
conn
,
&
pid_data
)))
{
return
result
;
}
}
if
(
getYawV
)
{
pid_data
.
controller
=
PID_YAW_RATE
;
if
((
result
=
getValues
(
conn
,
&
pid_data
)))
{
return
result
;
}
}
if
(
getHeight
)
{
pid_data
.
controller
=
PID_HEIGHT
;
if
((
result
=
getValues
(
conn
,
&
pid_data
)))
{
return
result
;
}
}
if
(
getLat
)
{
pid_data
.
controller
=
PID_LAT
;
if
((
result
=
getValues
(
conn
,
&
pid_data
)))
{
return
result
;
}
}
if
(
getLong
)
{
pid_data
.
controller
=
PID_LONG
;
if
((
result
=
getValues
(
conn
,
&
pid_data
)))
{
return
result
;
}
}
}
}
return
0
;
return
0
;
...
@@ -105,8 +136,6 @@ int getValues(struct backend_conn * conn, struct frontend_pid_data * pid_data) {
...
@@ -105,8 +136,6 @@ int getValues(struct backend_conn * conn, struct frontend_pid_data * pid_data) {
return
1
;
return
1
;
}
}
return
0
;
switch
(
pid_data
->
controller
)
{
switch
(
pid_data
->
controller
)
{
case
PID_PITCH
:
case
PID_PITCH
:
printf
(
"Pitch Constants: P = %f
\t
I = %f
\t
D = %f
\n
"
,
printf
(
"Pitch Constants: P = %f
\t
I = %f
\t
D = %f
\n
"
,
...
@@ -120,6 +149,30 @@ int getValues(struct backend_conn * conn, struct frontend_pid_data * pid_data) {
...
@@ -120,6 +149,30 @@ int getValues(struct backend_conn * conn, struct frontend_pid_data * pid_data) {
printf
(
"Yaw Constants: P = %f
\t
I = %f
\t
D = %f
\n
"
,
printf
(
"Yaw Constants: P = %f
\t
I = %f
\t
D = %f
\n
"
,
pid_data
->
p
,
pid_data
->
i
,
pid_data
->
d
);
pid_data
->
p
,
pid_data
->
i
,
pid_data
->
d
);
break
;
break
;
case
PID_PITCH_RATE
:
printf
(
"Pitch Rate Constants: P = %f
\t
I = %f
\t
D = %f
\n
"
,
pid_data
->
p
,
pid_data
->
i
,
pid_data
->
d
);
break
;
case
PID_ROLL_RATE
:
printf
(
"Roll Rate Constants: P = %f
\t
I = %f
\t
D = %f
\n
"
,
pid_data
->
p
,
pid_data
->
i
,
pid_data
->
d
);
break
;
case
PID_YAW_RATE
:
printf
(
"Yaw Rate Constants: P = %f
\t
I = %f
\t
D = %f
\n
"
,
pid_data
->
p
,
pid_data
->
i
,
pid_data
->
d
);
break
;
case
PID_HEIGHT
:
printf
(
"Height Constants: P = %f
\t
I = %f
\t
D = %f
\n
"
,
pid_data
->
p
,
pid_data
->
i
,
pid_data
->
d
);
break
;
case
PID_LAT
:
printf
(
"Latitude Constants: P = %f
\t
I = %f
\t
D = %f
\n
"
,
pid_data
->
p
,
pid_data
->
i
,
pid_data
->
d
);
break
;
case
PID_LONG
:
printf
(
"Longitude Constants: P = %f
\t
I = %f
\t
D = %f
\n
"
,
pid_data
->
p
,
pid_data
->
i
,
pid_data
->
d
);
break
;
default
:
default
:
break
;
break
;
}
}
...
...
This diff is collapsed.
Click to expand it.
groundStation/src/frontend/pid_common.h
+
1
−
2
View file @
69fe5f98
...
@@ -22,5 +22,4 @@ struct frontend_pid_data {
...
@@ -22,5 +22,4 @@ struct frontend_pid_data {
float
d
;
float
d
;
};
};
#endif
#endif
\ 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