示例#1
0
  gr_Robot_Command SkillSet::turnToPoint(const SParam &param, const BeliefState &state, int botID)
  {
    Vector2D<int> point(param.TurnToPointP.x, param.TurnToPointP.y);
    Vector2D<int> botPos(state.homePos[botID].x, state.homePos[botID].y);
    Vector2D<int> ballPos(state.ballPos.x, state.ballPos.y);

    float finalSlope = Vector2D<int>::angle(point, botPos);
    float turnAngleLeft = normalizeAngle(finalSlope - state.homePos[botID].theta); // Angle left to turn
    float omega = turnAngleLeft * param.TurnToPointP.max_omega / (2 * PI); // Speedup turn
    if(omega < MIN_BOT_OMEGA && omega > -MIN_BOT_OMEGA)
    {
      if(omega < 0) omega = -MIN_BOT_OMEGA;
      else omega = MIN_BOT_OMEGA;
    }
    float v_x = omega*BOT_BALL_THRESH*1.5;
    // comm.addCircle(state->homePos[botID].x,  state->homePos[botID].y, 50);
    float dist = Vector2D<int>::dist(ballPos, botPos);
    if(dist < DRIBBLER_BALL_THRESH*1.2)
    {
      return getRobotCommandMessage(botID, v_x, 0, omega, 0, true);
    }
    else
    {
      return getRobotCommandMessage(botID, 0, 0, omega, 0, false);
    }
  }
示例#2
0
 gr_Robot_Command SkillSet::kick(const SParam &param, const BeliefState &state, int botID)
 {
   return getRobotCommandMessage(botID, 0, 0, 0, param.KickP.power, false);
 } // kick
示例#3
0
文件: sDribble.cpp 项目: KRSSG/skills
  gr_Robot_Command SkillSet::dribble(const SParam &param, const BeliefState &state, int botID)
  {
//    Logger::toStdOut("%f\n", state->homeAngle[botID]);
  	 return getRobotCommandMessage(botID, 0, 0, 0, 0, true);
  } // dribble