From a4474dc750145f4cfc7cb44c1aa794bab8e894ea Mon Sep 17 00:00:00 2001
From: Kris Burney <burneykb@iastate.edu>
Date: Mon, 28 Nov 2016 22:16:13 -0600
Subject: [PATCH] Expanded setpid to use all controller types

---
 groundStation/src/backend/backend.c  |  6 +++++-
 groundStation/src/backend/commands.c |  1 -
 groundStation/src/cli/cli_setpid.c   | 19 +++++++++++++++----
 3 files changed, 20 insertions(+), 6 deletions(-)

diff --git a/groundStation/src/backend/backend.c b/groundStation/src/backend/backend.c
index 15e08b2b8..f56b76698 100644
--- a/groundStation/src/backend/backend.c
+++ b/groundStation/src/backend/backend.c
@@ -671,12 +671,16 @@ static void client_recv(int fd) {
 					write(fd, buffer, strlen(buffer));
 				}
 			}
-
 		} else {
 			if(clientAddPendResponses(fd, packet) == -1) {
 				warnx("Ran out of room! Consider increasing CLIENT_MAX_PENDING_RESPONSES!\n");
 			} else {	
 				int datalen = (packet[6] << 8) | (packet[5]);
+				printf("sending %lf '", getFloat(packet, 7));
+				for(int i = 0; i < datalen + 8; ++i) {
+					printf(" 0x%x", (signed) packet[i]);
+				}
+				printf("'\n");
 				writeQuad((char *) packet, datalen +8);
 			}
 		}
diff --git a/groundStation/src/backend/commands.c b/groundStation/src/backend/commands.c
index 11e68405c..d1efa7e38 100644
--- a/groundStation/src/backend/commands.c
+++ b/groundStation/src/backend/commands.c
@@ -440,7 +440,6 @@ struct MessageType MessageTypes[MAX_TYPE] =
 				// Function pointer
 				&resprollangle
 			},
-
 			// resp yaw setpoint subtype
 			{
 				// ID
diff --git a/groundStation/src/cli/cli_setpid.c b/groundStation/src/cli/cli_setpid.c
index 7347ab72d..b0ed03cf1 100644
--- a/groundStation/src/cli/cli_setpid.c
+++ b/groundStation/src/cli/cli_setpid.c
@@ -18,10 +18,10 @@ int cli_setpid(struct backend_conn * conn,	int argc, char **argv) {
  		{"roll",	no_argument,	&setRoll,	1},
  		{"pitch",   no_argument,   	&setPitch, 	1},
  		{"yaw",   no_argument,   	&setYaw, 	1},
- 		{"rollv",   no_argument,   	&setYawV, 	1},
- 		{"pitchv",   no_argument,   	&setYawV, 	1},
+ 		{"rollv",   no_argument,   	&setRollV, 	1},
+ 		{"pitchv",   no_argument,   &setPitchV, 	1},
  		{"yawv",   no_argument,   	&setYawV, 	1},
- 		{"height",   no_argument,   	&setHeight,	1},
+ 		{"height",   no_argument,   &setHeight,	1},
  		{"lat",   no_argument,   	&setLat, 	1},
  		{"long",   no_argument,   	&setLong, 	1},
  		{0, 0, 0, 0}
@@ -62,9 +62,20 @@ int cli_setpid(struct backend_conn * conn,	int argc, char **argv) {
 		pid_data.controller = PID_YAW;
 	} else if (setPitch) {
 		pid_data.controller = PID_PITCH;
+	} else if (setRollV) {
+		pid_data.controller = PID_ROLL_VELOCITY;
+	} else if (setPitchV) {
+		pid_data.controller = PID_PITCH_VELOCITY;
+	} else if (setYawV) {
+		pid_data.controller = PID_YAW_VELOCITY;
+	} else if (setHeight) {
+		pid_data.controller = PID_HEIGHT;
+	} else if (setLong) {
+		pid_data.controller = PID_LONG;
+	} else if (setLat) {
+		pid_data.controller = PID_LAT;
 	}
 
-
 	frontend_setpid(conn, &pid_data, mask);
 	return 0;
 }
\ No newline at end of file
-- 
GitLab