未完成
Dependencies: linemiconget petbottle_Loadin5port Kinect OmniPosition PID QEI led R1307 S-ShapeModel SerialMultiByte TFmini fep2 ikarashiMDC linesSnsor omni_wheel solenoid_valve
gakuBot/gakubot.h@0:7822f4172b0c, 2018-10-12 (annotated)
- Committer:
- tanabe2000
- Date:
- Fri Oct 12 04:40:56 2018 +0000
- Revision:
- 0:7822f4172b0c
- Child:
- 2:c501f6845500
????????;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
tanabe2000 | 0:7822f4172b0c | 1 | #ifndef BOT_H |
tanabe2000 | 0:7822f4172b0c | 2 | #define BOT_H |
tanabe2000 | 0:7822f4172b0c | 3 | |
tanabe2000 | 0:7822f4172b0c | 4 | #include "mbed.h" |
tanabe2000 | 0:7822f4172b0c | 5 | #include "ikarashiMDC.h" |
tanabe2000 | 0:7822f4172b0c | 6 | //#include "controller.h" |
tanabe2000 | 0:7822f4172b0c | 7 | #include "linemiconget.h" |
tanabe2000 | 0:7822f4172b0c | 8 | #include "omni_wheel.h" |
tanabe2000 | 0:7822f4172b0c | 9 | #include "OmniPosition.h" |
tanabe2000 | 0:7822f4172b0c | 10 | #include "PID.h" |
tanabe2000 | 0:7822f4172b0c | 11 | #include "QEI.h" |
tanabe2000 | 0:7822f4172b0c | 12 | #include "position_controller.h" |
tanabe2000 | 0:7822f4172b0c | 13 | #include "solenoid_valve.h" |
tanabe2000 | 0:7822f4172b0c | 14 | #include "petbottleLoading.h" |
tanabe2000 | 0:7822f4172b0c | 15 | #include"fep_kinect.h" |
tanabe2000 | 0:7822f4172b0c | 16 | #include "pin_config.h" |
tanabe2000 | 0:7822f4172b0c | 17 | |
tanabe2000 | 0:7822f4172b0c | 18 | #define loadingParamator 1955 |
tanabe2000 | 0:7822f4172b0c | 19 | #define slidorparamotor 1000-127 |
tanabe2000 | 0:7822f4172b0c | 20 | |
tanabe2000 | 0:7822f4172b0c | 21 | #define PI 3.141592653589793 |
tanabe2000 | 0:7822f4172b0c | 22 | #define ADDR 198 |
tanabe2000 | 0:7822f4172b0c | 23 | |
tanabe2000 | 0:7822f4172b0c | 24 | |
tanabe2000 | 0:7822f4172b0c | 25 | //#define angleKP 4.2 |
tanabe2000 | 0:7822f4172b0c | 26 | //#define angleKI 0.0 |
tanabe2000 | 0:7822f4172b0c | 27 | //#define angleKD 0.0001 |
tanabe2000 | 0:7822f4172b0c | 28 | #define angleKP 3.5 |
tanabe2000 | 0:7822f4172b0c | 29 | #define angleKI 0.0 |
tanabe2000 | 0:7822f4172b0c | 30 | #define angleKD 0.00005 |
tanabe2000 | 0:7822f4172b0c | 31 | |
tanabe2000 | 0:7822f4172b0c | 32 | #define fire1KP 10.8 |
tanabe2000 | 0:7822f4172b0c | 33 | #define fire1KI 0.095 |
tanabe2000 | 0:7822f4172b0c | 34 | #define fire1KD 0.00005 |
tanabe2000 | 0:7822f4172b0c | 35 | |
tanabe2000 | 0:7822f4172b0c | 36 | #define fire2KP 10.8 |
tanabe2000 | 0:7822f4172b0c | 37 | #define fire2KI 0.095 |
tanabe2000 | 0:7822f4172b0c | 38 | #define fire2KD 0.00005 |
tanabe2000 | 0:7822f4172b0c | 39 | |
tanabe2000 | 0:7822f4172b0c | 40 | #define XKP 17.0 |
tanabe2000 | 0:7822f4172b0c | 41 | #define XIP 0//4.0,9.0 |
tanabe2000 | 0:7822f4172b0c | 42 | #define XDP 0.0004 |
tanabe2000 | 0:7822f4172b0c | 43 | |
tanabe2000 | 0:7822f4172b0c | 44 | #define YKP 17.0 |
tanabe2000 | 0:7822f4172b0c | 45 | #define YIP 0 |
tanabe2000 | 0:7822f4172b0c | 46 | #define YDP 0.0004 |
tanabe2000 | 0:7822f4172b0c | 47 | |
tanabe2000 | 0:7822f4172b0c | 48 | #define frontKP 0.0 |
tanabe2000 | 0:7822f4172b0c | 49 | #define frontKP 0.0 |
tanabe2000 | 0:7822f4172b0c | 50 | #define frontKD 0.0 |
tanabe2000 | 0:7822f4172b0c | 51 | |
tanabe2000 | 0:7822f4172b0c | 52 | #define behindKP 0.4 |
tanabe2000 | 0:7822f4172b0c | 53 | #define behindKI 0.0 |
tanabe2000 | 0:7822f4172b0c | 54 | #define behindKD 0.00015 |
tanabe2000 | 0:7822f4172b0c | 55 | |
tanabe2000 | 0:7822f4172b0c | 56 | #define RATE 0.01 |
tanabe2000 | 0:7822f4172b0c | 57 | #define PI 3.14159265 |
tanabe2000 | 0:7822f4172b0c | 58 | |
tanabe2000 | 0:7822f4172b0c | 59 | #define KA 0.95 |
tanabe2000 | 0:7822f4172b0c | 60 | |
tanabe2000 | 0:7822f4172b0c | 61 | //#define MOTOR_MODE_STOP 0 |
tanabe2000 | 0:7822f4172b0c | 62 | //#define MOTOR_MODE_FORWARD 1 |
tanabe2000 | 0:7822f4172b0c | 63 | //#define MOTOR_MODE_BACKWARD 2 |
tanabe2000 | 0:7822f4172b0c | 64 | //#define MOTOR_MODE_RIGHT 3 |
tanabe2000 | 0:7822f4172b0c | 65 | //#define MOTOR_MODE_LEFT 4 |
tanabe2000 | 0:7822f4172b0c | 66 | |
tanabe2000 | 0:7822f4172b0c | 67 | #define table2400X 2133 |
tanabe2000 | 0:7822f4172b0c | 68 | #define table2400Y -4755 |
tanabe2000 | 0:7822f4172b0c | 69 | #define table1800X 7756 |
tanabe2000 | 0:7822f4172b0c | 70 | #define table1500X 6464 |
tanabe2000 | 0:7822f4172b0c | 71 | #define table1200X 5160 |
tanabe2000 | 0:7822f4172b0c | 72 | #define dash1X 1063 |
tanabe2000 | 0:7822f4172b0c | 73 | #define dash1Y -2113 |
tanabe2000 | 0:7822f4172b0c | 74 | #define dash2X 1046 |
tanabe2000 | 0:7822f4172b0c | 75 | #define dash2Y -4618 |
tanabe2000 | 0:7822f4172b0c | 76 | #define dash3X 2465 |
tanabe2000 | 0:7822f4172b0c | 77 | #define dash3Y -4609 |
tanabe2000 | 0:7822f4172b0c | 78 | |
tanabe2000 | 0:7822f4172b0c | 79 | #define wallmodeY -4300 |
tanabe2000 | 0:7822f4172b0c | 80 | #define walldashY -4700 |
tanabe2000 | 0:7822f4172b0c | 81 | #define wallslide 0.5 |
tanabe2000 | 0:7822f4172b0c | 82 | |
tanabe2000 | 0:7822f4172b0c | 83 | |
tanabe2000 | 0:7822f4172b0c | 84 | |
tanabe2000 | 0:7822f4172b0c | 85 | |
tanabe2000 | 0:7822f4172b0c | 86 | class GakuBot |
tanabe2000 | 0:7822f4172b0c | 87 | { |
tanabe2000 | 0:7822f4172b0c | 88 | public: |
tanabe2000 | 0:7822f4172b0c | 89 | GakuBot(); |
tanabe2000 | 0:7822f4172b0c | 90 | void botConfirm(); |
tanabe2000 | 0:7822f4172b0c | 91 | void controllerMode1(); |
tanabe2000 | 0:7822f4172b0c | 92 | void controllerMode2(); |
tanabe2000 | 0:7822f4172b0c | 93 | void controllMech1(); |
tanabe2000 | 0:7822f4172b0c | 94 | void controllMech2(); |
tanabe2000 | 0:7822f4172b0c | 95 | void autoMode1(); |
tanabe2000 | 0:7822f4172b0c | 96 | void autoMode2(); |
tanabe2000 | 0:7822f4172b0c | 97 | |
tanabe2000 | 0:7822f4172b0c | 98 | |
tanabe2000 | 0:7822f4172b0c | 99 | void controllMech(); |
tanabe2000 | 0:7822f4172b0c | 100 | |
tanabe2000 | 0:7822f4172b0c | 101 | private: |
tanabe2000 | 0:7822f4172b0c | 102 | DigitalOut led; |
tanabe2000 | 0:7822f4172b0c | 103 | |
tanabe2000 | 0:7822f4172b0c | 104 | /*PID系*/ |
tanabe2000 | 0:7822f4172b0c | 105 | PID fire1Pid, fire2Pid, anglePID, XPid, YPid, distanceFrontPid, distanceBehindPid; |
tanabe2000 | 0:7822f4172b0c | 106 | |
tanabe2000 | 0:7822f4172b0c | 107 | Serial debugpc; |
tanabe2000 | 0:7822f4172b0c | 108 | /*モータ系*/ |
tanabe2000 | 0:7822f4172b0c | 109 | OmniWheel omni; |
tanabe2000 | 0:7822f4172b0c | 110 | DigitalOut RS485control; |
tanabe2000 | 0:7822f4172b0c | 111 | Serial RS485; |
tanabe2000 | 0:7822f4172b0c | 112 | ikarashiMDC* wheels[4]; |
tanabe2000 | 0:7822f4172b0c | 113 | ikarashiMDC* fire[2]; |
tanabe2000 | 0:7822f4172b0c | 114 | double firePwm[2]; |
tanabe2000 | 0:7822f4172b0c | 115 | float stick[4], speed[4]; |
tanabe2000 | 0:7822f4172b0c | 116 | |
tanabe2000 | 0:7822f4172b0c | 117 | /*角度系*/ |
tanabe2000 | 0:7822f4172b0c | 118 | float Output_PID,Output_PID2,nowAngle, ofsetNowAngle, attachAngle; |
tanabe2000 | 0:7822f4172b0c | 119 | int pullDistance, pullDistanceOfset, nowPals, distanceOfset, distanceOfset2, nowPals2; |
tanabe2000 | 0:7822f4172b0c | 120 | /*受信系*/ |
tanabe2000 | 0:7822f4172b0c | 121 | // Controller con; |
tanabe2000 | 0:7822f4172b0c | 122 | bool receiveSuccessed; |
tanabe2000 | 0:7822f4172b0c | 123 | int mode; |
tanabe2000 | 0:7822f4172b0c | 124 | OmniPosition getposition; |
tanabe2000 | 0:7822f4172b0c | 125 | fep_kinect kinect; |
tanabe2000 | 0:7822f4172b0c | 126 | linemiconget lmicon; |
tanabe2000 | 0:7822f4172b0c | 127 | /*座標系*/ |
tanabe2000 | 0:7822f4172b0c | 128 | PositionController* conposition; |
tanabe2000 | 0:7822f4172b0c | 129 | |
tanabe2000 | 0:7822f4172b0c | 130 | /*タイマー系*/ |
tanabe2000 | 0:7822f4172b0c | 131 | Timer t ,confirmT, pidT; |
tanabe2000 | 0:7822f4172b0c | 132 | double dt, confirmDt; |
tanabe2000 | 0:7822f4172b0c | 133 | PortValve valveFire1, valveFire2; |
tanabe2000 | 0:7822f4172b0c | 134 | Timer pt, fireFrag1time; |
tanabe2000 | 0:7822f4172b0c | 135 | float pdt; |
tanabe2000 | 0:7822f4172b0c | 136 | int fireDistance1,fireDistance2 , loadingmode; |
tanabe2000 | 0:7822f4172b0c | 137 | petbottleLoading loading; |
tanabe2000 | 0:7822f4172b0c | 138 | int airFlag, sw3flag; |
tanabe2000 | 0:7822f4172b0c | 139 | float beforeYaw, yawdegree; |
tanabe2000 | 0:7822f4172b0c | 140 | int yawMode; |
tanabe2000 | 0:7822f4172b0c | 141 | DigitalIn startSW; |
tanabe2000 | 0:7822f4172b0c | 142 | float demoX,demoY; |
tanabe2000 | 0:7822f4172b0c | 143 | int lineCount; |
tanabe2000 | 0:7822f4172b0c | 144 | int getx, gety; |
tanabe2000 | 0:7822f4172b0c | 145 | int fireFlag1, fireFlag2; |
tanabe2000 | 0:7822f4172b0c | 146 | DigitalIn limit1,limit2; |
tanabe2000 | 0:7822f4172b0c | 147 | double X, Y; |
tanabe2000 | 0:7822f4172b0c | 148 | double Xlopass, Xlopassb, Ylopass, Ylopassb, targetradians; |
tanabe2000 | 0:7822f4172b0c | 149 | int Xdemo[5], Ydemo[5], demomode; |
tanabe2000 | 0:7822f4172b0c | 150 | int movetablemode, firecount, fireFlag, modeFlag; |
tanabe2000 | 0:7822f4172b0c | 151 | int solenoidValve1is, solenoidValve2is , dpetbotle; |
tanabe2000 | 0:7822f4172b0c | 152 | float fireMDCPwm[2], piddt; |
tanabe2000 | 0:7822f4172b0c | 153 | int start_; |
tanabe2000 | 0:7822f4172b0c | 154 | int suzuki[3]; |
tanabe2000 | 0:7822f4172b0c | 155 | int kabeFlag; |
tanabe2000 | 0:7822f4172b0c | 156 | int kinectmode, kinectDistance; |
tanabe2000 | 0:7822f4172b0c | 157 | int kinectFlag, swflag; |
tanabe2000 | 0:7822f4172b0c | 158 | |
tanabe2000 | 0:7822f4172b0c | 159 | }; |
tanabe2000 | 0:7822f4172b0c | 160 | |
tanabe2000 | 0:7822f4172b0c | 161 | |
tanabe2000 | 0:7822f4172b0c | 162 | #endif//BOT_H |