From 41b8f805a8cd673786b465ac8ee5dc379e569cce Mon Sep 17 00:00:00 2001 From: Joe Bush <jpbush@iastate.edu> Date: Fri, 27 Jan 2017 15:57:12 -0600 Subject: [PATCH] added new commands to commands.c and quad's callbacks. also reorganized the ordering of the commands in commands.c added a enum for message types and subtype but this will get removed on the next commit --- groundStation/src/backend/commands.c | 826 +++++++++--------- groundStation/src/backend/commands.h | 136 +++ quad/sw/modular_quad_pid/src/callbacks.c | 118 +-- .../src/initialize_components.c | 2 +- 4 files changed, 594 insertions(+), 488 deletions(-) diff --git a/groundStation/src/backend/commands.c b/groundStation/src/backend/commands.c index 67d8d4735..5c42238af 100644 --- a/groundStation/src/backend/commands.c +++ b/groundStation/src/backend/commands.c @@ -56,130 +56,124 @@ command_cb cb_log __attribute__((weak, alias("cb_default"))); command_cb cb_response __attribute__((weak, alias("cb_default"))); /* Callbacks for configuration (setters)*/ -command_cb cb_setyawp __attribute__((weak, alias("cb_default"))); -command_cb cb_setyawi __attribute__((weak, alias("cb_default"))); -command_cb cb_setyawd __attribute__((weak, alias("cb_default"))); command_cb cb_setrollp __attribute__((weak, alias("cb_default"))); command_cb cb_setrolli __attribute__((weak, alias("cb_default"))); command_cb cb_setrolld __attribute__((weak, alias("cb_default"))); command_cb cb_setpitchp __attribute__((weak, alias("cb_default"))); command_cb cb_setpitchi __attribute__((weak, alias("cb_default"))); command_cb cb_setpitchd __attribute__((weak, alias("cb_default"))); -command_cb cb_setyawratep __attribute__((weak, alias("cb_default"))); -command_cb cb_setyawratei __attribute__((weak, alias("cb_default"))); -command_cb cb_setyawrated __attribute__((weak, alias("cb_default"))); +command_cb cb_setyawp __attribute__((weak, alias("cb_default"))); +command_cb cb_setyawi __attribute__((weak, alias("cb_default"))); +command_cb cb_setyawd __attribute__((weak, alias("cb_default"))); command_cb cb_setrollratep __attribute__((weak, alias("cb_default"))); command_cb cb_setrollratei __attribute__((weak, alias("cb_default"))); command_cb cb_setrollrated __attribute__((weak, alias("cb_default"))); command_cb cb_setpitchratep __attribute__((weak, alias("cb_default"))); command_cb cb_setpitchratei __attribute__((weak, alias("cb_default"))); command_cb cb_setpitchrated __attribute__((weak, alias("cb_default"))); -command_cb cb_setxp __attribute__((weak, alias("cb_default"))); -command_cb cb_setxi __attribute__((weak, alias("cb_default"))); -command_cb cb_setxd __attribute__((weak, alias("cb_default"))); -command_cb cb_setyp __attribute__((weak, alias("cb_default"))); -command_cb cb_setyi __attribute__((weak, alias("cb_default"))); -command_cb cb_setyd __attribute__((weak, alias("cb_default"))); -command_cb cb_setheightp __attribute__((weak, alias("cb_default"))); -command_cb cb_setheighti __attribute__((weak, alias("cb_default"))); -command_cb cb_setheightd __attribute__((weak, alias("cb_default"))); -command_cb cb_setheight __attribute__((weak, alias("cb_default"))); -command_cb cb_setx __attribute__((weak, alias("cb_default"))); -command_cb cb_sety __attribute__((weak, alias("cb_default"))); -command_cb cb_setlon __attribute__((weak, alias("cb_default"))); -command_cb cb_setlat __attribute__((weak, alias("cb_default"))); -command_cb cb_setyaw __attribute__((weak, alias("cb_default"))); -command_cb cb_setpitch __attribute__((weak, alias("cb_default"))); -command_cb cb_setroll __attribute__((weak, alias("cb_default"))); +command_cb cb_setyawratep __attribute__((weak, alias("cb_default"))); +command_cb cb_setyawratei __attribute__((weak, alias("cb_default"))); +command_cb cb_setyawrated __attribute__((weak, alias("cb_default"))); +command_cb cb_setlocalxp __attribute__((weak, alias("cb_default"))); +command_cb cb_setlocalxi __attribute__((weak, alias("cb_default"))); +command_cb cb_setlocalxd __attribute__((weak, alias("cb_default"))); +command_cb cb_setlocalyp __attribute__((weak, alias("cb_default"))); +command_cb cb_setlocalyi __attribute__((weak, alias("cb_default"))); +command_cb cb_setlocalyd __attribute__((weak, alias("cb_default"))); +command_cb cb_setaltp __attribute__((weak, alias("cb_default"))); +command_cb cb_setalti __attribute__((weak, alias("cb_default"))); +command_cb cb_setaltd __attribute__((weak, alias("cb_default"))); +command_cb cb_setrollsp __attribute__((weak, alias("cb_default"))); +command_cb cb_setpitchsp __attribute__((weak, alias("cb_default"))); +command_cb cb_setyawsp __attribute__((weak, alias("cb_default"))); +command_cb cb_setaltsp __attribute__((weak, alias("cb_default"))); +command_cb cb_setlonsp __attribute__((weak, alias("cb_default"))); +command_cb cb_setlatsp __attribute__((weak, alias("cb_default"))); /* Default callbacks for getters */ -command_cb cb_getyawp __attribute__((weak, alias("cb_default"))); -command_cb cb_getyawi __attribute__((weak, alias("cb_default"))); -command_cb cb_getyawd __attribute__((weak, alias("cb_default"))); command_cb cb_getrollp __attribute__((weak, alias("cb_default"))); command_cb cb_getrolli __attribute__((weak, alias("cb_default"))); command_cb cb_getrolld __attribute__((weak, alias("cb_default"))); command_cb cb_getpitchp __attribute__((weak, alias("cb_default"))); command_cb cb_getpitchi __attribute__((weak, alias("cb_default"))); command_cb cb_getpitchd __attribute__((weak, alias("cb_default"))); -command_cb cb_getyawratep __attribute__((weak, alias("cb_default"))); -command_cb cb_getyawratei __attribute__((weak, alias("cb_default"))); -command_cb cb_getyawrated __attribute__((weak, alias("cb_default"))); +command_cb cb_getyawp __attribute__((weak, alias("cb_default"))); +command_cb cb_getyawi __attribute__((weak, alias("cb_default"))); +command_cb cb_getyawd __attribute__((weak, alias("cb_default"))); command_cb cb_getrollratep __attribute__((weak, alias("cb_default"))); command_cb cb_getrollratei __attribute__((weak, alias("cb_default"))); command_cb cb_getrollrated __attribute__((weak, alias("cb_default"))); command_cb cb_getpitchratep __attribute__((weak, alias("cb_default"))); command_cb cb_getpitchratei __attribute__((weak, alias("cb_default"))); command_cb cb_getpitchrated __attribute__((weak, alias("cb_default"))); -command_cb cb_getxp __attribute__((weak, alias("cb_default"))); -command_cb cb_getxi __attribute__((weak, alias("cb_default"))); -command_cb cb_getxd __attribute__((weak, alias("cb_default"))); -command_cb cb_getyp __attribute__((weak, alias("cb_default"))); -command_cb cb_getyi __attribute__((weak, alias("cb_default"))); -command_cb cb_getyd __attribute__((weak, alias("cb_default"))); -command_cb cb_getheightp __attribute__((weak, alias("cb_default"))); -command_cb cb_getheighti __attribute__((weak, alias("cb_default"))); -command_cb cb_getheightd __attribute__((weak, alias("cb_default"))); -command_cb cb_getheight __attribute__((weak, alias("cb_default"))); -command_cb cb_getx __attribute__((weak, alias("cb_default"))); -command_cb cb_gety __attribute__((weak, alias("cb_default"))); -command_cb cb_getlon __attribute__((weak, alias("cb_default"))); -command_cb cb_getlat __attribute__((weak, alias("cb_default"))); -command_cb cb_getyaw __attribute__((weak, alias("cb_default"))); -command_cb cb_getpitch __attribute__((weak, alias("cb_default"))); -command_cb cb_getroll __attribute__((weak, alias("cb_default"))); +command_cb cb_getyawratep __attribute__((weak, alias("cb_default"))); +command_cb cb_getyawratei __attribute__((weak, alias("cb_default"))); +command_cb cb_getyawrated __attribute__((weak, alias("cb_default"))); +command_cb cb_getlocalxp __attribute__((weak, alias("cb_default"))); +command_cb cb_getlocalxi __attribute__((weak, alias("cb_default"))); +command_cb cb_getlocalxd __attribute__((weak, alias("cb_default"))); +command_cb cb_getlocalyp __attribute__((weak, alias("cb_default"))); +command_cb cb_getlocalyi __attribute__((weak, alias("cb_default"))); +command_cb cb_getlocalyd __attribute__((weak, alias("cb_default"))); +command_cb cb_getaltp __attribute__((weak, alias("cb_default"))); +command_cb cb_getalti __attribute__((weak, alias("cb_default"))); +command_cb cb_getaltd __attribute__((weak, alias("cb_default"))); +command_cb cb_getrollsp __attribute__((weak, alias("cb_default"))); +command_cb cb_getpitchsp __attribute__((weak, alias("cb_default"))); +command_cb cb_getyawsp __attribute__((weak, alias("cb_default"))); +command_cb cb_getaltsp __attribute__((weak, alias("cb_default"))); +command_cb cb_getlonsp __attribute__((weak, alias("cb_default"))); +command_cb cb_getlatsp __attribute__((weak, alias("cb_default"))); /* Default callbacks for responses */ -command_cb cb_respyawp __attribute__((weak, alias("cb_default"))); -command_cb cb_respyawi __attribute__((weak, alias("cb_default"))); -command_cb cb_respyawd __attribute__((weak, alias("cb_default"))); command_cb cb_resprollp __attribute__((weak, alias("cb_default"))); command_cb cb_resprolli __attribute__((weak, alias("cb_default"))); command_cb cb_resprolld __attribute__((weak, alias("cb_default"))); command_cb cb_resppitchp __attribute__((weak, alias("cb_default"))); command_cb cb_resppitchi __attribute__((weak, alias("cb_default"))); command_cb cb_resppitchd __attribute__((weak, alias("cb_default"))); -command_cb cb_respyawratep __attribute__((weak, alias("cb_default"))); -command_cb cb_respyawratei __attribute__((weak, alias("cb_default"))); -command_cb cb_respyawrated __attribute__((weak, alias("cb_default"))); +command_cb cb_respyawp __attribute__((weak, alias("cb_default"))); +command_cb cb_respyawi __attribute__((weak, alias("cb_default"))); +command_cb cb_respyawd __attribute__((weak, alias("cb_default"))); command_cb cb_resprollratep __attribute__((weak, alias("cb_default"))); command_cb cb_resprollratei __attribute__((weak, alias("cb_default"))); command_cb cb_resprollrated __attribute__((weak, alias("cb_default"))); command_cb cb_resppitchratep __attribute__((weak, alias("cb_default"))); command_cb cb_resppitchratei __attribute__((weak, alias("cb_default"))); command_cb cb_resppitchrated __attribute__((weak, alias("cb_default"))); -command_cb cb_respxp __attribute__((weak, alias("cb_default"))); -command_cb cb_respxi __attribute__((weak, alias("cb_default"))); -command_cb cb_respxd __attribute__((weak, alias("cb_default"))); -command_cb cb_respyp __attribute__((weak, alias("cb_default"))); -command_cb cb_respyi __attribute__((weak, alias("cb_default"))); -command_cb cb_respyd __attribute__((weak, alias("cb_default"))); -command_cb cb_respheightp __attribute__((weak, alias("cb_default"))); -command_cb cb_respheighti __attribute__((weak, alias("cb_default"))); -command_cb cb_respheightd __attribute__((weak, alias("cb_default"))); -command_cb cb_respheight __attribute__((weak, alias("cb_default"))); -command_cb cb_respx __attribute__((weak, alias("cb_default"))); -command_cb cb_respy __attribute__((weak, alias("cb_default"))); -command_cb cb_resplon __attribute__((weak, alias("cb_default"))); -command_cb cb_resplat __attribute__((weak, alias("cb_default"))); -command_cb cb_respyaw __attribute__((weak, alias("cb_default"))); -command_cb cb_resppitch __attribute__((weak, alias("cb_default"))); -command_cb cb_resproll __attribute__((weak, alias("cb_default"))); +command_cb cb_respyawratep __attribute__((weak, alias("cb_default"))); +command_cb cb_respyawratei __attribute__((weak, alias("cb_default"))); +command_cb cb_respyawrated __attribute__((weak, alias("cb_default"))); +command_cb cb_resplocalxp __attribute__((weak, alias("cb_default"))); +command_cb cb_resplocalxi __attribute__((weak, alias("cb_default"))); +command_cb cb_resplocalxd __attribute__((weak, alias("cb_default"))); +command_cb cb_resplocalyp __attribute__((weak, alias("cb_default"))); +command_cb cb_resplocalyi __attribute__((weak, alias("cb_default"))); +command_cb cb_resplocalyd __attribute__((weak, alias("cb_default"))); +command_cb cb_respaltp __attribute__((weak, alias("cb_default"))); +command_cb cb_respalti __attribute__((weak, alias("cb_default"))); +command_cb cb_respaltd __attribute__((weak, alias("cb_default"))); +command_cb cb_resprollsp __attribute__((weak, alias("cb_default"))); +command_cb cb_resppitchsp __attribute__((weak, alias("cb_default"))); +command_cb cb_respyawsp __attribute__((weak, alias("cb_default"))); +command_cb cb_respaltsp __attribute__((weak, alias("cb_default"))); +command_cb cb_resplonsp __attribute__((weak, alias("cb_default"))); +command_cb cb_resplatsp __attribute__((weak, alias("cb_default"))); /* Command structure */ struct MessageType MessageTypes[MAX_TYPE] = { // DEBUG { - // Message Type ID - 0x00, + // Message Type ID: Misc. callbacks + DEBUG_TYPE_ID, // Debug Subtypes { // NONE subtype { // ID - 0x00, + DEBUG_SUBTYPE_ID, // Command text "debug", // Type of the command data @@ -190,7 +184,7 @@ struct MessageType MessageTypes[MAX_TYPE] = // NONE subtype { // ID - 0x01, + PACKETLOG_SUBTYPE_ID, // Command text "packetlog", // Type of the command data @@ -201,7 +195,7 @@ struct MessageType MessageTypes[MAX_TYPE] = // NONE subtype { // ID - 0x02, + GETPACKETLOGS_SUBTYPE_ID, // Command text "getpacketlogs", // Type of the command data @@ -214,48 +208,15 @@ struct MessageType MessageTypes[MAX_TYPE] = // CALIBRATION { - // Message Type ID - 0x01, + // Message Type ID: Callbacks for configuration (setters) + SETTER_TYPE_ID, // Calibration Subtypes (PID coefficients) { - // yaw p constant subtype - { - // ID - 0x00, - // Command text - "setyawp", - // Type of the command data - floatType, - // Function pointer - &cb_setyawp - }, - // yaw i constant subtype - { - // ID - 0x01, - // Command text - "setyawi", - // Type of the command data - floatType, - // Function pointer - &cb_setyawi - }, - // yaw d constant subtype - { - // ID - 0x02, - // Command text - "setyawd", - // Type of the command data - floatType, - // Function pointer - &cb_setyawd - }, // roll p constant subtype { // ID - 0x03, + SETROLLP_SUBTYPE_ID, // Command text "setrollp", // Type of the command data @@ -266,7 +227,7 @@ struct MessageType MessageTypes[MAX_TYPE] = // roll i constant subtype { // ID - 0x04, + SETROLLI_SUBTYPE_ID, // Command text "setrolli", // Type of the command data @@ -277,7 +238,7 @@ struct MessageType MessageTypes[MAX_TYPE] = // roll d constant subtype { // ID - 0x05, + SETROLLD_SUBTYPE_ID, // Command text "setrolld", // Type of the command data @@ -288,7 +249,7 @@ struct MessageType MessageTypes[MAX_TYPE] = // pitch p constant subtype { // ID - 0x06, + SETPITCHP_SUBTYPE_ID, // Command text "setpitchp", // Type of the command data @@ -299,7 +260,7 @@ struct MessageType MessageTypes[MAX_TYPE] = // pitch i constant subtype { // ID - 0x07, + SETPITCHI_SUBTYPE_ID, // Command text "setpitchi", // Type of the command data @@ -310,7 +271,7 @@ struct MessageType MessageTypes[MAX_TYPE] = // pitch d constant subtype { // ID - 0x08, + SETPITCHD_SUBTYPE_ID, // Command text "setpitchd", // Type of the command data @@ -318,43 +279,43 @@ struct MessageType MessageTypes[MAX_TYPE] = // Function pointer &cb_setpitchd }, - // yawrate p constant subtype + // yaw p constant subtype { // ID - 0x09, + SETYAWP_SUBTYPE_ID, // Command text - "setyawratep", + "setyawp", // Type of the command data floatType, // Function pointer - &cb_setyawratep + &cb_setyawp }, - // yawrate i constant subtype + // yaw i constant subtype { // ID - 0x0A, + SETYAWI_SUBTYPE_ID, // Command text - "setyawratei", + "setyawi", // Type of the command data floatType, // Function pointer - &cb_setyawratei + &cb_setyawi }, - // yawrate d constant subtype + // yaw d constant subtype { // ID - 0x0B, + SETYAWD_SUBTYPE_ID, // Command text - "setyawrated", + "setyawd", // Type of the command data floatType, // Function pointer - &cb_setyawrated + &cb_setyawd }, // rollrate p constant subtype { // ID - 0x0C, + SETROLLRATEP_SUBTYPE_ID, // Command text "setrollratep", // Type of the command data @@ -365,7 +326,7 @@ struct MessageType MessageTypes[MAX_TYPE] = // rollrate i constant subtype { // ID - 0x0D, + SETROLLRATEI_SUBTYPE_ID, // Command text "setrollratei", // Type of the command data @@ -376,7 +337,7 @@ struct MessageType MessageTypes[MAX_TYPE] = // rollrate d constant subtype { // ID - 0x0E, + SETROLLRATED_SUBTYPE_ID, // Command text "setrollrated", // Type of the command data @@ -387,7 +348,7 @@ struct MessageType MessageTypes[MAX_TYPE] = // pitchrate p constant subtype { // ID - 0x0F, + SETPITCHRATEP_SUBTYPE_ID, // Command text "setpitchratep", // Type of the command data @@ -398,7 +359,7 @@ struct MessageType MessageTypes[MAX_TYPE] = // pitchrate i constant subtype { // ID - 0x10, + SETPITCHRATEI_SUBTYPE_ID, // Command text "setpitchratei", // Type of the command data @@ -409,7 +370,7 @@ struct MessageType MessageTypes[MAX_TYPE] = // pitchrate d constant subtype { // ID - 0x11, + SETPITCHRATED_SUBTYPE_ID, // Command text "setpitchrated", // Type of the command data @@ -417,218 +378,218 @@ struct MessageType MessageTypes[MAX_TYPE] = // Function pointer &cb_setpitchrated }, - // height p constant subtype + // yawrate p constant subtype { // ID - 0x12, + SETYAWRATEP_SUBTYPE_ID, // Command text - "setheightp", + "setyawratep", // Type of the command data floatType, // Function pointer - &cb_setheightp + &cb_setyawratep }, - // height i constant subtype + // yawrate i constant subtype { // ID - 0x13, + SETYAWRATEI_SUBTYPE_ID, // Command text - "setheighti", + "setyawratei", // Type of the command data floatType, // Function pointer - &cb_setheighti + &cb_setyawratei }, - // height d constant subtype + // yawrate d constant subtype { // ID - 0x14, + SETYAWRATED_SUBTYPE_ID, // Command text - "setheightd", + "setyawrated", // Type of the command data floatType, // Function pointer - &cb_setheightd + &cb_setyawrated }, - // x p constant subtype + // localx p constant subtype { // ID - 0x15, + SETLOCALXP_SUBTYPE_ID, // Command text - "setxp", + "setlocalxp", // Type of the command data floatType, // Function pointer - &cb_setxp + &cb_setlocalxp }, - // x i constant subtype + // localx i constant subtype { // ID - 0x16, + SETLOCALXI_SUBTYPE_ID, // Command text - "setxi", + "setlocalxi", // Type of the command data floatType, // Function pointer - &cb_setxi + &cb_setlocalxi }, - // x d constant subtype + // localx d constant subtype { // ID - 0x17, + SETLOCALXD_SUBTYPE_ID, // Command text - "setxd", + "setlocalxd", // Type of the command data floatType, // Function pointer - &cb_setxd + &cb_setlocalxd }, - // y p constant subtype + // localy p constant subtype { // ID - 0x18, + SETLOCALYP_SUBTYPE_ID, // Command text - "setyp", + "setlocalyp", // Type of the command data floatType, // Function pointer - &cb_setyp + &cb_setlocalyp }, - // y i constant subtype + // localy i constant subtype { // ID - 0x19, + SETLOCALYI_SUBTYPE_ID, // Command text - "setyi", + "setlocalyi", // Type of the command data floatType, // Function pointer - &cb_setyi + &cb_setlocalyi }, - // y d constant subtype + // localy d constant subtype { // ID - 0x1A, + SETLOCALYD_SUBTYPE_ID, // Command text - "setyd", + "setlocalyd", // Type of the command data floatType, // Function pointer - &cb_setyd + &cb_setlocalyd }, - // height setpoint subtype + // alt p constant subtype { // ID - 0x1B, + SETALTP_SUBTYPE_ID, // Command text - "setheight", + "setaltp", // Type of the command data floatType, // Function pointer - &cb_setheight + &cb_setaltp }, - // x setpoint subtype + // alt i constant subtype { // ID - 0x1C, + SETALTI_SUBTYPE_ID, // Command text - "setx", + "setalti", // Type of the command data floatType, // Function pointer - &cb_setx + &cb_setalti }, - // y setpoint subtype + // alt d constant subtype { // ID - 0x1D, + SETALTD_SUBTYPE_ID, // Command text - "sety", + "setaltd", // Type of the command data floatType, // Function pointer - &cb_sety + &cb_setaltd }, - // yaw setpoint subtype + // rollsp setpoint subtype { // ID - 0x1E, + SETROLLSP_SUBTYPE_ID, // Command text - "setyaw", + "setrollsp", // Type of the command data floatType, // Function pointer - &cb_setyaw + &cb_setrollsp }, - // pitch setpoint subtype + // pitchsp setpoint subtype { // ID - 0x1F, + SETPITCHSP_SUBTYPE_ID, // Command text - "setpitch", + "setpitchsp", // Type of the command data floatType, // Function pointer - &cb_setpitch + &cb_setpitchsp }, - // roll setpoint subtype + // yawsp setpoint subtype { // ID - 0x20, + SETYAWSP_SUBTYPE_ID, // Command text - "setroll", + "setyawsp", // Type of the command data floatType, // Function pointer - &cb_setroll - } - } - }, - - // REQUEST - { - // Message Type ID - 0x02, - - // Calibration Subtypes (PID coefficients) - { - // yaw p constant subtype + &cb_setyawsp + }, + // altsp setpoint subtype { // ID - 0x00, + SETALTSP_SUBTYPE_ID, // Command text - "getyawp", + "setaltsp", // Type of the command data floatType, // Function pointer - &cb_getyawp + &cb_setaltsp }, - // yaw i constant subtype + // lonsp setpoint subtype { // ID - 0x01, + SETLONSP_SUBTYPE_ID, // Command text - "getyawi", + "setlonsp", // Type of the command data floatType, // Function pointer - &cb_getyawi + &cb_setlonsp }, - // yaw d constant subtype + // latsp setpoint subtype { // ID - 0x02, + SETLATSP_SUBTYPE_ID, // Command text - "getyawd", + "setlatsp", // Type of the command data floatType, // Function pointer - &cb_getyawd - }, + &cb_setlatsp + } + } + }, + + // REQUEST + { + // Message Type ID + GETTER_TYPE_ID, + + // Calibration Subtypes (PID coefficients) + { // roll p constant subtype { // ID - 0x03, + GETROLLP_SUBTYPE_ID, // Command text "getrollp", // Type of the command data @@ -639,7 +600,7 @@ struct MessageType MessageTypes[MAX_TYPE] = // roll i constant subtype { // ID - 0x04, + GETROLLI_SUBTYPE_ID, // Command text "getrolli", // Type of the command data @@ -650,7 +611,7 @@ struct MessageType MessageTypes[MAX_TYPE] = // roll d constant subtype { // ID - 0x05, + GETROLLD_SUBTYPE_ID, // Command text "getrolld", // Type of the command data @@ -661,7 +622,7 @@ struct MessageType MessageTypes[MAX_TYPE] = // pitch p constant subtype { // ID - 0x06, + GETPITCHP_SUBTYPE_ID, // Command text "getpitchp", // Type of the command data @@ -672,7 +633,7 @@ struct MessageType MessageTypes[MAX_TYPE] = // pitch i constant subtype { // ID - 0x07, + GETPITCHI_SUBTYPE_ID, // Command text "getpitchi", // Type of the command data @@ -683,7 +644,7 @@ struct MessageType MessageTypes[MAX_TYPE] = // pitch d constant subtype { // ID - 0x08, + GETPITCHD_SUBTYPE_ID, // Command text "getpitchd", // Type of the command data @@ -691,43 +652,43 @@ struct MessageType MessageTypes[MAX_TYPE] = // Function pointer &cb_getpitchd }, - // yawrate p constant subtype + // yaw p constant subtype { // ID - 0x09, + GETYAWP_SUBTYPE_ID, // Command text - "getyawratep", + "getyawp", // Type of the command data floatType, // Function pointer - &cb_getyawratep + &cb_getyawp }, - // yawrate i constant subtype + // yaw i constant subtype { // ID - 0x0A, + GETYAWI_SUBTYPE_ID, // Command text - "getyawratei", + "getyawi", // Type of the command data floatType, // Function pointer - &cb_getyawratei + &cb_getyawi }, - // yawrate d constant subtype + // yaw d constant subtype { // ID - 0x0B, + GETYAWD_SUBTYPE_ID, // Command text - "getyawrated", + "getyawd", // Type of the command data floatType, // Function pointer - &cb_getyawrated + &cb_getyawd }, // rollrate p constant subtype { // ID - 0x0C, + GETROLLRATEP_SUBTYPE_ID, // Command text "getrollratep", // Type of the command data @@ -738,7 +699,7 @@ struct MessageType MessageTypes[MAX_TYPE] = // rollrate i constant subtype { // ID - 0x0D, + GETROLLRATEI_SUBTYPE_ID, // Command text "getrollratei", // Type of the command data @@ -749,7 +710,7 @@ struct MessageType MessageTypes[MAX_TYPE] = // rollrate d constant subtype { // ID - 0x0E, + GETROLLRATED_SUBTYPE_ID, // Command text "getrollrated", // Type of the command data @@ -760,7 +721,7 @@ struct MessageType MessageTypes[MAX_TYPE] = // pitchrate p constant subtype { // ID - 0x0F, + GETPITCHRATEP_SUBTYPE_ID, // Command text "getpitchratep", // Type of the command data @@ -771,7 +732,7 @@ struct MessageType MessageTypes[MAX_TYPE] = // pitchrate i constant subtype { // ID - 0x10, + GETPITCHRATEI_SUBTYPE_ID, // Command text "getpitchratei", // Type of the command data @@ -782,7 +743,7 @@ struct MessageType MessageTypes[MAX_TYPE] = // pitchrate d constant subtype { // ID - 0x11, + GETPITCHRATED_SUBTYPE_ID, // Command text "getpitchrated", // Type of the command data @@ -790,219 +751,219 @@ struct MessageType MessageTypes[MAX_TYPE] = // Function pointer &cb_getpitchrated }, - // height p constant subtype + // yawrate p constant subtype { // ID - 0x12, + GETYAWRATEP_SUBTYPE_ID, // Command text - "getheightp", + "getyawratep", // Type of the command data floatType, // Function pointer - &cb_getheightp + &cb_getyawratep }, - // height i constant subtype + // yawrate i constant subtype { // ID - 0x13, + GETYAWRATEI_SUBTYPE_ID, // Command text - "getheighti", + "getyawratei", // Type of the command data floatType, // Function pointer - &cb_getheighti + &cb_getyawratei }, - // height d constant subtype + // yawrate d constant subtype { // ID - 0x14, + GETYAWRATED_SUBTYPE_ID, // Command text - "getheightd", + "getyawrated", // Type of the command data floatType, // Function pointer - &cb_getheightd + &cb_getyawrated }, - // x p constant subtype + // localx p constant subtype { // ID - 0x15, + GETLOCALXP_SUBTYPE_ID, // Command text - "getxp", + "getlocalxp", // Type of the command data floatType, // Function pointer - &cb_getxp + &cb_getlocalxp }, - // x i constant subtype + // localx i constant subtype { // ID - 0x16, + GETLOCALXI_SUBTYPE_ID, // Command text - "getxi", + "getlocalxi", // Type of the command data floatType, // Function pointer - &cb_getxi + &cb_getlocalxi }, - // x d constant subtype + // localx d constant subtype { // ID - 0x17, + GETLOCALXD_SUBTYPE_ID, // Command text - "getxd", + "getlocalxd", // Type of the command data floatType, // Function pointer - &cb_getxd + &cb_getlocalxd }, - // y p constant subtype + // localy p constant subtype { // ID - 0x18, + GETLOCALYP_SUBTYPE_ID, // Command text - "getyp", + "getlocalyp", // Type of the command data floatType, // Function pointer - &cb_getyp + &cb_getlocalyp }, - // y i constant subtype + // localy i constant subtype { // ID - 0x19, + GETLOCALYI_SUBTYPE_ID, // Command text - "getyi", + "getlocalyi", // Type of the command data floatType, // Function pointer - &cb_getyi + &cb_getlocalyi }, - // y d constant subtype + // localy d constant subtype { // ID - 0x1A, + GETLOCALYD_SUBTYPE_ID, // Command text - "getyd", + "getlocalyd", // Type of the command data floatType, // Function pointer - &cb_getyd + &cb_getlocalyd }, - // height setpoint subtype + // alt p constant subtype { // ID - 0x1B, + GETALTP_SUBTYPE_ID, // Command text - "getheight", + "getaltp", // Type of the command data floatType, // Function pointer - &cb_getheight + &cb_getaltp }, - // x getpoint subtype + // alt i constant subtype { // ID - 0x1C, + GETALTI_SUBTYPE_ID, // Command text - "getx", + "getalti", // Type of the command data floatType, // Function pointer - &cb_getx + &cb_getalti }, - // y getpoint subtype + // alt d constant subtype { // ID - 0x1D, + GETALTD_SUBTYPE_ID, // Command text - "gety", + "getaltd", // Type of the command data floatType, // Function pointer - &cb_gety + &cb_getaltd }, - // yaw getpoint subtype + // rollsp setpoint subtype { // ID - 0x1E, + GETROLLSP_SUBTYPE_ID, // Command text - "getyaw", + "getrollsp", // Type of the command data floatType, // Function pointer - &cb_getyaw + &cb_getrollsp }, - // pitch getpoint subtype + // pitchsp getpoint subtype { // ID - 0x1F, + GETPITCHSP_SUBTYPE_ID, // Command text - "getpitch", + "getpitchsp", // Type of the command data floatType, // Function pointer - &cb_getpitch + &cb_getpitchsp }, - // roll getpoint subtype + // yawsp getpoint subtype { // ID - 0x20, + GETYAWSP_SUBTYPE_ID, // Command text - "getroll", + "getyawsp", // Type of the command data floatType, // Function pointer - &cb_getroll - } - - } - }, - - // RESPONSE - { - // Message Type ID - 0x03, - - // Calibration Subtypes (PID coefficients) - { - // yaw p constant subtype + &cb_getyawsp + }, + // altsp getpoint subtype { // ID - 0x00, + GETALTSP_SUBTYPE_ID, // Command text - "respyawp", + "getaltsp", // Type of the command data floatType, // Function pointer - &cb_respyawp + &cb_getaltsp }, - // yaw i constant subtype + // lonsp getpoint subtype { // ID - 0x01, + GETLONSP_SUBTYPE_ID, // Command text - "respyawi", + "getlonsp", // Type of the command data floatType, // Function pointer - &cb_respyawi + &cb_getlonsp }, - // yaw d constant subtype + // latsp getpoint subtype { // ID - 0x02, + GETLATSP_SUBTYPE_ID, // Command text - "respyawd", + "getlatsp", // Type of the command data floatType, // Function pointer - &cb_respyawd - }, + &cb_getlatsp + } + + } + }, + + // RESPONSE + { + // Message Type ID + RESP_TYPE_ID, + + // Calibration Subtypes (PID coefficients) + { // roll p constant subtype { // ID - 0x03, + RESPROLLP_SUBTYPE_ID, // Command text "resprollp", // Type of the command data @@ -1013,7 +974,7 @@ struct MessageType MessageTypes[MAX_TYPE] = // roll i constant subtype { // ID - 0x04, + RESPROLLI_SUBTYPE_ID, // Command text "resprolli", // Type of the command data @@ -1024,7 +985,7 @@ struct MessageType MessageTypes[MAX_TYPE] = // roll d constant subtype { // ID - 0x05, + RESPROLLD_SUBTYPE_ID, // Command text "resprolld", // Type of the command data @@ -1035,7 +996,7 @@ struct MessageType MessageTypes[MAX_TYPE] = // pitch p constant subtype { // ID - 0x06, + RESPPITCHP_SUBTYPE_ID, // Command text "resppitchp", // Type of the command data @@ -1046,7 +1007,7 @@ struct MessageType MessageTypes[MAX_TYPE] = // pitch i constant subtype { // ID - 0x07, + RESPPITCHI_SUBTYPE_ID, // Command text "resppitchi", // Type of the command data @@ -1057,7 +1018,7 @@ struct MessageType MessageTypes[MAX_TYPE] = // pitch d constant subtype { // ID - 0x08, + RESPPITCHD_SUBTYPE_ID, // Command text "resppitchd", // Type of the command data @@ -1065,43 +1026,43 @@ struct MessageType MessageTypes[MAX_TYPE] = // Function pointer &cb_resppitchd }, - // yawrate p constant subtype + // yaw p constant subtype { // ID - 0x09, + RESPYAWP_SUBTYPE_ID, // Command text - "respyawratep", + "respyawp", // Type of the command data floatType, // Function pointer - &cb_respyawratep + &cb_respyawp }, - // yawrate i constant subtype + // yaw i constant subtype { // ID - 0x0A, + RESPYAWI_SUBTYPE_ID, // Command text - "respyawratei", + "respyawi", // Type of the command data floatType, // Function pointer - &cb_respyawratei + &cb_respyawi }, - // yawrate d constant subtype + // yaw d constant subtype { // ID - 0x0B, + RESPYAWD_SUBTYPE_ID, // Command text - "respyawrated", + "respyawd", // Type of the command data floatType, // Function pointer - &cb_respyawrated + &cb_respyawd }, // rollrate p constant subtype { // ID - 0x0C, + RESPROLLRATEP_SUBTYPE_ID, // Command text "resprollratep", // Type of the command data @@ -1112,7 +1073,7 @@ struct MessageType MessageTypes[MAX_TYPE] = // rollrate i constant subtype { // ID - 0x0D, + RESPROLLRATEI_SUBTYPE_ID, // Command text "resprollratei", // Type of the command data @@ -1123,7 +1084,7 @@ struct MessageType MessageTypes[MAX_TYPE] = // rollrate d constant subtype { // ID - 0x0E, + RESPROLLRATED_SUBTYPE_ID, // Command text "resprollrated", // Type of the command data @@ -1134,7 +1095,7 @@ struct MessageType MessageTypes[MAX_TYPE] = // pitchrate p constant subtype { // ID - 0x0F, + RESPPITCHRATEP_SUBTYPE_ID, // Command text "resppitchratep", // Type of the command data @@ -1145,7 +1106,7 @@ struct MessageType MessageTypes[MAX_TYPE] = // pitchrate i constant subtype { // ID - 0x10, + RESPPITCHRATEI_SUBTYPE_ID, // Command text "resppitchratei", // Type of the command data @@ -1156,7 +1117,7 @@ struct MessageType MessageTypes[MAX_TYPE] = // pitchrate d constant subtype { // ID - 0x11, + RESPPITCHRATED_SUBTYPE_ID, // Command text "resppitchrated", // Type of the command data @@ -1164,184 +1125,217 @@ struct MessageType MessageTypes[MAX_TYPE] = // Function pointer &cb_resppitchrated }, - // height p constant subtype + // yawrate p constant subtype + { + // ID + RESPYAWRATEP_SUBTYPE_ID, + // Command text + "respyawratep", + // Type of the command data + floatType, + // Function pointer + &cb_respyawratep + }, + // yawrate i constant subtype + { + // ID + RESPYAWRATEI_SUBTYPE_ID, + // Command text + "respyawratei", + // Type of the command data + floatType, + // Function pointer + &cb_respyawratei + }, + // yawrate d constant subtype + { + // ID + RESPYAWRATED_SUBTYPE_ID, + // Command text + "respyawrated", + // Type of the command data + floatType, + // Function pointer + &cb_respyawrated + }, + // localx p constant subtype { // ID - 0x12, + RESPLOCALXP_SUBTYPE_ID, // Command text - "respheightp", + "resplocalxp", // Type of the command data floatType, // Function pointer - &cb_respheightp + &cb_resplocalxp }, - // height i constant subtype + // localx i constant subtype { // ID - 0x13, + RESPLOCALXI_SUBTYPE_ID, // Command text - "respheighti", + "resplocalxi", // Type of the command data floatType, // Function pointer - &cb_respheighti + &cb_resplocalxi }, - // height d constant subtype + // localx d constant subtype { // ID - 0x14, + RESPLOCALXD_SUBTYPE_ID, // Command text - "respheightd", + "resplocalxd", // Type of the command data floatType, // Function pointer - &cb_respheightd + &cb_resplocalxd }, - // x p constant subtype + // localy p constant subtype { // ID - 0x15, + RESPLOCALYP_SUBTYPE_ID, // Command text - "respxp", + "resplocalyp", // Type of the command data floatType, // Function pointer - &cb_respxp + &cb_resplocalyp }, - // x i constant subtype + // localy i constant subtype { // ID - 0x16, + RESPLOCALYI_SUBTYPE_ID, // Command text - "respxi", + "resplocalyi", // Type of the command data floatType, // Function pointer - &cb_respxi + &cb_resplocalyi }, - // x d constant subtype + // localy d constant subtype { // ID - 0x17, + RESPLOCALYD_SUBTYPE_ID, // Command text - "respxd", + "resplocalyd", // Type of the command data floatType, // Function pointer - &cb_respxd + &cb_resplocalyd }, - // y p constant subtype + // alt p constant subtype { // ID - 0x18, + RESPALTP_SUBTYPE_ID, // Command text - "respyp", + "respaltp", // Type of the command data floatType, // Function pointer - &cb_respyp + &cb_respaltp }, - // y i constant subtype + // alt i constant subtype { // ID - 0x19, + RESPALTI_SUBTYPE_ID, // Command text - "respyi", + "respalti", // Type of the command data floatType, // Function pointer - &cb_respyi + &cb_respalti }, - // y d constant subtype + // alt d constant subtype { // ID - 0x1A, + RESPALTD_SUBTYPE_ID, // Command text - "respyd", + "respaltd", // Type of the command data floatType, // Function pointer - &cb_respyd + &cb_respaltd }, - // height setpoint subtype + // rollsp setpoint subtype { // ID - 0x1B, + RESPROLLSP_SUBTYPE_ID, // Command text - "respheight", + "resprollsp", // Type of the command data floatType, // Function pointer - &cb_respheight + &cb_resprollsp }, - // x resppoint subtype + // pitchsp resppoint subtype { // ID - 0x1C, + RESPPITCHSP_SUBTYPE_ID, // Command text - "respx", + "resppitchsp", // Type of the command data floatType, // Function pointer - &cb_respx + &cb_resppitchsp }, - // y resppoint subtype + // yawsp resppoint subtype { // ID - 0x1D, + RESPYAWSP_SUBTYPE_ID, // Command text - "respy", + "respyawsp", // Type of the command data floatType, // Function pointer - &cb_respy + &cb_respyawsp }, - // yaw resppoint subtype + // altsp resppoint subtype { // ID - 0x1E, + RESPALTSP_SUBTYPE_ID, // Command text - "respyaw", + "respaltsp", // Type of the command data floatType, // Function pointer - &cb_respyaw + &cb_respaltsp }, - // pitch resppoint subtype + // lonsp resppoint subtype { // ID - 0x1F, + RESPLONSP_SUBTYPE_ID, // Command text - "resppitch", + "resplonsp", // Type of the command data floatType, // Function pointer - &cb_resppitch + &cb_resplonsp }, - // roll resppoint subtype + // latsp resppoint subtype { // ID - 0x20, + RESPLATSP_SUBTYPE_ID, // Command text - "resproll", + "resplatsp", // Type of the command data floatType, // Function pointer - &cb_resproll + &cb_resplatsp } } }, // UPDATE { // Message Type ID - 0x04, + UPDATE_TYPE_ID, // Update Subtypes { // NONE subtype { // ID - 0x00, + UPDATE_SUBTYPE_ID, // Command text "update", // Type of the command data @@ -1352,7 +1346,7 @@ struct MessageType MessageTypes[MAX_TYPE] = // BEGIN update { // ID - 0x01, + BEGINUPDATE_SUBTYPE_ID, // Command text "beginupdate", // Type of the command data @@ -1366,14 +1360,14 @@ struct MessageType MessageTypes[MAX_TYPE] = // LOG { // Message Type ID - 0x05, + LOG_TYPE_ID, // Log Subtypes { // NONE subtype { // ID - 0x00, + LOG_SUBTYPE_ID, // Command text "log", // Type of the command data @@ -1384,7 +1378,7 @@ struct MessageType MessageTypes[MAX_TYPE] = // Response subtype { // ID - 0x01, + RESPONSE_SUBTYPE_ID, // Command text "response", // Type of the command data diff --git a/groundStation/src/backend/commands.h b/groundStation/src/backend/commands.h index 9e57ae11a..34bce3f70 100644 --- a/groundStation/src/backend/commands.h +++ b/groundStation/src/backend/commands.h @@ -26,6 +26,142 @@ enum DataType stringType }; +enum MessageTypeID{ + DEBUG_TYPE_ID = 0x00, + SETTER_TYPE_ID = 0x01, + GETTER_TYPE_ID = 0x02, + RESP_TYPE_ID = 0x03, + UPDATE_TYPE_ID = 0x04, + LOG_TYPE_ID = 0x05 +}; + +enum MessageSubTypeID{ + // DEBUG + DEBUG_SUBTYPE_ID = 0x00, + PACKETLOG_SUBTYPE_ID = 0x01, + GETPACKETLOGS_SUBTYPE_ID = 0x02, + // SETTER + // angle + SETROLLP_SUBTYPE_ID = 0x00, + SETROLLI_SUBTYPE_ID = 0x01, + SETROLLD_SUBTYPE_ID = 0x02, + SETPITCHP_SUBTYPE_ID = 0x03, + SETPITCHI_SUBTYPE_ID = 0x04, + SETPITCHD_SUBTYPE_ID = 0x05, + SETYAWP_SUBTYPE_ID = 0x06, + SETYAWI_SUBTYPE_ID = 0x07, + SETYAWD_SUBTYPE_ID = 0x08, + // rate + SETROLLRATEP_SUBTYPE_ID = 0x09, + SETROLLRATEI_SUBTYPE_ID = 0x0A, + SETROLLRATED_SUBTYPE_ID = 0x0B, + SETPITCHRATEP_SUBTYPE_ID = 0x0C, + SETPITCHRATEI_SUBTYPE_ID = 0x0D, + SETPITCHRATED_SUBTYPE_ID = 0x0E, + SETYAWRATEP_SUBTYPE_ID = 0x0F, + SETYAWRATEI_SUBTYPE_ID = 0x10, + SETYAWRATED_SUBTYPE_ID = 0x11, + // local pos + SETLOCALXP_SUBTYPE_ID = 0x12, + SETLOCALXI_SUBTYPE_ID = 0x13, + SETLOCALXD_SUBTYPE_ID = 0x14, + SETLOCALYP_SUBTYPE_ID = 0x15, + SETLOCALYI_SUBTYPE_ID = 0x16, + SETLOCALYD_SUBTYPE_ID = 0x17, + SETALTP_SUBTYPE_ID = 0x18, + SETALTI_SUBTYPE_ID = 0x19, + SETALTD_SUBTYPE_ID = 0x1A, + // setpoints + SETROLLSP_SUBTYPE_ID = 0x1B, + SETPITCHSP_SUBTYPE_ID = 0x1C, + SETYAWSP_SUBTYPE_ID = 0x1D, + SETALTSP_SUBTYPE_ID = 0x1E, + SETLONSP_SUBTYPE_ID = 0x1F, + SETLATSP_SUBTYPE_ID = 0x20, + // GETTERS + // angle + GETROLLP_SUBTYPE_ID = 0x00, + GETROLLI_SUBTYPE_ID = 0x01, + GETROLLD_SUBTYPE_ID = 0x02, + GETPITCHP_SUBTYPE_ID = 0x03, + GETPITCHI_SUBTYPE_ID = 0x04, + GETPITCHD_SUBTYPE_ID = 0x05, + GETYAWP_SUBTYPE_ID = 0x06, + GETYAWI_SUBTYPE_ID = 0x07, + GETYAWD_SUBTYPE_ID = 0x08, + // rate + GETROLLRATEP_SUBTYPE_ID = 0x09, + GETROLLRATEI_SUBTYPE_ID = 0x0A, + GETROLLRATED_SUBTYPE_ID = 0x0B, + GETPITCHRATEP_SUBTYPE_ID = 0x0C, + GETPITCHRATEI_SUBTYPE_ID = 0x0D, + GETPITCHRATED_SUBTYPE_ID = 0x0E, + GETYAWRATEP_SUBTYPE_ID = 0x0F, + GETYAWRATEI_SUBTYPE_ID = 0x10, + GETYAWRATED_SUBTYPE_ID = 0x11, + // local pos + GETLOCALXP_SUBTYPE_ID = 0x12, + GETLOCALXI_SUBTYPE_ID = 0x13, + GETLOCALXD_SUBTYPE_ID = 0x14, + GETLOCALYP_SUBTYPE_ID = 0x15, + GETLOCALYI_SUBTYPE_ID = 0x16, + GETLOCALYD_SUBTYPE_ID = 0x17, + GETALTP_SUBTYPE_ID = 0x18, + GETALTI_SUBTYPE_ID = 0x19, + GETALTD_SUBTYPE_ID = 0x1A, + // setpoints + GETROLLSP_SUBTYPE_ID = 0x1B, + GETPITCHSP_SUBTYPE_ID = 0x1C, + GETYAWSP_SUBTYPE_ID = 0x1D, + GETALTSP_SUBTYPE_ID = 0x1E, + GETLONSP_SUBTYPE_ID = 0x1F, + GETLATSP_SUBTYPE_ID = 0x20, + // RESPONSE + // angle + RESPROLLP_SUBTYPE_ID = 0x00, + RESPROLLI_SUBTYPE_ID = 0x01, + RESPROLLD_SUBTYPE_ID = 0x02, + RESPPITCHP_SUBTYPE_ID = 0x03, + RESPPITCHI_SUBTYPE_ID = 0x04, + RESPPITCHD_SUBTYPE_ID = 0x05, + RESPYAWP_SUBTYPE_ID = 0x06, + RESPYAWI_SUBTYPE_ID = 0x07, + RESPYAWD_SUBTYPE_ID = 0x08, + // rate + RESPROLLRATEP_SUBTYPE_ID = 0x09, + RESPROLLRATEI_SUBTYPE_ID = 0x0A, + RESPROLLRATED_SUBTYPE_ID = 0x0B, + RESPPITCHRATEP_SUBTYPE_ID = 0x0C, + RESPPITCHRATEI_SUBTYPE_ID = 0x0D, + RESPPITCHRATED_SUBTYPE_ID = 0x0E, + RESPYAWRATEP_SUBTYPE_ID = 0x0F, + RESPYAWRATEI_SUBTYPE_ID = 0x10, + RESPYAWRATED_SUBTYPE_ID = 0x11, + // local pos + RESPLOCALXP_SUBTYPE_ID = 0x12, + RESPLOCALXI_SUBTYPE_ID = 0x13, + RESPLOCALXD_SUBTYPE_ID = 0x14, + RESPLOCALYP_SUBTYPE_ID = 0x15, + RESPLOCALYI_SUBTYPE_ID = 0x16, + RESPLOCALYD_SUBTYPE_ID = 0x17, + RESPALTP_SUBTYPE_ID = 0x18, + RESPALTI_SUBTYPE_ID = 0x19, + RESPALTD_SUBTYPE_ID = 0x1A, + // setpoints + RESPROLLSP_SUBTYPE_ID = 0x1B, + RESPPITCHSP_SUBTYPE_ID = 0x1C, + RESPYAWSP_SUBTYPE_ID = 0x1D, + RESPALTSP_SUBTYPE_ID = 0x1E, + RESPLONSP_SUBTYPE_ID = 0x1F, + RESPLATSP_SUBTYPE_ID = 0x20, + // UPDATE + UPDATE_SUBTYPE_ID = 0x00, + BEGINUPDATE_SUBTYPE_ID = 0x01, + // LOG + LOG_SUBTYPE_ID = 0x00, + RESPONSE_SUBTYPE_ID = 0x01 +}; + // MESSAGE SUBTYPES struct MessageSubtype{ char ID; diff --git a/quad/sw/modular_quad_pid/src/callbacks.c b/quad/sw/modular_quad_pid/src/callbacks.c index 9f304dd4b..d04c3d828 100644 --- a/quad/sw/modular_quad_pid/src/callbacks.c +++ b/quad/sw/modular_quad_pid/src/callbacks.c @@ -72,41 +72,9 @@ int cb_beginupdate(modular_structs_t *structs) { return 0; } -int cb_log(modular_structs_t *structs) -{ - size_t length; - unsigned char *packet = uart_buff_get_raw(&length); - return 0; -} - -int cb_response(modular_structs_t *structs) -{ - size_t length; - char *packet = uart_buff_get_raw(&length); - return 0; -} - /* Callbacks for configuration (setters)*/ -int cb_setyawp(modular_structs_t *structs) -{ - structs->parameter_struct.yaw_angle_pid.Kp = uart_buff_data_get_float(0); - return 0; -} - -int cb_setyawi(modular_structs_t *structs) -{ - structs->parameter_struct.yaw_angle_pid.Ki = uart_buff_data_get_float(0); - return 0; -} - -int cb_setyawd(modular_structs_t *structs) -{ - structs->parameter_struct.yaw_angle_pid.Kd = uart_buff_data_get_float(0); - return 0; -} - int cb_setrollp(modular_structs_t *structs) { structs->parameter_struct.roll_angle_pid.Kp = uart_buff_data_get_float(0); @@ -143,21 +111,21 @@ int cb_setpitchd(modular_structs_t *structs) return 0; } -int cb_setyawratep(modular_structs_t *structs) +int cb_setyawp(modular_structs_t *structs) { - structs->parameter_struct.yaw_ang_vel_pid.Kp = uart_buff_data_get_float(0); + structs->parameter_struct.yaw_angle_pid.Kp = uart_buff_data_get_float(0); return 0; } -int cb_setyawratei(modular_structs_t *structs) +int cb_setyawi(modular_structs_t *structs) { - structs->parameter_struct.yaw_ang_vel_pid.Ki = uart_buff_data_get_float(0); + structs->parameter_struct.yaw_angle_pid.Ki = uart_buff_data_get_float(0); return 0; } -int cb_setyawrated(modular_structs_t *structs) +int cb_setyawd(modular_structs_t *structs) { - structs->parameter_struct.yaw_ang_vel_pid.Kd = uart_buff_data_get_float(0); + structs->parameter_struct.yaw_angle_pid.Kd = uart_buff_data_get_float(0); return 0; } @@ -197,103 +165,111 @@ int cb_setpitchrated(modular_structs_t *structs) return 0; } -int cb_setxp(modular_structs_t *structs) +int cb_setyawratep(modular_structs_t *structs) +{ + structs->parameter_struct.yaw_ang_vel_pid.Kp = uart_buff_data_get_float(0); + return 0; +} + +int cb_setyawratei(modular_structs_t *structs) +{ + structs->parameter_struct.yaw_ang_vel_pid.Ki = uart_buff_data_get_float(0); + return 0; +} + +int cb_setyawrated(modular_structs_t *structs) +{ + structs->parameter_struct.yaw_ang_vel_pid.Kd = uart_buff_data_get_float(0); + return 0; +} + +int cb_setlocalxp(modular_structs_t *structs) { structs->parameter_struct.local_x_pid.Kp = uart_buff_data_get_float(0); return 0; } -int cb_setxi(modular_structs_t *structs) +int cb_setlocalxi(modular_structs_t *structs) { structs->parameter_struct.local_x_pid.Ki = uart_buff_data_get_float(0); return 0; } -int cb_setxd(modular_structs_t *structs) +int cb_setlocalxd(modular_structs_t *structs) { structs->parameter_struct.local_x_pid.Kd = uart_buff_data_get_float(0); return 0; } -int cb_setyp(modular_structs_t *structs) +int cb_setlocalyp(modular_structs_t *structs) { structs->parameter_struct.local_y_pid.Kp = uart_buff_data_get_float(0); return 0; } -int cb_setyi(modular_structs_t *structs) +int cb_setlocalyi(modular_structs_t *structs) { structs->parameter_struct.local_y_pid.Ki = uart_buff_data_get_float(0); return 0; } -int cb_setyd(modular_structs_t *structs) +int cb_setlocalyd(modular_structs_t *structs) { structs->parameter_struct.local_y_pid.Kd = uart_buff_data_get_float(0); return 0; } -int cb_setheightp(modular_structs_t *structs) +int cb_setaltp(modular_structs_t *structs) { structs->parameter_struct.alt_pid.Kp = uart_buff_data_get_float(0); + return 0; } -int cb_setheighti(modular_structs_t *structs) +int cb_setalti(modular_structs_t *structs) { structs->parameter_struct.alt_pid.Ki = uart_buff_data_get_float(0); -} - -int cb_setheightd(modular_structs_t *structs) -{ - structs->parameter_struct.alt_pid.Kd = uart_buff_data_get_float(0); -} - -int cb_setheight(modular_structs_t *structs) -{ - structs->setpoint_struct.desiredQuadPosition.alt_pos = uart_buff_data_get_float(0); return 0; } -int cb_setx(modular_structs_t *structs) +int cb_setaltd(modular_structs_t *structs) { - structs->setpoint_struct.desiredQuadPosition.x_pos = uart_buff_data_get_float(0); + structs->parameter_struct.alt_pid.Kd = uart_buff_data_get_float(0); return 0; } -// TODO cb_sety will replace cb_setlat in commands.c once we talk about it -int cb_sety(modular_structs_t *structs) +int cb_setrollsp(modular_structs_t *structs) { - structs->setpoint_struct.desiredQuadPosition.y_pos = uart_buff_data_get_float(0); + structs->setpoint_struct.desiredQuadPosition.roll = uart_buff_data_get_float(0); return 0; } -int cb_setlon(modular_structs_t *structs) +int cb_setpitchsp(modular_structs_t *structs) { - // TODO need to be able to take in a lat, lon position and convert it to quad x, y pos + structs->setpoint_struct.desiredQuadPosition.pitch = uart_buff_data_get_float(0); return 0; } -int cb_setlat(modular_structs_t *structs) +int cb_setyawsp(modular_structs_t *structs) { - // TODO need to be able to take in a lat, lon position and convert it to quad x, y pos + structs->setpoint_struct.desiredQuadPosition.yaw = uart_buff_data_get_float(0); return 0; } -int cb_setyaw(modular_structs_t *structs) +int cb_setaltsp(modular_structs_t *structs) { - structs->setpoint_struct.desiredQuadPosition.yaw = uart_buff_data_get_float(0); + structs->setpoint_struct.desiredQuadPosition.alt_pos = uart_buff_data_get_float(0); return 0; } -int cb_setpitch(modular_structs_t *structs) +int cb_setlonsp(modular_structs_t *structs) { - structs->setpoint_struct.desiredQuadPosition.pitch = uart_buff_data_get_float(0); + // TODO need to be able to take in a lat, lon position and convert it to quad x, y pos return 0; } -int cb_setroll(modular_structs_t *structs) +int cb_setlatsp(modular_structs_t *structs) { - structs->setpoint_struct.desiredQuadPosition.roll = uart_buff_data_get_float(0); + // TODO need to be able to take in a lat, lon position and convert it to quad x, y pos return 0; } diff --git a/quad/sw/modular_quad_pid/src/initialize_components.c b/quad/sw/modular_quad_pid/src/initialize_components.c index 913141be7..740268d6b 100644 --- a/quad/sw/modular_quad_pid/src/initialize_components.c +++ b/quad/sw/modular_quad_pid/src/initialize_components.c @@ -33,7 +33,7 @@ int protection_loops(modular_structs_t *structs) length = length >= sizeof(buf) ? 255 : length; while (!structs->user_input_struct.receivedBeginUpdate) { - send_data(MessageTypes[4].ID, MessageTypes[4].subtypes[1].ID, 0, buf, length); + //send_data(MessageTypes[4].ID, MessageTypes[4].subtypes[1].ID, 0, buf, length); process_received(structs); usleep(10000); } -- GitLab