2014 sift / Mbed 2 deprecated TVDctrller2017_brdRev1_PandA

Dependencies:   mbed

Fork of TVDctrller2017_brdRev1_ver6 by 2014 sift

Revision:
29:a51cb2cf22ae
Parent:
28:47e9531a3a9d
Child:
30:c596a0f5d685
--- a/main.cpp	Mon Jul 03 12:03:34 2017 +0000
+++ b/main.cpp	Sat Jul 08 06:20:29 2017 +0000
@@ -104,8 +104,8 @@
     char canWheelSpeed[CANDATANUM_WHEELSPEED]= {0};
     char canVehicleSpeed[CANDATANUM_VEHICLESPEED]= {0};
 
-    wait(1);
-
+    //wait(1);  //断線検出に引っかかるためMotorControllerの起動よりも早くTVDCは起動する必要あり 
+    
     pc.baud(115200);
     printf("\033[2J");          //teratermの画面クリア
     printf("\033[1;1H");        //teratermの画面クリア
@@ -123,7 +123,7 @@
 
     struct errCounter_t eCounter= {0,0,0,0,0,0,0,0};
 
-    wait(1);
+    wait(3);
 
     while(1) {
         //getCurrentErrCount(&eCounter);
@@ -132,8 +132,9 @@
 
         driveTVD(0, isPressedRTD());
 
-        //printf("%f\n\r", 45.0/0xFFFF * calcRequestTorque());
+        printf("%f\n\r", M_PI * getSteerAngle()/127.0f);
 
+        /*
         writeCanBuff(isBrakeOn(),                                           canBrake,           CANDATANUM_BRAKE);
         writeCanBuff(calcRequestTorque(),                                   canRequestTorque,   CANDATANUM_REQTRQ);
         writeCanBuff(getMotorTorque(RIGHT) + (getMotorTorque(LEFT) << 16),  canMotorTorque,     CANDATANUM_MOTORTRQ);
@@ -142,14 +143,15 @@
         writeCanBuff(getRPS(RIGHT, 1) + (getRPS(LEFT, 1)<<16),              canWheelSpeed,      CANDATANUM_WHEELSPEED);
         writeCanBuff(getVelocity() / 0.1f,                                  canVehicleSpeed,    CANDATANUM_VEHICLESPEED);
 
-        //can.write(CANMessage(CANID_BRAKE, canBrake, CANDATANUM_BRAKE));
+        can.write(CANMessage(CANID_BRAKE, canBrake, CANDATANUM_BRAKE));
         can.write(CANMessage(CANID_REQTRQ, canRequestTorque, CANDATANUM_REQTRQ));
         can.write(CANMessage(CANID_MOTORTRQ, canMotorTorque, CANDATANUM_MOTORTRQ));
         can.write(CANMessage(CANID_STEERING, canSteer, CANDATANUM_STEERING));
         can.write(CANMessage(CANID_WHEELSPEED, canMotorSpeed, CANDATANUM_MOTORSPEED));
         can.write(CANMessage(CANID_MOTORSPEED, canWheelSpeed, CANDATANUM_WHEELSPEED));
         can.write(CANMessage(CANID_VEHICLESPEED, canVehicleSpeed, CANDATANUM_VEHICLESPEED));
-
+        */
+        
         //printf("%1.6f\r\n", time);
         //printf("%d\r\n", eCounter.brakeOverRide);
         time = timer.read();