From c386bffce0b58beae9a05959cf8c93c72ce4628b Mon Sep 17 00:00:00 2001 From: burneykb <burneykb@iastate.edu> Date: Mon, 20 Mar 2017 15:11:49 -0500 Subject: [PATCH] added commands to commands.h/c --- common/commands.c | 74 +++++++++++++++++++++++ common/commands.h | 41 +++---------- groundStation/src/backend/responseparam.c | 2 +- 3 files changed, 84 insertions(+), 33 deletions(-) diff --git a/common/commands.c b/common/commands.c index 8c64c0efc..0128b8f12 100644 --- a/common/commands.c +++ b/common/commands.c @@ -62,6 +62,17 @@ command_cb cb_setparam __attribute__((weak, alias("cb_default"))); command_cb cb_getparam __attribute__((weak, alias("cb_default"))); command_cb cb_respparam __attribute__((weak, alias("cb_default"))); +command_cb cb_setsource __attribute__((weak, alias("cb_default"))); +command_cb cb_getsource __attribute__((weak, alias("cb_default"))); +command_cb cb_respsource __attribute__((weak, alias("cb_default"))); + +command_cb cb_getoutput __attribute__((weak, alias("cb_default"))); +command_cb cb_respoutput __attribute__((weak, alias("cb_default"))); + +command_cb cb_getnodes __attribute__((weak, alias("cb_default"))); +command_cb cb_respnodes __attribute__((weak, alias("cb_default"))); + + /* * Command structure. * This array is used to keep track of the callback functions @@ -165,6 +176,69 @@ struct MessageType MessageTypes[MAX_TYPE_ID] = // Function pointer &cb_respparam }, + // SETSOURCE + { + // Command text + "setsource", + // Type of the command data + floatType, + // Function pointer + &cb_setsource + }, + // GETSOURCE + { + // Command text + "getsource", + // Type of the command data + floatType, + // Function pointer + &cb_getsource + }, + // RESPSOURCE + { + // Command text + "respsource", + // Type of the command data + floatType, + // Function pointer + &cb_respsource + }, + // GETOUTPUT + { + // Command text + "getoutput", + // Type of the command data + floatType, + // Function pointer + &cb_respoutput + }, + // RESPOUTPUT + { + // Command text + "respoutput", + // Type of the command data + floatType, + // Function pointer + &cb_respoutput + }, + // GETNODES + { + // Command text + "getnodes", + // Type of the command data + floatType, + // Function pointer + &cb_getnodes + }, + // RESPNODES + { + // Command text + "respnodes", + // Type of the command data + floatType, + // Function pointer + &cb_respnodes + }, // LOG_END { // Command text diff --git a/common/commands.h b/common/commands.h index 08218e6ff..86fa2c897 100644 --- a/common/commands.h +++ b/common/commands.h @@ -45,39 +45,16 @@ enum MessageTypeID{ SETPARAM_ID, // 07 - Setting controller parameters. Example: PID constants GETPARAM_ID, // 08 - Getting controller parameters. Example: PID constants RESPPARAM_ID, // 09 - Responding with controller parameters. Example: PID constants - LOG_END_ID, // 10 - Responding with controller parameters. Example: PID constants - MAX_TYPE_ID // 11 - Just used to keep track of the size. Must remain at the end + SETSOURCE_ID, // 10 - Setting controller source Block & id + GETSOURCE_ID, // 11 - Getting controller source Block & id + RESPSOURCE_ID, // 12 - Responding with controller source Block & id + GETOUTPUT_ID, // 13 - Getting controller block output + RESPOUTPUT_ID, // 14 - Responding with controller block output + GETNODES_ID, // 15 - Getting nodes from current comp_graph + RESPNODES_ID, // 16 - Responding with nodes from current comp_graph + LOG_END_ID, // 17 - Responding with controller parameters. Example: PID constants + MAX_TYPE_ID // 18 - Just used to keep track of the size. Must remain at the end }; - -/* - * Controller ID used to know which controller the message is referencing - */ -enum ControllerID{ - ROLL_ID, // 00 - Roll PID - PITCH_ID, // 01 - Pitch PID - YAW_ID, // 02 - Yaw PID - ROLL_RATE_ID, // 03 - Roll rate PID - PITCH_RATE_ID, // 04 - Pitch rate PID - YAW_RATE_ID, // 05 - Yaw rate PID - LOCAL_X_ID, // 06 - Local X PID // lat - LOCAL_Y_ID, // 07 - Local Y PID //long - ALT_ID, // 08 - Altitude PID - X_SETPOINT_ID, // 09 - X Setpoint //lat - Y_SETPOINT_ID, // 10 - Y Setpoint //long - ALT_SETPOINT_ID, // 11 - Z Setpoint - MAX_CONTROLLER_ID // 12 - Just used to keep track of the size -}; - -/* - * Enumeration of controller parameters - */ -enum ControlParamID{ - KP_ID, // 00 - P constant - KI_ID, // 01 - I constant - KD_ID, // 02 - D constant - MAX_CONTROL_PARAM_ID, // 03 - Just used to keep track of the size -}; - /* * Message type struct used to keep track of the callback function * pointers located in commands.c diff --git a/groundStation/src/backend/responseparam.c b/groundStation/src/backend/responseparam.c index eee2f05c3..e2f188c29 100644 --- a/groundStation/src/backend/responseparam.c +++ b/groundStation/src/backend/responseparam.c @@ -14,7 +14,7 @@ enum ResponseData { RESP_DATA_SIZE }; -/* Creates data and metadata for a respcontrol packet +/* Creates data and metadata for a respparam packet * Returns data size. */ ssize_t EncodeResponseParam( -- GitLab