前のやつです。

Dependencies:   FEP OmniPosition PID QEI R1307 TFmini ikarashiMDC linesSnsor omni_wheel

Committer:
tanabe2000
Date:
Sun Aug 05 02:47:05 2018 +0000
Revision:
1:af8bee219a3a
Child:
3:8f4c81ad256a
ver2

Who changed what in which revision?

UserRevisionLine numberNew contents of line
tanabe2000 1:af8bee219a3a 1 #include "gakubot.h"
tanabe2000 1:af8bee219a3a 2
tanabe2000 1:af8bee219a3a 3 GakuBot::GakuBot() :
tanabe2000 1:af8bee219a3a 4 led(LED2),
tanabe2000 1:af8bee219a3a 5 pid(KP,KI,KD,RATE),
tanabe2000 1:af8bee219a3a 6 omni(4),
tanabe2000 1:af8bee219a3a 7 angle1_1(air1_0),angle1_2(air1_1),
tanabe2000 1:af8bee219a3a 8 angle2_1(air2_0),angle2_2(air2_1),
tanabe2000 1:af8bee219a3a 9 con(XBee2TX, XBee2RX, ADDR),
tanabe2000 1:af8bee219a3a 10 wheel1 (PA_11,PA_12,NC, 2048, QEI::X4_ENCODING),
tanabe2000 1:af8bee219a3a 11 RS485control(PA_4),
tanabe2000 1:af8bee219a3a 12 RS485(PC_10,PC_11,115200),
tanabe2000 1:af8bee219a3a 13 debugpc(USBTX,USBRX,115200),
tanabe2000 1:af8bee219a3a 14 wheels( {
tanabe2000 1:af8bee219a3a 15 ikarashiMDC(&RS485control,0,0,SM,&RS485),
tanabe2000 1:af8bee219a3a 16 ikarashiMDC(&RS485control,0,1,SM,&RS485),
tanabe2000 1:af8bee219a3a 17 ikarashiMDC(&RS485control,0,2,SM,&RS485),
tanabe2000 1:af8bee219a3a 18 ikarashiMDC(&RS485control,0,3,SM,&RS485)
tanabe2000 1:af8bee219a3a 19 }),
tanabe2000 1:af8bee219a3a 20 fire( {
tanabe2000 1:af8bee219a3a 21 ikarashiMDC(&RS485control,1,0,SM,&RS485),
tanabe2000 1:af8bee219a3a 22 ikarashiMDC(&RS485control,1,1,SM,&RS485),
tanabe2000 1:af8bee219a3a 23 ikarashiMDC(&RS485control,1,2,SM,&RS485)
tanabe2000 1:af8bee219a3a 24 })
tanabe2000 1:af8bee219a3a 25 {
tanabe2000 1:af8bee219a3a 26 stick[4] = {0}, speed[4] = {0}, Output_PID = 0;
tanabe2000 1:af8bee219a3a 27 airFlag = 0,airFlag2 = 0,airStatus = 0,airStatus2 = 0;
tanabe2000 1:af8bee219a3a 28 int distance = 970,distanceOfset = 0;
tanabe2000 1:af8bee219a3a 29 omni.wheel[0].setRadian(PI / 4.0 * 1.0);
tanabe2000 1:af8bee219a3a 30 omni.wheel[1].setRadian(PI / 4.0 * 3.0);
tanabe2000 1:af8bee219a3a 31 omni.wheel[2].setRadian(PI / 4.0 * 5.0);
tanabe2000 1:af8bee219a3a 32 omni.wheel[3].setRadian(PI / 4.0 * 7.0);
tanabe2000 1:af8bee219a3a 33 for(int i = 0; i < 4; i++) {
tanabe2000 1:af8bee219a3a 34 wheels[i].braking = true;
tanabe2000 1:af8bee219a3a 35 }
tanabe2000 1:af8bee219a3a 36 for(int i = 0; i < 3; i++) {
tanabe2000 1:af8bee219a3a 37 armMotor[i].braking = true;
tanabe2000 1:af8bee219a3a 38 }
tanabe2000 1:af8bee219a3a 39 pid.setMode(AUTO_MODE);
tanabe2000 1:af8bee219a3a 40 pid.setInputLimits(-100, 1600);
tanabe2000 1:af8bee219a3a 41 pid.setOutputLimits(-1.0, 1.0);
tanabe2000 1:af8bee219a3a 42 // pid.setSetPoint(distance);// 目標値
tanabe2000 1:af8bee219a3a 43 pid.setBias(0.0); // outputの変わり目
tanabe2000 1:af8bee219a3a 44 }
tanabe2000 1:af8bee219a3a 45
tanabe2000 1:af8bee219a3a 46 void GakuBot::botConfirm()
tanabe2000 1:af8bee219a3a 47 {
tanabe2000 1:af8bee219a3a 48
tanabe2000 1:af8bee219a3a 49 }
tanabe2000 1:af8bee219a3a 50 void GakuBot::controllerMode1()
tanabe2000 1:af8bee219a3a 51 {
tanabe2000 1:af8bee219a3a 52
tanabe2000 1:af8bee219a3a 53 }
tanabe2000 1:af8bee219a3a 54 void GakuBot::autoMode1()
tanabe2000 1:af8bee219a3a 55 {
tanabe2000 1:af8bee219a3a 56
tanabe2000 1:af8bee219a3a 57 }
tanabe2000 1:af8bee219a3a 58
tanabe2000 1:af8bee219a3a 59
tanabe2000 1:af8bee219a3a 60 void GakuBot::controllMech()
tanabe2000 1:af8bee219a3a 61 {
tanabe2000 1:af8bee219a3a 62
tanabe2000 1:af8bee219a3a 63 }
tanabe2000 1:af8bee219a3a 64
tanabe2000 1:af8bee219a3a 65 void GakuBot::autoMech()
tanabe2000 1:af8bee219a3a 66 {
tanabe2000 1:af8bee219a3a 67
tanabe2000 1:af8bee219a3a 68 }