ライブラリ化を行った後

Dependencies:   QEI accelerator bit_test cyclic_io cyclic_var cylinder event_var limit mbed mecanum motor_drive pid pid_encoder rs422_put sbdbt servo

Fork of 17robo_Practice1 by kusano kiyoshige

Revision:
46:4af9df24b94c
Parent:
5:6efda58ff71b
diff -r a32e8091901b -r 4af9df24b94c bno055_use.h
--- a/bno055_use.h	Tue Sep 12 08:29:39 2017 +0000
+++ b/bno055_use.h	Tue Sep 12 09:03:35 2017 +0000
@@ -17,6 +17,8 @@
     .getYaw180()    //Yaw(-180~0~180)           値取得   (返り値 float)
     .getYaw360()    //Yaw(0~360)(時計回り)       値取得   (返り値 float)
     .getYaw360Rev() //Yaw(0~360)(反時計回り)     値取得   (返り値 float)
+    .init()
+    .yaw_origin()
     
 **************************************************/
 //p28 p27 or p9 p10
@@ -47,6 +49,10 @@
             cal_timer.attach(this, &Bno055::getData, timer_dt);
             ifaceI2C.frequency(ifaceI2C_frequency);
             sensor1.initialize(true);
+            init();
+        }
+        
+        void init(){
             yaw_state = 1;
             shortdata_yaw = 0;
             count = 0;
@@ -56,7 +62,7 @@
             data_yaw180 = 0;
             data_yaw360 = 0;
             data_yaw360Rev = 0;
-            data_yawRad = 0;
+            data_yawRad = 0;   
         }
         
         void firstRead(){
@@ -65,6 +71,10 @@
             data_firstYaw = (float)shortdata_yaw * data_scEUL;
         }
         
+        void yaw_origin(){
+            data_firstYaw = data_yaw;
+        }
+        
         float getYaw(){
             return data_yaw;
         }