Skip to content
Snippets Groups Projects
Unverified Commit 1c29f764 authored by Jake Drahos's avatar Jake Drahos
Browse files

Added all pid controllers to the enum

parent b462ade8
No related branches found
No related tags found
No related merge requests found
...@@ -34,33 +34,33 @@ int cli_getpid(struct backend_conn * conn, int argc, char **argv) { ...@@ -34,33 +34,33 @@ int cli_getpid(struct backend_conn * conn, int argc, char **argv) {
int result; int result;
if(getAll) { if(getAll) {
pid_data.controller = ROLL; pid_data.controller = PID_ROLL;
if ((result = getValues(conn, &pid_data))) { if ((result = getValues(conn, &pid_data))) {
return result; return result;
} }
pid_data.controller = PITCH; pid_data.controller = PID_PITCH;
if ((result = getValues(conn, &pid_data))) { if ((result = getValues(conn, &pid_data))) {
return result; return result;
} }
pid_data.controller = YAW; pid_data.controller = PID_YAW;
if ((result = getValues(conn, &pid_data))) { if ((result = getValues(conn, &pid_data))) {
return result; return result;
} }
} else { } else {
if(getPitch) { if(getPitch) {
pid_data.controller = PITCH; pid_data.controller = PID_PITCH;
if ((result = getValues(conn, &pid_data))) { if ((result = getValues(conn, &pid_data))) {
return result; return result;
} }
} }
if(getRoll) { if(getRoll) {
pid_data.controller = ROLL; pid_data.controller = PID_ROLL;
if ((result = getValues(conn, &pid_data))) { if ((result = getValues(conn, &pid_data))) {
return result; return result;
} }
} }
if(getYaw) { if(getYaw) {
pid_data.controller = YAW; pid_data.controller = PID_YAW;
if ((result = getValues(conn, &pid_data))) { if ((result = getValues(conn, &pid_data))) {
return result; return result;
} }
...@@ -78,15 +78,15 @@ int getValues(struct backend_conn * conn, struct frontend_pid_data * pid_data) { ...@@ -78,15 +78,15 @@ int getValues(struct backend_conn * conn, struct frontend_pid_data * pid_data) {
return 0; return 0;
switch(pid_data->controller) { switch(pid_data->controller) {
case PITCH : case PID_PITCH :
printf("Pitch Constants: P = %f\tI = %f\tD = %f\n", printf("Pitch Constants: P = %f\tI = %f\tD = %f\n",
pid_data->p, pid_data->i, pid_data->d); pid_data->p, pid_data->i, pid_data->d);
break; break;
case ROLL : case PID_ROLL :
printf("Roll Constants: P = %f\tI = %f\tD = %f\n", printf("Roll Constants: P = %f\tI = %f\tD = %f\n",
pid_data->p, pid_data->i, pid_data->d); pid_data->p, pid_data->i, pid_data->d);
break; break;
case YAW : case PID_YAW :
printf("Yaw Constants: P = %f\tI = %f\tD = %f\n", printf("Yaw Constants: P = %f\tI = %f\tD = %f\n",
pid_data->p, pid_data->i, pid_data->d); pid_data->p, pid_data->i, pid_data->d);
break; break;
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
* Example: * Example:
* *
* struct frontend_pid_data pid_data; * struct frontend_pid_data pid_data;
* pid_data.pid = PITCH; * pid_data.pid = PID_PITCH;
* if (frontend_getpid(conn, &pid_data)) { * if (frontend_getpid(conn, &pid_data)) {
* error * error
* } else { * } else {
...@@ -24,13 +24,13 @@ int frontend_getpid( ...@@ -24,13 +24,13 @@ int frontend_getpid(
char line[100] = ""; char line[100] = "";
switch (pid_data->controller) { switch (pid_data->controller) {
case PITCH : case PID_PITCH :
strncpy(line, "getpitchp\ngetpitchd\n", 20); strncpy(line, "getpitchp\ngetpitchd\n", 20);
break; break;
case ROLL : case PID_ROLL :
strncpy(line, "getrollp\ngetrolld\n", 18); strncpy(line, "getrollp\ngetrolld\n", 18);
break; break;
case YAW : case PID_YAW :
strncpy(line, "getyawp\ngetyawd\n", 17); strncpy(line, "getyawp\ngetyawd\n", 17);
break; break;
default : default :
......
...@@ -2,10 +2,16 @@ ...@@ -2,10 +2,16 @@
#define PID_COMMON_H #define PID_COMMON_H
enum pid_controller { enum pid_controller {
PITCH, PID_PITCH,
ROLL, PID_ROLL,
YAW, PID_YAW,
NUM_PIDS PID_PITCH_VELOCITY,
PID_ROLL_VELOCITY,
PID_YAW_VELOCITY,
PID_HEIGHT, /* Z */
PID_LAT, /* X */
PID_LONG, /* Y */
PID_NUM_PIDS
}; };
struct frontend_pid_data { struct frontend_pid_data {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment