3/20 2:04

Dependencies:   mbed move4wheel2 EC CruizCore_R1370P

Committer:
la00noix
Date:
Thu Mar 07 02:54:55 2019 +0000
Revision:
8:2ba338b4590e
Parent:
7:44ce34007499
Child:
9:7667dcfc7ce5
a

Who changed what in which revision?

UserRevisionLine numberNew contents of line
la00noix 0:c61c6e4775ca 1 #include "EC.h"
la00noix 0:c61c6e4775ca 2 #include "R1370P.h"
la00noix 0:c61c6e4775ca 3 #include "move4wheel.h"
la00noix 0:c61c6e4775ca 4 #include "mbed.h"
la00noix 0:c61c6e4775ca 5 #include "math.h"
la00noix 0:c61c6e4775ca 6 #include "PathFollowing.h"
la00noix 0:c61c6e4775ca 7 #include "movement.h"
la00noix 0:c61c6e4775ca 8 #include "maxonsetting.h"
la00noix 0:c61c6e4775ca 9 #include "manual.h"
la00noix 0:c61c6e4775ca 10 #include "can.h"
la00noix 0:c61c6e4775ca 11
la00noix 0:c61c6e4775ca 12 #define PI 3.141592
la00noix 0:c61c6e4775ca 13
la00noix 0:c61c6e4775ca 14 //#define PROGRAM_INFO //プログラム使用時に使用プログラムの情報を最初に表示する際に定義
la00noix 0:c61c6e4775ca 15
la00noix 0:c61c6e4775ca 16 int go_waitmode = 0;
la00noix 0:c61c6e4775ca 17
la00noix 0:c61c6e4775ca 18 //-----mbed led------------------//点灯条件-----------------------//参照場所------------------------------//
la00noix 6:26724c287387 19 //DigitalOut cansend_led(LED1); //canread -> on //can.cpp
la00noix 6:26724c287387 20 //DigitalOut canread_led(LED2); //cansend -> on //can.cpp
la00noix 0:c61c6e4775ca 21 //DigitalOut debug_led(LED3); //maxon debug programme -> on //maxonsetting.cpp
la00noix 0:c61c6e4775ca 22
la00noix 0:c61c6e4775ca 23 //////////////////////////////////////////////////////////////以下main文/////////////////////////////////////////////////////////////////
la00noix 0:c61c6e4775ca 24
la00noix 6:26724c287387 25 int main()
la00noix 6:26724c287387 26 {
la00noix 0:c61c6e4775ca 27 UserLoopSetting_maxon();
la00noix 0:c61c6e4775ca 28 UserLoopSetting_sensor();
la00noix 0:c61c6e4775ca 29 UserLoopSetting_can();
la00noix 6:26724c287387 30
la00noix 0:c61c6e4775ca 31 #ifdef PROGRAM_INFO //プログラム使用時に使用プログラムの情報を最初に表示
la00noix 0:c61c6e4775ca 32
la00noix 6:26724c287387 33 printf("ソースファイル名 : %s¥n", __FILE__);
la00noix 6:26724c287387 34 printf("作成日付 : %s¥n", __DATE__);
la00noix 6:26724c287387 35 printf("作成時刻 : %s¥n", __TIME__);
la00noix 6:26724c287387 36
la00noix 0:c61c6e4775ca 37 #endif
la00noix 0:c61c6e4775ca 38
la00noix 6:26724c287387 39 while(1) {
la00noix 6:26724c287387 40
la00noix 6:26724c287387 41 switch(id1_value[0]) {
la00noix 0:c61c6e4775ca 42 //-----auto mode----------------------------------------------------------------------------------------------------------------------//
la00noix 6:26724c287387 43 case 1:
la00noix 6:26724c287387 44
la00noix 6:26724c287387 45 switch(id1_value[6]) {
la00noix 6:26724c287387 46 case 0:
la00noix 6:26724c287387 47 //-----right mode-------------------------------------------------------------------------------------------------------------//
la00noix 8:2ba338b4590e 48 if(T1 == 0) {
la00noix 6:26724c287387 49
la00noix 8:2ba338b4590e 50 //スタート位置からみかんの木まで移動
la00noix 8:2ba338b4590e 51 wait(0.5);
la00noix 8:2ba338b4590e 52 T1++;
la00noix 8:2ba338b4590e 53
la00noix 8:2ba338b4590e 54 }
la00noix 8:2ba338b4590e 55 if(T1 == 1) {
la00noix 8:2ba338b4590e 56 while(1) {
la00noix 8:2ba338b4590e 57 wait(0.5);
la00noix 8:2ba338b4590e 58 if(T1 == 2) {
la00noix 8:2ba338b4590e 59 break;
la00noix 8:2ba338b4590e 60 }
la00noix 8:2ba338b4590e 61 }
la00noix 8:2ba338b4590e 62 }
la00noix 8:2ba338b4590e 63 if(T1 == 2) {
la00noix 8:2ba338b4590e 64
la00noix 8:2ba338b4590e 65 //みかんの木から三宝置き場まで移動
la00noix 8:2ba338b4590e 66 T1++;
la00noix 8:2ba338b4590e 67 }
la00noix 8:2ba338b4590e 68 if(T1 == 3) {
la00noix 8:2ba338b4590e 69 while(1) {
la00noix 8:2ba338b4590e 70 wait(0.5);
la00noix 8:2ba338b4590e 71 if(T1 == 4) {
la00noix 8:2ba338b4590e 72 break;
la00noix 8:2ba338b4590e 73 }
la00noix 8:2ba338b4590e 74 }
la00noix 8:2ba338b4590e 75 }
la00noix 8:2ba338b4590e 76 if(T1 == 4) {
la00noix 8:2ba338b4590e 77
la00noix 8:2ba338b4590e 78 //三宝置き場からりんごの木まで移動
la00noix 8:2ba338b4590e 79 wait(0.5);
la00noix 8:2ba338b4590e 80 T1++;
la00noix 8:2ba338b4590e 81 }
la00noix 8:2ba338b4590e 82 if(T1 == 5) {
la00noix 8:2ba338b4590e 83 while(1) {
la00noix 8:2ba338b4590e 84
la00noix 8:2ba338b4590e 85 wait(0.5);
la00noix 8:2ba338b4590e 86 if(T1 == 6) {
la00noix 8:2ba338b4590e 87 break;
la00noix 8:2ba338b4590e 88 }
la00noix 8:2ba338b4590e 89 }
la00noix 8:2ba338b4590e 90 }
la00noix 8:2ba338b4590e 91 if(T1 == 6) {
la00noix 8:2ba338b4590e 92
la00noix 8:2ba338b4590e 93 //りんごの木からお供え台まで移動
la00noix 8:2ba338b4590e 94 wait(0.5);
la00noix 8:2ba338b4590e 95 T1++;
la00noix 8:2ba338b4590e 96 }
la00noix 6:26724c287387 97 break;
la00noix 6:26724c287387 98 case 1:
la00noix 6:26724c287387 99 //-----left mode--------------------------------------------------------------------------------------------------------------//
la00noix 6:26724c287387 100
la00noix 6:26724c287387 101 break;
la00noix 6:26724c287387 102 }
la00noix 6:26724c287387 103 //-----wait mode----------------------------------------------------------------------------------------------------------------------//
la00noix 6:26724c287387 104 case 0:
la00noix 6:26724c287387 105
la00noix 6:26724c287387 106 calc_xy(0,1,1);
la00noix 6:26724c287387 107 ashi_led();
la00noix 6:26724c287387 108 MaxonControl(0,0,0,0);
la00noix 7:44ce34007499 109 go_waitmode = 0;
la00noix 6:26724c287387 110
la00noix 6:26724c287387 111 break;
la00noix 6:26724c287387 112 //-----manual mode--------------------------------------------------------------------------------------------------------------------//
la00noix 6:26724c287387 113 case 2:
la00noix 6:26724c287387 114
la00noix 6:26724c287387 115 ManualOut(250,100,500,200);
la00noix 7:44ce34007499 116 go_waitmode = 0;
la00noix 6:26724c287387 117
la00noix 6:26724c287387 118 break;
la00noix 0:c61c6e4775ca 119 }
la00noix 0:c61c6e4775ca 120 //------------------------------------------------------------------------------------------------------------------------------------//
la00noix 0:c61c6e4775ca 121 }
la00noix 0:c61c6e4775ca 122 }