Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed Motor_Feedforward
MotorModule.h
00001 #ifndef CAN_COM_H 00002 #define CAN_COM_H 00003 00004 #include "mbed.h" 00005 #include "../math_ops.h" 00006 00007 /// Value Limits /// 00008 #define P_MIN -95.5f // Radians 00009 #define P_MAX 95.5f 00010 #define V_MIN -45.0f // Rad/s 00011 #define V_MAX 45.0f 00012 #define KP_MIN 0.0f // N-m/rad 00013 #define KP_MAX 500.0f 00014 #define KD_MIN 0.0f // N-m/rad/s 00015 #define KD_MAX 5.0f 00016 #define I_MIN -18.0f 00017 #define I_MAX 18.0f 00018 00019 00020 /// Structs for organizing commands and data /// 00021 typedef struct 00022 { 00023 int id; 00024 float position, velocity, current; 00025 } StateStruct; 00026 00027 00028 typedef struct 00029 { 00030 int id; 00031 float i_ff, p_des, kp, v_des, kd; 00032 }ControlStruct; 00033 00034 typedef struct 00035 { 00036 StateStruct state; 00037 ControlStruct control; 00038 CANMessage rxMsg; 00039 CANMessage txMsg; 00040 }MotorStruct; 00041 00042 void pack_cmd(MotorStruct * motor); 00043 void unpack_reply(MotorStruct * motor); 00044 void enable_motor(MotorStruct * motor, CAN * can); 00045 void disable_motor(MotorStruct * motor, CAN * can); 00046 void zero_motor(MotorStruct * motor, CAN * can); 00047 00048 00049 00050 #endif
Generated on Sun Jul 24 2022 22:15:03 by
1.7.2