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) {
int result;
if(getAll) {
pid_data.controller = ROLL;
pid_data.controller = PID_ROLL;
if ((result = getValues(conn, &pid_data))) {
return result;
}
pid_data.controller = PITCH;
pid_data.controller = PID_PITCH;
if ((result = getValues(conn, &pid_data))) {
return result;
}
pid_data.controller = YAW;
pid_data.controller = PID_YAW;
if ((result = getValues(conn, &pid_data))) {
return result;
}
} else {
if(getPitch) {
pid_data.controller = PITCH;
pid_data.controller = PID_PITCH;
if ((result = getValues(conn, &pid_data))) {
return result;
}
}
if(getRoll) {
pid_data.controller = ROLL;
pid_data.controller = PID_ROLL;
if ((result = getValues(conn, &pid_data))) {
return result;
}
}
if(getYaw) {
pid_data.controller = YAW;
pid_data.controller = PID_YAW;
if ((result = getValues(conn, &pid_data))) {
return result;
}
......@@ -78,15 +78,15 @@ int getValues(struct backend_conn * conn, struct frontend_pid_data * pid_data) {
return 0;
switch(pid_data->controller) {
case PITCH :
case PID_PITCH :
printf("Pitch Constants: P = %f\tI = %f\tD = %f\n",
pid_data->p, pid_data->i, pid_data->d);
break;
case ROLL :
case PID_ROLL :
printf("Roll Constants: P = %f\tI = %f\tD = %f\n",
pid_data->p, pid_data->i, pid_data->d);
break;
case YAW :
case PID_YAW :
printf("Yaw Constants: P = %f\tI = %f\tD = %f\n",
pid_data->p, pid_data->i, pid_data->d);
break;
......
......@@ -10,7 +10,7 @@
* Example:
*
* struct frontend_pid_data pid_data;
* pid_data.pid = PITCH;
* pid_data.pid = PID_PITCH;
* if (frontend_getpid(conn, &pid_data)) {
* error
* } else {
......@@ -24,13 +24,13 @@ int frontend_getpid(
char line[100] = "";
switch (pid_data->controller) {
case PITCH :
case PID_PITCH :
strncpy(line, "getpitchp\ngetpitchd\n", 20);
break;
case ROLL :
case PID_ROLL :
strncpy(line, "getrollp\ngetrolld\n", 18);
break;
case YAW :
case PID_YAW :
strncpy(line, "getyawp\ngetyawd\n", 17);
break;
default :
......
......@@ -2,10 +2,16 @@
#define PID_COMMON_H
enum pid_controller {
PITCH,
ROLL,
YAW,
NUM_PIDS
PID_PITCH,
PID_ROLL,
PID_YAW,
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 {
......
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