Dependents:   OBROT_ALL

Command.h

Committer:
inst
Date:
2015-08-21
Revision:
1:e541c8ebe96b
Parent:
0:57ef16865c0b
Child:
2:58d7debaed1f

File content as of revision 1:e541c8ebe96b:

#ifndef INCLUDED_COMMAND_H
#define INCLUDED_COMMAND_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,
        ENEMYS_POLE_ID
    };
    
    Command( ActionType action, float moveDirection_rad, float moveDuty, float roll, bool isShootabl, AimTargetType target );
    
    void setActionType( ActionType action ){
        mActionType = action;
    }
    void setMoveDirection_rad( float moveDirection_rad ){
        mMoveDirection_rad = moveDirection_rad;
    }
    void setMoveDuty( float moveDuty ){
        mMoveDuty = moveDuty;
    }
    void setRollCoeff( float rollCoeff ){
        mRollCoeff = rollCoeff;
    }
    void setAimStateByTargetType( AimTargetType target );
    void setPositionOfShooting( float position ){
        mPositionOfShooting = position;
    }
    void setAngleOfShooting( float angle ){
        mAngleOfShooting = angle;
    }
    
    ActionType getActionType(){
        return mActionType;
    }
    float getMoveDirection_rad(){
        return mMoveDirection_rad;
    }
    float getMoveDuty(){
        return mMoveDuty;
    }
    float getRollCoeff(){
        return mRollCoeff;
    }
    float getPositionOfShooting(){
        return mPositionOfShooting;
    }
    float getAngleOfShooting(){
        return mAngleOfShooting;
    }
    bool isShootable(){
        return mIsShootable;
    }
    
private:
    static const float mPositionSetOfShooting[];
    static const float mAngleSetOfShooting[];
    
    ActionType mActionType;
    float mMoveDirection_rad;
    float mMoveDuty;
    float mRollCoeff;
    float mPositionOfShooting;
    float mAngleOfShooting;
    bool mIsShootable;
};

#endif