A Roboteq controller c++ interface to allow a Brushless motor control on a CAN bus. Used for a FBL2360 reference.
Dependencies: CAN_FIFO_Triporteur
Diff: RoboteqController.h
- Revision:
- 2:d61b4a989cab
- Parent:
- 1:57b8f6ed930b
- Child:
- 3:a03c91082856
--- a/RoboteqController.h Sat May 05 16:14:43 2018 +0000 +++ b/RoboteqController.h Thu May 17 14:26:20 2018 +0000 @@ -15,6 +15,20 @@ #define SDO_REQUEST 0x600 #define SDO_ANSWER 0x580 +// Motor modes +#define MODE_OPEN_LOOP 0 // Open-loop +#define MODE_CLOSED_SPEED 1 // Closed-loop speed +#define MODE_CLOSED_POS_REL 2 // Closed-loop position relative +#define MODE_CLOSED_COUNT_POS 3 // Closed-loop count position +#define MODE_CLOSED_POS_TRACK 4 // Closed-loop position tracking +#define MODE_CLOSED_TORQUE 5 // Torque +#define MODE_CLOSED_SPEED_POS 6 // Closed-loop speed position + +// Temperatures +#define TEMPERATURE_MCU 1 // Mcu temperature +#define TEMPERATURE_CH1 2 // Channel 1 heatsink +#define TEMPERATURE_CH2 3 // Channel 2 heatsink + class RoboteqController : public PeripheralCAN{ public: /** Constructors and destructor @@ -84,8 +98,34 @@ uint8_t node_id; // Node id of the controller uint8_t mot_num; // Motor number within the controller - int16_t rotor_speed; // Rotor speed + /* General Configuration and Safety */ + // TBD + + /* Analog, Digital, Pulse IO Configurations */ + // TBD + /* Motor configuration (non-exhaustiv list) */ + uint16_t alim; // Motor ampere limit (0.1 A) + uint8_t kp; // PID proportionnal gain + uint8_t ki; // PID integral gain + uint8_t kd; // PID derivative gain + int32_t mac; // Motor acceleration rate (0.1 RPM) + int32_t mdec; // Motor deceleration rate (0.1 RPM) + uint8_t mmod; // Motor mode + uint16_t mxrpm; // Maximal RPM value (eq to a cmd of 1000) + + int16_t amp_bat; // Battery current (0.1 A) + int16_t amp_motor; // Motor current (0.1 A) + int16_t feedback; // Closed loop feedback + int32_t error // Closed loop error + int8_t temp_MCU; // MCU temperature + int8_t temp_ch1 // channel 1 temperature + int8_t temp_ch2; // channel 2 temperature + int32_t vars[16]; // Integer user variables + bool booleans[16]; // Boolean user variables + int16_t speed; // Rotor speed + + /* CAN Identifiers */ unsigned short Id_CSS_REQ; // CAN ID : CSS request (query or command) unsigned short Id_CSS_ANS; // CAN ID : CSS answer (from query or command)