asdgas

Dependencies:   mbed Eigen FastPWM

Revision:
63:376a20d2fbfd
Parent:
62:456f87e3124e
Child:
65:549e0426cd91
--- a/CAN/function_CAN.cpp	Tue Apr 28 09:19:26 2020 +0000
+++ b/CAN/function_CAN.cpp	Thu May 07 03:52:28 2020 +0000
@@ -262,10 +262,10 @@
                 ROM_RESET_DATA();
                 
             } else if (msg.data[1] == 3) {
-                K_SPRING = (int16_t) (msg.data[2] | msg.data[3] << 8);
-                D_DAMPER = (int16_t) (msg.data[4] | msg.data[5] << 8);
+                K_SPRING = (float) (((float) ((int16_t) (msg.data[2] | msg.data[3] << 8))) * 0.1f);
+                D_DAMPER = (float) (((float) ((int16_t) (msg.data[4] | msg.data[5] << 8))) * 0.01f);
                 
-                ROM_RESET_DATA();
+//                ROM_RESET_DATA();     //For Real-time changing
             }
 
             break;
@@ -894,8 +894,8 @@
         sendIgain = (int16_t) (I_GAIN_JOINT_TORQUE);
         sendDgain = (int16_t) (D_GAIN_JOINT_TORQUE);
     } else if (t_type == 3) {
-        sendPgain = (int16_t) (K_SPRING);
-        sendIgain = (int16_t) (D_DAMPER);
+        sendPgain = (int16_t) (K_SPRING * 10.0f);
+        sendIgain = (int16_t) (D_DAMPER * 100.0f);
     }
 
     CANMessage temp_msg;