Skip to content
Snippets Groups Projects
Commit 47e38bee authored by burneykb's avatar burneykb
Browse files

Working with all commands + controller network

parent 084cae0b
No related branches found
No related tags found
No related merge requests found
lat p -0.0081
lat i -0.000104
lat d -0.157
long p 0.0081
long i 0.000104
long d 0.157
height p 1095.83
height i 70.08
height d 4284.1
pitch p 3.355
pitch i 0.0
pitch d 0.0
roll p 3.355
roll i 0.0
roll d 0.0
yaw p 7.423
yaw i 0.0
yaw d 0.0
pitchv p 3375.4
pitchv i 0.0
pitchv d 0.0
rollv p 3375.4
rollv i 0.0
rollv d 0.0
yawv p 47344.3
yawv i 0.0
yawv d 0.0
...@@ -14,4 +14,4 @@ regex='(lat|long|height|pitch|roll|yaw|pitchv|rollv|yawv) (p|i|d) ([-+]?[0-9]*\. ...@@ -14,4 +14,4 @@ regex='(lat|long|height|pitch|roll|yaw|pitchv|rollv|yawv) (p|i|d) ([-+]?[0-9]*\.
awk_prog='{print "./Cli setpid" " " "--" $1 " " "-" $2 " " $3}' awk_prog='{print "./Cli setpid" " " "--" $1 " " "-" $2 " " $3}'
# Search, parse, and execute ./Cli commands # Search, parse, and execute ./Cli commands
grep -E "$regex" $filename | awk "$awk_prog" | bash grep -E "$regex" $filename | awk "$awk_prog" | bash
\ No newline at end of file
lat p -0.01
lat i 0
lat d -0.05
long p 0.01
long i 0
long d 0.05
...@@ -127,10 +127,7 @@ modular_structs_t structs; ...@@ -127,10 +127,7 @@ modular_structs_t structs;
// in the future. // in the future.
static void cb(struct ucart_vrpn_TrackerData * td) { static void cb(struct ucart_vrpn_TrackerData * td) {
static int count = 0; static int count = 0;
sendVrpnPacket(td);
if(!(count % 10)) {
sendVrpnPacket(td);
}
count++; count++;
} }
...@@ -694,7 +691,7 @@ static void client_recv(int fd) { ...@@ -694,7 +691,7 @@ static void client_recv(int fd) {
} }
} }
// printf("packet = '"); // printf("packetToQuad = '");
// for(int i = 0; i < (int)psize; ++i) { // for(int i = 0; i < (int)psize; ++i) {
// printf(" %.2x ", packet[i]); // printf(" %.2x ", packet[i]);
// } // }
...@@ -704,7 +701,6 @@ static void client_recv(int fd) { ...@@ -704,7 +701,6 @@ static void client_recv(int fd) {
} }
char * rest = &buffer[newline] + 1; char * rest = &buffer[newline] + 1;
size_t restLen = (strlen(rest) == 0) ? 1 : strlen(rest); size_t restLen = (strlen(rest) == 0) ? 1 : strlen(rest);
/* Delete parsed data and move the rest to the left */ /* Delete parsed data and move the rest to the left */
...@@ -731,7 +727,7 @@ static void quad_recv() { ...@@ -731,7 +727,7 @@ static void quad_recv() {
} }
respBufLen += respLen; respBufLen += respLen;
// printf("packet = '"); // printf("packetFromQuad = '");
// for(int i = 0; i < (int)respBufLen; ++i) { // for(int i = 0; i < (int)respBufLen; ++i) {
// printf(" %.2x ", respBuf[i]); // printf(" %.2x ", respBuf[i]);
// } // }
...@@ -801,8 +797,7 @@ static void quad_recv() { ...@@ -801,8 +797,7 @@ static void quad_recv() {
default: default:
printf("(Backend): message type %d unrecognized\n", m.msg_type); printf("(Backend): message type %d unrecognized\n", m.msg_type);
} }
} }
} }
static void handleResponseParam(struct metadata *m, uint8_t * data) static void handleResponseParam(struct metadata *m, uint8_t * data)
...@@ -817,7 +812,6 @@ static void handleResponseParam(struct metadata *m, uint8_t * data) ...@@ -817,7 +812,6 @@ static void handleResponseParam(struct metadata *m, uint8_t * data)
const char * message = cmToString(RESPPARAM_ID, &cm); const char * message = cmToString(RESPPARAM_ID, &cm);
size_t len = snprintf(buffer, 128, "%s %f\n", message, cm.value); size_t len = snprintf(buffer, 128, "%s %f\n", message, cm.value);
printf("response = %s\n", buffer);
for(int fd = 0; fd <= max_fd; ++fd) { for(int fd = 0; fd <= max_fd; ++fd) {
if (get_client_index(fd) > -1) { if (get_client_index(fd) > -1) {
......
...@@ -24,14 +24,14 @@ const char * respParamStrings[MAX_PARAM_COMMANDS] = { ...@@ -24,14 +24,14 @@ const char * respParamStrings[MAX_PARAM_COMMANDS] = {
"getlatp", "getlatp",
"getlati", "getlati",
"getlatd", "getlatd",
"getlat",
"getlongp", "getlongp",
"getlongi", "getlongi",
"getlongd", "getlongd",
"getlong",
"getheightp", "getheightp",
"getheighti", "getheighti",
"getheightd", "getheightd",
"getlat",
"getlong",
"getheight" "getheight"
}; };
...@@ -76,10 +76,9 @@ const char * cmToString(int msgType, const struct controller_message *cm) ...@@ -76,10 +76,9 @@ const char * cmToString(int msgType, const struct controller_message *cm)
} else if (cm->id == X_SETPOINT_ID) { } else if (cm->id == X_SETPOINT_ID) {
index = PARAM_LOCAL_Y; // This will change when we make node structure changes index = PARAM_LOCAL_Y; // This will change when we make node structure changes
} else if (cm->id == X_SETPOINT_ID) { } else if (cm->id == X_SETPOINT_ID) {
index = PARMA_ALT; // This will change when we make node structure changes index = PARAM_ALT; // This will change when we make node structure changes
} else { } else {
index = (cm->id * MAX_CONTROL_PARAM_ID) + cm->value_id; index = (cm->id * MAX_CONTROL_PARAM_ID) + cm->value_id;
printf("index = %lu\n", index);
} }
switch (msgType) { switch (msgType) {
case DEBUG_ID : case DEBUG_ID :
...@@ -133,6 +132,7 @@ struct controller_message * stringToCm(const char * string, struct controller_me ...@@ -133,6 +132,7 @@ struct controller_message * stringToCm(const char * string, struct controller_me
break; break;
} }
} }
// printf("index = %d\n", index);
/* Error, nothing found */ /* Error, nothing found */
if (index == -1) { if (index == -1) {
...@@ -167,7 +167,7 @@ struct controller_message * stringToCm(const char * string, struct controller_me ...@@ -167,7 +167,7 @@ struct controller_message * stringToCm(const char * string, struct controller_me
cm->id = ALT_ID; cm->id = ALT_ID;
} else if ( i == PARAM_LOCAL_X) { } else if ( i == PARAM_LOCAL_X) {
cm->id = X_SETPOINT_ID; cm->id = X_SETPOINT_ID;
cm->value_id = 0; cm->value_id = 0;
} else if ( i == PARAM_LOCAL_Y) { } else if ( i == PARAM_LOCAL_Y) {
......
...@@ -57,11 +57,11 @@ enum ControllerID{ ...@@ -57,11 +57,11 @@ enum ControllerID{
ROLL_RATE_ID, // 03 - Roll rate PID ROLL_RATE_ID, // 03 - Roll rate PID
PITCH_RATE_ID, // 04 - Pitch rate PID PITCH_RATE_ID, // 04 - Pitch rate PID
YAW_RATE_ID, // 05 - Yaw rate PID YAW_RATE_ID, // 05 - Yaw rate PID
LOCAL_X_ID, // 06 - Local X PID LOCAL_X_ID, // 06 - Local X PID // lat
LOCAL_Y_ID, // 07 - Local Y PID LOCAL_Y_ID, // 07 - Local Y PID //long
ALT_ID, // 08 - Altitude PID ALT_ID, // 08 - Altitude PID
X_SETPOINT_ID, // 09 - X Setpoint X_SETPOINT_ID, // 09 - X Setpoint //lat
Y_SETPOINT_ID, // 10 - Y Setpoint Y_SETPOINT_ID, // 10 - Y Setpoint //long
ALT_SETPOINT_ID, // 11 - Z Setpoint ALT_SETPOINT_ID, // 11 - Z Setpoint
MAX_CONTROLLER_ID // 12 - Just used to keep track of the size MAX_CONTROLLER_ID // 12 - Just used to keep track of the size
}; };
......
...@@ -143,7 +143,7 @@ int monitor(struct backend_conn * conn) { ...@@ -143,7 +143,7 @@ int monitor(struct backend_conn * conn) {
printf("PosAtt: H LAT LON P R Y\n"); printf("PosAtt: H LAT LON P R Y\n");
printf(" :%10.3lf%10.3lf%10.3lf%10.3lf%10.3lf%10.3lf\n", printf(" :%10.3lf%10.3lf%10.3lf%10.3lf%10.3lf%10.3lf\n",
td.height, td.lateral, td.longitudinal, td.height, td.lateral, td.longitudinal,
td.pitch, td.roll, td.yaw); td.pitch, td.roll, td.yaw); //TODO: Tracker data long and lat are backwards
monitorcounter++; monitorcounter++;
pidcounter = ((pidcounter + 1) % PID_NUM_PIDS); pidcounter = ((pidcounter + 1) % PID_NUM_PIDS);
......
...@@ -93,9 +93,9 @@ int cli_setpid(struct backend_conn * conn, int argc, char **argv) { ...@@ -93,9 +93,9 @@ int cli_setpid(struct backend_conn * conn, int argc, char **argv) {
} else if (setHeight) { } else if (setHeight) {
pid_data.controller = PID_HEIGHT; pid_data.controller = PID_HEIGHT;
} else if (setLong) { } else if (setLong) {
pid_data.controller = PID_LAT;
} else if (setLat) {
pid_data.controller = PID_LONG; pid_data.controller = PID_LONG;
} else if (setLat) {
pid_data.controller = PID_LAT;
} }
frontend_setpid(conn, &pid_data, mask); frontend_setpid(conn, &pid_data, mask);
......
...@@ -9,8 +9,8 @@ enum pid_controller { ...@@ -9,8 +9,8 @@ enum pid_controller {
PID_ROLL_RATE, PID_ROLL_RATE,
PID_YAW_RATE, PID_YAW_RATE,
PID_HEIGHT, /* Z */ PID_HEIGHT, /* Z */
PID_LONG, /* Y */
PID_LAT, /* X */ PID_LAT, /* X */
PID_LONG, /* Y */
PID_NUM_PIDS PID_NUM_PIDS
}; };
......
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