春ロボ1班(元F3RC4班+) / Mbed 2 deprecated harurobo_mbed_undercarriage_sub_2_26

Dependencies:   Harurobo_CAN_2_26 mbed Maxon_setting_1_11 move4wheel2 EC PathFollowing_2_26 CruizCore_R1370P

Revision:
3:112c4ddf324d
Parent:
1:0c9f53f5c9d0
Child:
4:deac46c43ef4
--- a/main.cpp	Sat Dec 22 02:55:31 2018 +0000
+++ b/main.cpp	Fri Jan 11 08:34:07 2019 +0000
@@ -1,58 +1,72 @@
-#include "mbed.h"
+#include <mbed.h>
 #include "EC.h"
 #include "R1370P.h"
 #include "move4wheel.h"
 #include "PathFollowing.h"
 #include "Maxon_setting.h"
+#include "Harurobo_CAN.h"
 
-CAN can1(p30,p29,1000000);
-DigitalOut led(LED1);
+#define PROGRAM_INFO //プログラム使用時に使用プログラムの情報を最初に表示する際に定義
+
+#define HARUROBO_TEST_MODE //テスト自動プログラム(練習・動作確認用)使用時に定義
+//#define HARUROBO_RIGHT_MODE //本番用自動プログラム(右側フィールド)使用時に定義
+//#define HARUROBO_LEFT_MODE //本番用自動プログラム(左側フィールド)使用時に定義
+
 Ticker ticker;
 
-void can_read(){//CAN通信受信
-    
-    CANMessage msg;
-    
-    if(can1.read(msg)){
+//////////////////////////////////////////////////////////////以下main文/////////////////////////////////////////////////////////////////
+
+int main()
+{   
+      UserLoopSetting(); //Maxon関連設定関数
+      UserLoopSetting2(); //PathFollowing関連設定関数
+      
+#ifdef PROGRAM_INFO //プログラム使用時に使用プログラムの情報を最初に表示(未動確)
+
+  printf("ソースファイル名 : %s¥n", __FILE__);
+  printf("作成日付 : %s¥n", __DATE__);
+  printf("作成時刻 : %s¥n", __TIME__);
+  
+#endif
+      
+      
       
-      if(msg.id == 1){
-        led = 1;
-       usw_data1 =  0.01 * (short)((msg.data[0]<<8) | msg.data[1]);
-     printf("usw_data1 = %d:%d,%lf\n\r",msg.data[0],msg.data[1],usw_data1);
-      }else if(msg.id == 2){
-        //led = 1;
-      //  usw_data2 = 0.01 * (short)((msg.data[0]<<8) | msg.data[1]);
-        //printf("usw_data2 = %d:%d,%d\n\r",msg.data[0],msg.data[1],usw_data2);
-      }else if(msg.id == 3){
-        //led = 1;
-        //usw_data3 = 0.01 * (short)((msg.data[0]<<8) | msg.data[1]);
-        //printf("usw_data3 = %d:%d,%d\n\r",msg.data[0],msg.data[1],usw_data3);
-      }else if(msg.id == 4){
-        //led = 1;
-        //usw_data4 = 0.01 * (short)((msg.data[0]<<8) | msg.data[1]);
-        //printf("usw_data4 = %d:%d,%d\n\r",msg.data[0],msg.data[1],usw_data4);
-      }
-          
+
+/////////////以下自動モードプログラム/////////////
+
+#ifdef HARUROBO_TEST_MODE //テスト自動プログラム(練習・動作確認用)
+
+      //Debug_Control();
+    
+      //purecurve2(5,1,1,0,0,-500,-500,9,1500,5,0.1,10,0.1,600,0);
+      
+      //set_cond(0,1,-800,0,0);
+      //gogo_straight(0,1,0,0,-500,0,500,500,5,0.1,10,0.1,600,0);
+      ticker.attach(&can_read,0.01);
+    
+    while(1){
+      //printf("%f\n\r",usw_data1);
     }
-}
+    
+    //MotorControl(0,0,0,0);
+
+#endif 
 
 
-//////////////////////////////////////////////////////////////以下main文/////////////////////////////////////////////////////////////////
-int main()
-{   
-    UserLoopSetting();
-    //UserLoopSetting2();
-    //Debug_Control()
-    
+#ifdef HARUROBO_RIGHT_MODE //本番用自動プログラム(右側フィールド用)
+
+//ここに本番用自動プログラム(右側フィールド用)を書く
+
+#endif
+
+
+#ifdef HARUROBO_LEFT_MODE //本番用自動プログラム(左側フィールド用)
 
-    //purecurve2(5,1,1,0,0,-500,-500,9,1500,5,0.1,10,0.1,600,0);
-    //gogo_straight(1,1,0,0,500,0,2000,2000,5,0.1,10,0.1,600,0);
-    
-    ticker.attach(&can_read,0.01);
-    
-    while(1);
-      //printf("%f\n\r",usw_data1);
-    
+//ここに本番用自動プログラム(左側フィールド用)を書く
+
+#endif 
 
-    //MotorControl(0,0,0,0);
+
+/////////自動モードプログラム終了/////////
+
 }
\ No newline at end of file