Dependents:   OBROT_ALL

Revision:
2:58d7debaed1f
Parent:
1:e541c8ebe96b
diff -r e541c8ebe96b -r 58d7debaed1f Command.h
--- a/Command.h	Fri Aug 21 04:51:05 2015 +0000
+++ b/Command.h	Wed Oct 14 05:50:26 2015 +0000
@@ -1,34 +1,29 @@
 #ifndef INCLUDED_COMMAND_H
 #define INCLUDED_COMMAND_H
 
+#include "Steering.h"
+#include "Shooter.h"
+#include "ShootingSystem.h"
+
 class Command{
 public:
-    enum ActionType{
-        STOP        = 0x00,
-        MOVE        = 0x10,
-        ROLL        = 0x20,
-        ABS_ROLL    = 0x30,
-        WAIT_SERVO  = 0xFF  // 通信で送られて来ることはないデータ
-    };
-    
-    enum AimTargetType{
-        NONE        = 0x0,
-        OWN_POLE    = 0x4,
-        CENTER_POLE = 0x8,
-        ENEMYS_POLE = 0xC
-    };
-    
     enum ShotTargetID{
         OWN_POLE_ID,
-        CENTER_POLE_ID,
+        CENTER_MIDDLE_POLE_ID,
+        CENTER_SIDE_POLE_ID,
         ENEMYS_POLE_ID
     };
     
-    Command( ActionType action, float moveDirection_rad, float moveDuty, float roll, bool isShootabl, AimTargetType target );
+    Command();
+    Command( Steering::ActionType steeringAction,
+             ShootingSystem::AimState aimState,
+             float moveDirection_rad, float angleAdjust_deg,
+             float moveDuty, float roll, bool isSupplying );
     
-    void setActionType( ActionType action ){
-        mActionType = action;
+    void setSteeringActionType( Steering::ActionType action ){
+        mSteeringActionType = action;
     }
+    void setAimStateAndAimParam( ShootingSystem::AimState aimState );
     void setMoveDirection_rad( float moveDirection_rad ){
         mMoveDirection_rad = moveDirection_rad;
     }
@@ -38,16 +33,21 @@
     void setRollCoeff( float rollCoeff ){
         mRollCoeff = rollCoeff;
     }
-    void setAimStateByTargetType( AimTargetType target );
-    void setPositionOfShooting( float position ){
-        mPositionOfShooting = position;
+    void setAngleOfShooting( float angle ){
+        mShootingAngle_deg = angle;
     }
-    void setAngleOfShooting( float angle ){
-        mAngleOfShooting = angle;
+    void setAngleAdjust_deg( float angle_deg ){
+        mAngleAdjust_deg = angle_deg;
+    }
+    void setShooterPosition( float pos ){
+        mShooterPosition = pos;
     }
     
-    ActionType getActionType(){
-        return mActionType;
+    Steering::ActionType getSteeringActionType(){
+        return mSteeringActionType;
+    }
+    ShootingSystem::AimState getAimState(){
+        return mAimState;
     }
     float getMoveDirection_rad(){
         return mMoveDirection_rad;
@@ -58,27 +58,48 @@
     float getRollCoeff(){
         return mRollCoeff;
     }
-    float getPositionOfShooting(){
-        return mPositionOfShooting;
+    float getShootingAngleAnalog(){
+        return angleToAnalog( mShootingAngle_deg );
+    }
+    Shooter::ActionType getShootVoltage(){
+        return mShootVoltage;
+    }
+    float getAngleAdjust_deg(){
+        return mAngleAdjust_deg;
     }
-    float getAngleOfShooting(){
-        return mAngleOfShooting;
+    float getShooterPosition(){
+        return mShooterPosition;
     }
-    bool isShootable(){
-        return mIsShootable;
+    bool isShooting(){
+        return mIsShooting;
+    }
+    bool isSupplying(){
+        return mIsSupplying;
     }
     
 private:
-    static const float mPositionSetOfShooting[];
-    static const float mAngleSetOfShooting[];
+    float angleToAnalog( float angle_deg ){
+        return mAngleToAnalogCoeffA * angle_deg + mAngleToAnalogCoeffB;
+    }
+
+    static const float mShootingAngleTable[];
+    static const float mAngleToAnalogCoeffA;
+    static const float mAngleToAnalogCoeffB;
+    static const float mMaxAngle_deg;
+    static const float mMinAngle_deg;
+    static const float mShooterPositionTable[];
     
-    ActionType mActionType;
+    Steering::ActionType mSteeringActionType;
+    Shooter::ActionType mShootVoltage;
+    ShootingSystem::AimState mAimState;
     float mMoveDirection_rad;
     float mMoveDuty;
     float mRollCoeff;
-    float mPositionOfShooting;
-    float mAngleOfShooting;
-    bool mIsShootable;
+    float mShootingAngle_deg;
+    float mAngleAdjust_deg;
+    float mShooterPosition;
+    bool mIsShooting;
+    bool mIsSupplying;
 };
 
 #endif