3/13 13時24分 up
Dependencies: mbed move4wheel2 EC CruizCore_R1370P
main.cpp@6:26724c287387, 2019-03-02 (annotated)
- Committer:
- la00noix
- Date:
- Sat Mar 02 07:48:18 2019 +0000
- Revision:
- 6:26724c287387
- Parent:
- 5:6cebe1c458a9
- Child:
- 7:44ce34007499
a
Who changed what in which revision?
User | Revision | Line number | New 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 | 6:26724c287387 | 48 | |
la00noix | 6:26724c287387 | 49 | break; |
la00noix | 6:26724c287387 | 50 | case 1: |
la00noix | 6:26724c287387 | 51 | //-----left mode--------------------------------------------------------------------------------------------------------------// |
la00noix | 6:26724c287387 | 52 | |
la00noix | 6:26724c287387 | 53 | if(go_waitmode == 0) { |
la00noix | 0:c61c6e4775ca | 54 | |
la00noix | 6:26724c287387 | 55 | //can_start(); |
la00noix | 6:26724c287387 | 56 | //set_cond(2,1,-700,1,-700); |
la00noix | 6:26724c287387 | 57 | gogo_straight(1,1,-2962,3500,-2962,2900,200,1000,5,0.1,10,0.1,600,0); |
la00noix | 6:26724c287387 | 58 | purecurve(7,1,1,-2962,2900,-2317,2500,9,1000,5,0.1,10,0.1,600,0); |
la00noix | 6:26724c287387 | 59 | purecurve(8,1,1,-2317,2500,-1610,2000,9,1000,5,0.1,10,0.1,600,0); |
la00noix | 6:26724c287387 | 60 | gogo_straight(1,1,-1610,2000,-1610,1250,1000,200,5,0.1,10,0.1,600,0); |
la00noix | 6:26724c287387 | 61 | MaxonControl(0,0,0,0); |
la00noix | 6:26724c287387 | 62 | set_cond(2,0,-1243,1,1080); |
la00noix | 6:26724c287387 | 63 | pos_correction(-1610,1250,0,1,0); |
la00noix | 6:26724c287387 | 64 | wait(0.5); |
la00noix | 6:26724c287387 | 65 | |
la00noix | 6:26724c287387 | 66 | gogo_straight(1,1,-1610,1250,-1610,2000,200,1000,5,0.1,10,0.1,600,0); |
la00noix | 6:26724c287387 | 67 | purecurve(3,1,1,-1610,2000,-2317,2500,9,1000,5,0.1,10,0.1,600,0); |
la00noix | 6:26724c287387 | 68 | purecurve(4,1,1,-2317,2500,-2962,3000,9,1000,5,0.1,10,0.1,600,-90); |
la00noix | 6:26724c287387 | 69 | gogo_straight(1,1,-2962,3000,-2962,4000,1000,1000,5,0.1,10,0.1,600,-90); |
la00noix | 6:26724c287387 | 70 | gogo_straight(1,1,-2962,4000,-2962,4500,1000,200,5,0.1,10,0.1,600,-90); |
la00noix | 6:26724c287387 | 71 | MaxonControl(0,0,0,0); |
la00noix | 6:26724c287387 | 72 | pos_correction(-2962,4500,-90,1,1); |
la00noix | 6:26724c287387 | 73 | |
la00noix | 6:26724c287387 | 74 | set_cond(0,0,-2462,0,0); |
la00noix | 6:26724c287387 | 75 | gogo_straight(1,1,-2962,4500,-2850,4500,200,200,5,0.1,10,0.1,800,-90); |
la00noix | 6:26724c287387 | 76 | MaxonControl(0,0,0,0); |
la00noix | 6:26724c287387 | 77 | pos_correction(-2850,4500,-90,1,1); |
la00noix | 6:26724c287387 | 78 | wait(0.5); |
yuki0701 | 1:3c11e07da92a | 79 | |
la00noix | 6:26724c287387 | 80 | gogo_straight(1,1,-2850,4500,-2850,5150,200,1000,5,0.1,10,0.1,800,-90); |
la00noix | 6:26724c287387 | 81 | purecurve(2,1,1,-2850,5150,-2257,5500,9,1000,5,0.1,10,0.1,800,-90); |
la00noix | 6:26724c287387 | 82 | purecurve(1,1,1,-2257,5500,-1700,6000,9,1000,5,0.1,10,0.1,800,-90); |
la00noix | 6:26724c287387 | 83 | purecurve(3,1,1,-1700,6000,-2257,6647,9,1000,5,0.1,10,0.1,800,-90); |
la00noix | 6:26724c287387 | 84 | gogo_straight(1,1,-2257,6647,-2500,6647,1000,1000,5,0.1,10,0.1,800,-90); |
la00noix | 6:26724c287387 | 85 | set_cond(2,1,-3500,1,6324); |
la00noix | 6:26724c287387 | 86 | gogo_straight(1,1,-2500,6647,-2700,6647,1000,200,5,0.1,10,0.1,800,-90); |
la00noix | 6:26724c287387 | 87 | MaxonControl(0,0,0,0); |
la00noix | 6:26724c287387 | 88 | pos_correction(-2700,6647,-90,1,1); |
la00noix | 6:26724c287387 | 89 | wait(0.5); |
la00noix | 6:26724c287387 | 90 | |
la00noix | 6:26724c287387 | 91 | gogo_straight(1,1,-2700,6647,-2500,6647,200,1000,5,0.1,10,0.1,800,-90); |
la00noix | 6:26724c287387 | 92 | gogo_straight(1,1,-2500,6647,-1000,6647,1000,1000,5,0.1,10,0.1,800,-90); |
la00noix | 6:26724c287387 | 93 | purecurve(8,1,1,-1000,6647,-350,6000,9,1000,5,0.1,10,0.1,600,-180); |
la00noix | 6:26724c287387 | 94 | gogo_straight(1,1,-350,6000,-350,4700,1000,1000,5,0.1,10,0.1,600,-180); |
la00noix | 6:26724c287387 | 95 | set_cond(2,1,1243,1,4000); |
la00noix | 6:26724c287387 | 96 | gogo_straight(1,1,-350,4700,-350,4500,1000,200,5,0.1,10,0.1,800,-180); |
la00noix | 6:26724c287387 | 97 | MaxonControl(0,0,0,0); |
la00noix | 6:26724c287387 | 98 | pos_correction(-400,4500,-180,1,1); |
la00noix | 6:26724c287387 | 99 | |
la00noix | 6:26724c287387 | 100 | go_waitmode = 1; |
yuki0701 | 1:3c11e07da92a | 101 | |
la00noix | 6:26724c287387 | 102 | } else if(go_waitmode == 1) { |
la00noix | 6:26724c287387 | 103 | |
la00noix | 6:26724c287387 | 104 | MaxonControl(0,0,0,0); |
la00noix | 6:26724c287387 | 105 | |
la00noix | 6:26724c287387 | 106 | } |
la00noix | 6:26724c287387 | 107 | break; |
la00noix | 6:26724c287387 | 108 | } |
la00noix | 6:26724c287387 | 109 | //-----wait mode----------------------------------------------------------------------------------------------------------------------// |
la00noix | 6:26724c287387 | 110 | case 0: |
la00noix | 6:26724c287387 | 111 | |
la00noix | 6:26724c287387 | 112 | calc_xy(0,1,1); |
la00noix | 6:26724c287387 | 113 | ashi_led(); |
la00noix | 6:26724c287387 | 114 | MaxonControl(0,0,0,0); |
la00noix | 6:26724c287387 | 115 | |
la00noix | 6:26724c287387 | 116 | break; |
la00noix | 6:26724c287387 | 117 | //-----manual mode--------------------------------------------------------------------------------------------------------------------// |
la00noix | 6:26724c287387 | 118 | case 2: |
la00noix | 6:26724c287387 | 119 | |
la00noix | 6:26724c287387 | 120 | ManualOut(250,100,500,200); |
la00noix | 6:26724c287387 | 121 | |
la00noix | 6:26724c287387 | 122 | break; |
la00noix | 0:c61c6e4775ca | 123 | } |
la00noix | 0:c61c6e4775ca | 124 | //------------------------------------------------------------------------------------------------------------------------------------// |
la00noix | 0:c61c6e4775ca | 125 | } |
la00noix | 0:c61c6e4775ca | 126 | } |