From 1c29f764d6c85c30261722769b080307e2d5ebf6 Mon Sep 17 00:00:00 2001 From: Jake Drahos <j@kedrahos.com> Date: Sun, 27 Nov 2016 19:32:37 -0600 Subject: [PATCH] Added all pid controllers to the enum --- groundStation/src/cli/cli_getpid.c | 18 +++++++++--------- groundStation/src/frontend/frontend_getpid.c | 8 ++++---- groundStation/src/frontend/pid_common.h | 14 ++++++++++---- 3 files changed, 23 insertions(+), 17 deletions(-) diff --git a/groundStation/src/cli/cli_getpid.c b/groundStation/src/cli/cli_getpid.c index 4eead7543..bcf135870 100644 --- a/groundStation/src/cli/cli_getpid.c +++ b/groundStation/src/cli/cli_getpid.c @@ -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; diff --git a/groundStation/src/frontend/frontend_getpid.c b/groundStation/src/frontend/frontend_getpid.c index bd6b387cc..fbde309c3 100644 --- a/groundStation/src/frontend/frontend_getpid.c +++ b/groundStation/src/frontend/frontend_getpid.c @@ -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 : diff --git a/groundStation/src/frontend/pid_common.h b/groundStation/src/frontend/pid_common.h index e4f65625c..efa24df4a 100644 --- a/groundStation/src/frontend/pid_common.h +++ b/groundStation/src/frontend/pid_common.h @@ -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 { -- GitLab