Dependencies:   AmmoPusher AmmoSupplier Shooter

Dependents:   OBROT_ALL

Committer:
inst
Date:
Thu Oct 15 08:45:53 2015 +0000
Revision:
3:bf4ae302724c
Parent:
1:3b0b583eba77

        

Who changed what in which revision?

UserRevisionLine numberNew contents of line
inst 0:987c53b6a212 1 #ifndef INCLUDED_SHOOTING_SYSTEM_H
inst 0:987c53b6a212 2 #define INCLUDED_SHOOTING_SYSTEM_H
inst 0:987c53b6a212 3
inst 0:987c53b6a212 4 class I2CServo;
inst 0:987c53b6a212 5 class I2CMotor;
inst 0:987c53b6a212 6 class Command;
inst 0:987c53b6a212 7 class AmmoPusher;
inst 0:987c53b6a212 8 class AmmoSupplier;
inst 1:3b0b583eba77 9 class AmmoSupplierManager;
inst 0:987c53b6a212 10 class Shooter;
inst 1:3b0b583eba77 11 #include "mbed.h"
inst 0:987c53b6a212 12
inst 0:987c53b6a212 13 class ShootingSystem{
inst 0:987c53b6a212 14 public:
inst 1:3b0b583eba77 15 enum AimState{
inst 1:3b0b583eba77 16 AIM_OWN_POLE = 0x00,
inst 1:3b0b583eba77 17 AIM_CENTER_MIDDLE_POLE = 0x40,
inst 1:3b0b583eba77 18 AIM_CENTER_SIDE_POLE = 0x80,
inst 1:3b0b583eba77 19 AIM_ENEMYS_POLE = 0xC0
inst 1:3b0b583eba77 20 };
inst 1:3b0b583eba77 21
inst 1:3b0b583eba77 22 enum State{
inst 1:3b0b583eba77 23 WAITING,
inst 1:3b0b583eba77 24 SHOOTING,
inst 1:3b0b583eba77 25 SHOOT_PREPARATION,
inst 1:3b0b583eba77 26 SHOOT_WAITING,
inst 1:3b0b583eba77 27 AMMO_SUPPLYING
inst 1:3b0b583eba77 28 };
inst 1:3b0b583eba77 29
inst 1:3b0b583eba77 30 static bool isShootable(){
inst 1:3b0b583eba77 31 return mIsShootable;
inst 1:3b0b583eba77 32 }
inst 1:3b0b583eba77 33
inst 1:3b0b583eba77 34 ShootingSystem( I2CServo* angleManagerServo, AmmoPusher* ammoPusher,
inst 1:3b0b583eba77 35 AmmoSupplier* ammoSupplier, Shooter* shooter,
inst 1:3b0b583eba77 36 I2CServo* positoinManager );
inst 3:bf4ae302724c 37 ~ShootingSystem();
inst 1:3b0b583eba77 38
inst 0:987c53b6a212 39 void update( Command command );
inst 1:3b0b583eba77 40
inst 0:987c53b6a212 41 private:
inst 1:3b0b583eba77 42 void waiting( Command command );
inst 1:3b0b583eba77 43 void shooting();
inst 1:3b0b583eba77 44 void shootWaiting();
inst 1:3b0b583eba77 45 void shootPreparation();
inst 1:3b0b583eba77 46 void ammoSupply();
inst 0:987c53b6a212 47
inst 1:3b0b583eba77 48 static bool mIsShootable;
inst 1:3b0b583eba77 49
inst 3:bf4ae302724c 50 I2CServo* mShooterAngleServo;
inst 3:bf4ae302724c 51 AmmoPusher* mAmmoPusher;
inst 3:bf4ae302724c 52 AmmoSupplier* mAmmoSupplier;
inst 3:bf4ae302724c 53 Shooter* mShooter;
inst 3:bf4ae302724c 54 I2CServo* mPositionManager;
inst 1:3b0b583eba77 55 State mState;
inst 1:3b0b583eba77 56 Timer mTimer;
inst 0:987c53b6a212 57 };
inst 0:987c53b6a212 58
inst 0:987c53b6a212 59 #endif