Skip to content

Commit

Permalink
シュートを止める場所が遠い場合に加速する
Browse files Browse the repository at this point in the history
  • Loading branch information
HansRobo committed Feb 23, 2024
1 parent 0b1d430 commit 918a86e
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions crane_robot_skills/src/goalie.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,13 +96,17 @@ void Goalie::inplay(RobotCommandWrapper::SharedPtr & command, bool enable_emit)
Segment ball_line(ball, ball + world_model->ball.vel.normalized() * 20.f);
std::vector<Point> intersections;
bg::intersection(ball_line, Segment{goals.first, goals.second}, intersections);
command->setTerminalVelocity(0.0);
if (not intersections.empty() && world_model->ball.vel.norm() > 0.5f) {
// シュートブロック
phase = "シュートブロック";
ClosestPoint result;
bg::closest_point(ball_line, command->robot->pose.pos, result);
command->setTargetPosition(result.closest_point);
command->setTargetTheta(getAngle(-world_model->ball.vel));
if (command->robot->getDistance(ball) > 0.3) {
command->setTerminalVelocity(2.0);
}
} else {
if (world_model->ball.isStopped() && world_model->isFriendDefenseArea(ball) && enable_emit) {
// ボールが止まっていて,味方ペナルティエリア内にあるときは,ペナルティエリア外に出す
Expand Down

0 comments on commit 918a86e

Please sign in to comment.