NHK2017 octopus robot

Dependencies:   2017NHKpin_config mbed FEP ikarashiMDC PID jy901 omni HMC6352 omni_wheel

Fork of KANI2017v2 by NagaokaRoboticsClub_mbedTeam

Committer:
uchitake
Date:
Wed Aug 30 17:14:11 2017 +0900
Revision:
18:6f52f4b1086a
Parent:
16:86958857c739
Child:
20:477c5d039e93
cancel motor class inheritance

Who changed what in which revision?

UserRevisionLine numberNew contents of line
UCHITAKE 0:757e9800c103 1 #include "bot.h"
UCHITAKE 0:757e9800c103 2
uchitake 18:6f52f4b1086a 3 Bot::Bot() :
uchitake 18:6f52f4b1086a 4 PIDC(), pad(XBee1TX, XBee1RX, ADDR), motor(MDSDA, MDSCL, solenoidPin)
UCHITAKE 0:757e9800c103 5 {
UCHITAKE 1:269914e0aa07 6 }
UCHITAKE 1:269914e0aa07 7
UCHITAKE 1:269914e0aa07 8 void Bot::confirmAll()
UCHITAKE 1:269914e0aa07 9 {
uchitake 16:86958857c739 10 pad.receiveState();
uchitake 15:9a2dce34b660 11 PIDC::confirm();
uchitake 16:86958857c739 12 if(pad.getNorm(1) > 0.5) PIDC::setSetPoint(pad.getRadian(1) * (180.0 / M_PI));
UCHITAKE 1:269914e0aa07 13 }
UCHITAKE 1:269914e0aa07 14
UCHITAKE 1:269914e0aa07 15 void Bot::controllDrive()
UCHITAKE 1:269914e0aa07 16 {
uchitake 18:6f52f4b1086a 17 motor.goXY(pad.getStick(0),pad.getStick(1), PIDC::co);
UCHITAKE 1:269914e0aa07 18 }
UCHITAKE 1:269914e0aa07 19
UCHITAKE 1:269914e0aa07 20 void Bot::controllMech()
UCHITAKE 1:269914e0aa07 21 {
uchitake 18:6f52f4b1086a 22 if(!pad.getButton1(0)) motor.moveSlider(ARM_MAX_SPEED);
uchitake 18:6f52f4b1086a 23 if(!pad.getButton1(1)) motor.moveSlider(-ARM_MAX_SPEED);
uchitake 18:6f52f4b1086a 24 if(pad.getButton1(0) && pad.getButton1(1)) motor.moveSlider(0);
uchitake 15:9a2dce34b660 25
uchitake 18:6f52f4b1086a 26 if(!pad.getButton1(3)) motor.shakeHead(ARM_MAX_SPEED);
uchitake 18:6f52f4b1086a 27 if(!pad.getButton1(4)) motor.shakeHead(-ARM_MAX_SPEED);
uchitake 18:6f52f4b1086a 28 if(pad.getButton1(3) && pad.getButton1(4)) motor.shakeHead(0);
UCHITAKE 1:269914e0aa07 29
uchitake 18:6f52f4b1086a 30 if(!pad.getButton1(5)) motor.swing(ARM_MAX_SPEED);
uchitake 18:6f52f4b1086a 31 if(!pad.getButton1(6)) motor.swing(-ARM_MAX_SPEED);
uchitake 18:6f52f4b1086a 32 if(pad.getButton1(5) && pad.getButton1(6)) motor.swing(0);
uchitake 15:9a2dce34b660 33
uchitake 16:86958857c739 34 if(!pad.getButton1(2)) {
uchitake 18:6f52f4b1086a 35 motor.destroy(DESTROY_MAX_SPEED);
UCHITAKE 1:269914e0aa07 36 } else {
uchitake 18:6f52f4b1086a 37 motor.destroy(0);
UCHITAKE 1:269914e0aa07 38 }
uchitake 15:9a2dce34b660 39
uchitake 18:6f52f4b1086a 40 if(!pad.getButton2(0)) motor.release();
uchitake 15:9a2dce34b660 41 }