⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 thestrut.h

📁 该文件是包含了机器人足球比赛中的整个系统的代码
💻 H
📖 第 1 页 / 共 2 页
字号:
    // intermediate arbitrary locus points (not scaled or interpolated)
    double** FR_origLocusPoints;
    double** FL_origLocusPoints;
    double** BR_origLocusPoints;
    double** BL_origLocusPoints;

    // traction control mechanism
    Traction traction;

#ifdef ERS_7
    static const int TILT1_INDEX = 0;
    static const int PAN_INDEX  = 1;
    static const int TILT2_INDEX = 2;

    static const word TILT1_PGAIN = 0x000A;
    static const word TILT1_IGAIN = 0x0004;
    static const word TILT1_DGAIN = 0x0002;

    static const word PAN_PGAIN = 0x0008;
    static const word PAN_IGAIN = 0x0002;
    static const word PAN_DGAIN = 0x0004;

    static const word TILT2_PGAIN = 0x0008;
    static const word TILT2_IGAIN = 0x0004;
    static const word TILT2_DGAIN = 0x0002;

    static const word J1_PGAIN = 0x001C;
    static const word J1_IGAIN = 0x0008;
    static const word J1_DGAIN = 0x0001;

    static const word J2_PGAIN = 0x0014;
    static const word J2_IGAIN = 0x0004;
    static const word J2_DGAIN = 0x0001;

    static const word J3_PGAIN = 0x001C;
    static const word J3_IGAIN = 0x0008;
    static const word J3_DGAIN = 0x0005;

//    static const int L_EAR_INDEX = 0;
//    static const int R_EAR_INDEX = 1;
    static const int MOUTH_INDEX = 0;
    static const int TAIL_HORI_INDEX = 1;
    static const int TAIL_VERT_INDEX  = 2;

    static const word TAIL_HORI_PGAIN = 0x000A;
    static const word TAIL_HORI_IGAIN = 0x0004;
    static const word TAIL_HORI_DGAIN = 0x0004;

    static const word TAIL_VERT_PGAIN = 0x000A;
    static const word TAIL_VERT_IGAIN = 0x0004;
    static const word TAIL_VERT_DGAIN = 0x0004;

    static const word MOUTH_PGAIN = 0x0008;
    static const word MOUTH_IGAIN = 0x0000;
    static const word MOUTH_DGAIN = 0x0004;

    static const word L_EAR_PGAIN = 0x0000;
    static const word L_EAR_IGAIN = 0x0000;
    static const word L_EAR_DGAIN = 0x0000;

    static const word R_EAR_PGAIN = 0x0000;
    static const word R_EAR_IGAIN = 0x0000;
    static const word R_EAR_DGAIN = 0x0000;

    static const word PSHIFT = 0x000E;
    static const word ISHIFT = 0x0002;
    static const word DSHIFT = 0x000F;
#endif
#ifdef ERS_210
    static const int TILT_INDEX = 0;
    static const int PAN_INDEX  = 1;
    static const int ROLL_INDEX = 2;

    static const word TILT_PGAIN = 0x000a;
    static const word TILT_IGAIN = 0x0008;
    static const word TILT_DGAIN = 0x000c;

    static const word PAN_PGAIN = 0x000d;
    static const word PAN_IGAIN = 0x0008;
    static const word PAN_DGAIN = 0x000b;

//  static const word ROLL_PGAIN = 0x000a; ?? conflicting docs
    static const word ROLL_PGAIN = 0x000c;
    static const word ROLL_IGAIN = 0x0008;
    static const word ROLL_DGAIN = 0x000c;


    static const word J1_PGAIN = 0x0016;
    static const word J1_IGAIN = 0x0004;
    static const word J1_DGAIN = 0x0008;

    static const word J2_PGAIN = 0x0014;
    static const word J2_IGAIN = 0x0004;
    static const word J2_DGAIN = 0x0006;

    static const word J3_PGAIN = 0x0023;
    static const word J3_IGAIN = 0x0004;
    static const word J3_DGAIN = 0x0005;

    static const int MOUTH_INDEX = 0;
    static const int TAIL_HORI_INDEX = 1;
    static const int TAIL_VERT_INDEX  = 2;
//    static const int L_EAR_INDEX = 1;
//    static const int R_EAR_INDEX = 2;


    static const word TAIL_HORI_PGAIN = 0x000A;
    static const word TAIL_HORI_IGAIN = 0x0000;
    static const word TAIL_HORI_DGAIN = 0x0018;

    static const word TAIL_VERT_PGAIN = 0x0007;
    static const word TAIL_VERT_IGAIN = 0x0000;
    static const word TAIL_VERT_DGAIN = 0x0011;

    static const word MOUTH_PGAIN = 0x000E;
    static const word MOUTH_IGAIN = 0x0008;
    static const word MOUTH_DGAIN = 0x0010;

    static const word L_EAR_PGAIN = 0x0000;
    static const word L_EAR_IGAIN = 0x0000;
    static const word L_EAR_DGAIN = 0x0000;

    static const word R_EAR_PGAIN = 0x0000;
    static const word R_EAR_IGAIN = 0x0000;
    static const word R_EAR_DGAIN = 0x0000;

    static const word PSHIFT = 0x000e;
    static const word ISHIFT = 0x0002;
    static const word DSHIFT = 0x000f;
