Ben Katz / Mbed 2 deprecated MotorModuleExample

Dependencies:   mbed

Revision:
2:36a254d3dbf3
Child:
3:f0d054d896f9
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/MotorModule/MotorModule.h	Thu Aug 08 17:03:30 2019 +0000
@@ -0,0 +1,48 @@
+#ifndef CAN_COM_H
+#define CAN_COM_H
+
+#include "mbed.h"
+#include "../math_ops.h"
+
+/// Value Limits ///
+#define P_MIN -12.5f
+ #define P_MAX 12.5f
+ #define V_MIN -45.0f
+ #define V_MAX 45.0f
+ #define KP_MIN 0.0f
+ #define KP_MAX 500.0f
+ #define KD_MIN 0.0f
+ #define KD_MAX 5.0f
+ #define I_MIN -18.0f
+ #define I_MAX 18.0f
+ 
+ 
+/// Structs for organizing commands and data ///
+typedef struct
+{
+    int id;
+    float position, velocity, current;
+} StateStruct;
+
+    
+typedef struct
+{
+    int id;
+    float i_ff, p_des, kp, v_des, kd;
+}ControlStruct;
+
+typedef struct
+{
+    StateStruct state;
+    ControlStruct control;
+    CANMessage rxMsg;
+    CANMessage txMsg;
+}MotorStruct;
+
+void pack_cmd(MotorStruct * motor);
+void unpack_reply(MotorStruct * motor);
+void enable_motor(MotorStruct * motor, CAN * can);
+void disable_motor(MotorStruct * motor, CAN * can);
+
+
+#endif
\ No newline at end of file