A Roboteq controller c++ interface to allow a Brushless motor control on a CAN bus. Used for a FBL2360 reference.

Dependencies:   CAN_FIFO_Triporteur

Revision:
6:f9c4795448c1
Parent:
4:1ee0a235c997
Child:
7:33d64a3c48a2
--- a/RoboteqController.h	Tue May 29 15:51:46 2018 +0000
+++ b/RoboteqController.h	Wed Jun 13 09:07:45 2018 +0000
@@ -43,10 +43,9 @@
      *
      * @param controller A pointer on the CAN controller
      * @param node_id The controller node id
-     * @param mot_num Message number inside the controller
      * @param TPDO_enabled A flag that enables reception of TPDO messages
      */
-    RoboteqController(ControllerCAN* controller, uint8_t node_id, uint8_t mot_num, bool TPDO_enabled);
+    RoboteqController(ControllerCAN* controller, uint8_t node_id, bool TPDO_enabled);
     ~RoboteqController();
     
     /** Update callback by the CANController
@@ -56,7 +55,7 @@
      */
     virtual void update(const unsigned short& Id, const CANMessage& msg);
     
-    void sendCommand(uint32_t cmd);
+    void sendCommand(uint8_t mot_num, uint32_t cmd);
     
     protected:
     
@@ -141,7 +140,6 @@
     virtual void TPDO_receive(uint8_t n, const CANMessage& CANmsg);
     
     uint8_t node_id;                // Node id of the controller
-    uint8_t mot_num;                // Motor number within the controller
     
     /* General Configuration and Safety */
     // TBD
@@ -159,8 +157,11 @@
     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 amp_bat1;               // Battery current (0.1 A) Motor 1
+    int16_t amp_bat2;               // Battery current (0.1 A) Motor 2
+    int16_t amp_motor1;             // Motor current (0.1 A) Motor 1
+    int16_t amp_motor2;             // Motor current (0.1 A) Motor 2
+    int16_t volt_bat;               // Battery voltage
     int16_t feedback;               // Closed loop feedback
     int32_t error;                  // Closed loop error
     int8_t temp_MCU;                // MCU temperature
@@ -168,8 +169,9 @@
     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
-        
+    int16_t speed1;                 // Rotor speed Motor 1
+    int16_t speed2;                 // Rotor speed Motor 2
+    
     /* 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)