#endif

    //Higher level control variables
    bool jointsInitialised;
    bool jointsReady;
    bool headJointsInitialised;
    bool inDefaultStance;
    bool isWalking;
    bool isKicking;
    bool isInterpolating;
    bool isDebugStall;

    int locusType;
    void (TheStrut::*locusFunction)(double*, double*, double*, double, double, double, double, double, double, double, double);

    // maximum number of joint frames that can be sent in one execution of walk, kick, etc
    int maxWalkFrames;
    int maxKickFrames;
    int maxHeadFrames;
    int maxInterFrames;
    int maxDoNothingFrames;

    //Interpolation variables, all in MICRORADS !
    long headJointEndPoints[NUM_HEAD_JOINTS];
    long bodyJointEndPoints[NUM_BODY_JOINTS];
    long otherJointEndPoints[NUM_OTHER_JOINTS];
    long interpolationError; // in MICRORADS
    bool interpolateHead;
    long interpolationRate;

    // this stores the locomotioncommand that must be performed after interpolation.
    // normally, we're interpolating to the first frame of this locomotion command. once we
    // reach that location, we'll execute the command.
    LocomotionCommand nextLocomotionCommand;

    // ensures we have joint position data.
    bool prevPointsSet;
    // current joint position data.
    long headJointPrevPoints[NUM_HEAD_JOINTS];
    long bodyJointPrevPoints[NUM_BODY_JOINTS];

    double verticalStrokeTimeMultiplier;
   
    //Sway parameters
    double swaySpeed;
    double swayMax;
    double swayParameter;
    int swayDirection;

    //Motion parameters
    double timeParameter;
    double stepFrequency;
    
    // kick parameters
    double kickFrame;
    int motionType;
    int kickIndex;
    string kickName;
    bool kickUsesHead;

    // parameters currently being used to walk.
    double frontForwardComponent;
    double backForwardComponent;
    double frontTurnComponent;
    double backTurnComponent;
    double frontSideComponent;
    double backSideComponent;

    // turn settings (to make degrees passed into thestrut actually work properly)
    double turnMultiplier;
    double turnMultiplierWithoutFront;

    double forwardOdometryMultiplier; // deprecated, FIXME (remove)

    // walk multipliers (to make distances passed into thestrut actually work properly)
    double forwardMultiplier;
    double backMultiplier;
    double strafeMultiplier;


    double frontStrideLength;
    double frontStrideHeight;
    double frontForwardOffset;
    double frontSideOffset;
    double frontHeight;

    double backStrideLength;
    double backStrideHeight;
    double backForwardOffset;
    double backSideOffset;
    double backHeight;

    double turn;
    double odomTurn;

    // used so left and right turns can be made symmetric...
    bool offsetWalk;

    // these are used for inverse kinematic information only
    double strafe;

    // head parameters
    double headPan;
    double headTilt1;
    double headTilt2;
    bool allowHeadCommandInterpolation;

    // bounds for fallover detection. loaded from CFG
    double fallOverBound1;
    double fallOverBound2;
    double fallOverBound3;

    //Joint command handling. Hooray for OPEN-R !!
    OJointCommandValue2* headValue[NUM_HEAD_JOINTS];
    OJointCommandValue2* bodyValue[NUM_BODY_JOINTS];
    OJointCommandValue2* otherValue[NUM_OTHER_JOINTS];
#ifdef ERS_210
    OLEDCommandValue2* ledValue[NUM_LEDS];
#endif
#ifdef ERS_7
    OLEDCommandValue2* ledValue[NUM_LEDS];
    OLEDCommandValue3* ledValue2[NUM_LEDS_2];
#endif

    OPrimitiveID headJointID[NUM_HEAD_JOINTS];
    OPrimitiveID bodyJointID[NUM_BODY_JOINTS];
    OPrimitiveID otherJointID[NUM_OTHER_JOINTS];
    OPrimitiveID ledID[NUM_LEDS+NUM_LEDS_2];

    OCommandVectorData* headVec[NUM_BUFFERS];
    OCommandVectorData* bodyVec[NUM_BUFFERS];
    OCommandVectorData* otherVec[NUM_BUFFERS];
    OCommandVectorData* ledVec[NUM_BUFFERS];

    MemoryRegionID headVecID[NUM_BUFFERS];
    MemoryRegionID bodyVecID[NUM_BUFFERS];
    MemoryRegionID otherVecID[NUM_BUFFERS];
    MemoryRegionID ledVecID[NUM_BUFFERS];

    RCRegion* cmdHeadRegion[NUM_BUFFERS];
    RCRegion* cmdBodyRegion[NUM_BUFFERS];
    RCRegion* cmdOtherRegion[NUM_BUFFERS];
    RCRegion* cmdLedRegion[NUM_BUFFERS];
};


#endif // _TheStrut_h_DEFINED

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -