Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Final_speed and Target_spins_per_s #3328

Merged
merged 6 commits into from
Oct 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions src/proto/tactic.proto
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,7 @@ message MoveTactic
required Point destination = 1;
// The orientation the robot should have when it arrives at its destination
required Angle final_orientation = 2;
// The speed the robot should have when it arrives at its destination
required double final_speed = 3;
zuperzane marked this conversation as resolved.
Show resolved Hide resolved
reserved 3, 8;
// How to run the dribbler
required DribblerMode dribbler_mode = 4;
// How to navigate around the ball
Expand All @@ -134,8 +133,6 @@ message MoveTactic
required AutoChipOrKick auto_chip_or_kick = 6;
// The maximum allowed speed mode
required MaxAllowedSpeedMode max_allowed_speed_mode = 7;
// The target spin while moving in revolutions per second
required double target_spin_rev_per_s = 8;
// The obstacle avoidance mode to use while moving
required ObstacleAvoidanceMode obstacle_avoidance_mode = 9;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,10 @@ void BallPlacementPlayFSM::alignPlacement(const Update &event)
2 * alignment_vector * ROBOT_MAX_RADIUS_METERS;

align_placement_tactic->updateControlParams(
setup_point, setup_angle, 0.0, TbotsProto::DribblerMode::OFF,
setup_point, setup_angle, TbotsProto::DribblerMode::OFF,
TbotsProto::BallCollisionType::AVOID, {AutoChipOrKickMode::OFF, 0},
TbotsProto::MaxAllowedSpeedMode::PHYSICAL_LIMIT,
TbotsProto::ObstacleAvoidanceMode::SAFE, 0.0);
TbotsProto::ObstacleAvoidanceMode::SAFE);

tactics_to_run[0].emplace_back(align_placement_tactic);

Expand Down Expand Up @@ -143,10 +143,10 @@ void BallPlacementPlayFSM::retreat(const Update &event)

// setup ball placement tactic for ball placing robot
retreat_tactic->updateControlParams(
retreat_position, final_orientation, 0.0, TbotsProto::DribblerMode::OFF,
retreat_position, final_orientation, TbotsProto::DribblerMode::OFF,
TbotsProto::BallCollisionType::AVOID, {AutoChipOrKickMode::OFF, 0},
TbotsProto::MaxAllowedSpeedMode::PHYSICAL_LIMIT,
TbotsProto::ObstacleAvoidanceMode::SAFE, 0.0);
TbotsProto::ObstacleAvoidanceMode::SAFE);
tactics_to_run[0].emplace_back(retreat_tactic);

event.common.set_tactics(tactics_to_run);
Expand Down Expand Up @@ -303,7 +303,7 @@ void BallPlacementPlayFSM::setupMoveTactics(const Update &event)
waiting_line_vector.normalize(waiting_line_vector.length() * i /
static_cast<double>(move_tactics.size()));
move_tactics.at(i)->updateControlParams(
waiting_destination, Angle::zero(), 0.0,
waiting_destination, Angle::zero(),
TbotsProto::MaxAllowedSpeedMode::PHYSICAL_LIMIT,
TbotsProto::ObstacleAvoidanceMode::SAFE);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,13 +95,13 @@ void EnemyBallPlacementPlayFSM::avoid(const Update& event)
}
// Move to destination point while aligning to the ball
avoid_interference_tactics[idx]->updateControlParams(
destination, (ball_pos - robot.position()).orientation(), 0);
destination, (ball_pos - robot.position()).orientation());
}
else
{
// Stay in place while aligning to the ball
avoid_interference_tactics[idx]->updateControlParams(
robot.position(), (ball_pos - robot.position()).orientation(), 0);
robot.position(), (ball_pos - robot.position()).orientation());
}
tactics_to_run[0].emplace_back(avoid_interference_tactics[idx]);
idx++;
Expand Down Expand Up @@ -140,11 +140,10 @@ void EnemyBallPlacementPlayFSM::enterDefensiveFormation(const Update& event)
Point right = world_ptr->ball().position() + right_vector;

move_tactics[0]->updateControlParams(
center, positioning_vector.orientation() + Angle::half(), 0);
move_tactics[1]->updateControlParams(left, left_vector.orientation() + Angle::half(),
0);
center, positioning_vector.orientation() + Angle::half());
move_tactics[1]->updateControlParams(left, left_vector.orientation() + Angle::half());
move_tactics[2]->updateControlParams(right,
right_vector.orientation() + Angle::half(), 0);
right_vector.orientation() + Angle::half());
tactics_to_run[0].emplace_back(move_tactics[0]);
tactics_to_run[0].emplace_back(move_tactics[1]);
tactics_to_run[0].emplace_back(move_tactics[2]);
Expand Down
2 changes: 1 addition & 1 deletion src/software/ai/hl/stp/play/example_play.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ void ExamplePlay::getNextTactics(TacticCoroutine::push_type &yield,
world_ptr->ball().position() +
Vector::createFromAngle(angle_between_robots *
static_cast<double>(k + 1)),
(angle_between_robots * static_cast<double>(k + 1)) + Angle::half(), 0);
(angle_between_robots * static_cast<double>(k + 1)) + Angle::half());
}

// yield the Tactics this Play wants to run, in order of priority
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ void FreeKickPlayFSM::updateReceiverPositioningTactics(
Angle receiver_orientation =
(world->ball().position() - best_receiving_positions[i]).orientation();
receiver_positioning_tactics[i]->updateControlParams(
best_receiving_positions[i], receiver_orientation, 0.0,
best_receiving_positions[i], receiver_orientation,
TbotsProto::MaxAllowedSpeedMode::PHYSICAL_LIMIT,
TbotsProto::ObstacleAvoidanceMode::AGGRESSIVE);
}
Expand Down Expand Up @@ -125,7 +125,7 @@ void FreeKickPlayFSM::updateAlignToBallTactic(const WorldPtr &world_ptr)

align_to_ball_tactic->updateControlParams(
ball_pos - direction_to_face.normalize(ROBOT_MAX_RADIUS_METERS * 2),
direction_to_face.orientation(), 0);
direction_to_face.orientation());
}

bool FreeKickPlayFSM::shotFound(const Update &event)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ void DribblingParcourPlay::getNextTactics(TacticCoroutine::push_type &yield,
}
else
{
move_tactic->updateControlParams(Point(0, 0), Angle::zero(), 0.0);
move_tactic->updateControlParams(Point(0, 0), Angle::zero());
result.emplace_back(move_tactic);
}
yield({result});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@ void PassEndurancePlay::getNextTactics(TacticCoroutine::push_type &yield,
world_ptr->ball().position() +
Vector::createFromAngle(angle_between_robots *
static_cast<double>(k + 1)),
(angle_between_robots * static_cast<double>(k + 1)) + Angle::half(),
0);
(angle_between_robots * static_cast<double>(k + 1)) + Angle::half());
}
}
else
Expand All @@ -44,7 +43,7 @@ void PassEndurancePlay::getNextTactics(TacticCoroutine::push_type &yield,
auto next_position = Point(
world_ptr->field().centerPoint().x(),
(initial_offset + static_cast<int>(k)) * 4 * ROBOT_MAX_RADIUS_METERS);
move_tactics[k]->updateControlParams(next_position, Angle::zero(), 0);
move_tactics[k]->updateControlParams(next_position, Angle::zero());
}
}
result.insert(result.end(), move_tactics.begin(), move_tactics.end());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ void ScoringFromContestedPossessionPlay::getNextTactics(TacticCoroutine::push_ty
else
{
// TODO (#2107): implement face ball opposite attacker 0.3m away
move_tactic->updateControlParams(Point(0, 0), Angle::zero(), 0.0);
move_tactic->updateControlParams(Point(0, 0), Angle::zero());
result.emplace_back(move_tactic);
}
yield({result});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ void ScoringWithStaticDefendersPlay::getNextTactics(TacticCoroutine::push_type &
auto next_position = Point(
world_ptr->field().centerPoint().x(),
(initial_offset + static_cast<int>(k)) * 4 * ROBOT_MAX_RADIUS_METERS);
move_tactics[k]->updateControlParams(next_position, Angle::zero(), 0);
move_tactics[k]->updateControlParams(next_position, Angle::zero());
}
}
else if (world_ptr->gameState().isOurFreeKick())
Expand All @@ -46,8 +46,7 @@ void ScoringWithStaticDefendersPlay::getNextTactics(TacticCoroutine::push_type &
world_ptr->ball().position() +
Vector::createFromAngle(angle_between_robots *
static_cast<double>(k + 1)),
(angle_between_robots * static_cast<double>(k + 1)) + Angle::half(),
0);
(angle_between_robots * static_cast<double>(k + 1)) + Angle::half());
}
}
result.insert(result.end(), move_tactics.begin(), move_tactics.end());
Expand Down
4 changes: 2 additions & 2 deletions src/software/ai/hl/stp/play/kickoff_enemy_play.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ void KickoffEnemyPlay::getNextTactics(TacticCoroutine::push_type &yield,
// listed above
move_tactics.at(defense_position_index)
->updateControlParams(defense_positions.at(defense_position_index),
Angle::zero(), 0);
Angle::zero());
result[0].emplace_back(move_tactics.at(defense_position_index));
defense_position_index++;
}
Expand All @@ -138,7 +138,7 @@ void KickoffEnemyPlay::getNextTactics(TacticCoroutine::push_type &yield,
world_ptr->field().friendlyGoalpostNeg(),
world_ptr->field().centerPoint(),
ROBOT_MAX_RADIUS_METERS),
Angle::zero(), 0, TbotsProto::MaxAllowedSpeedMode::PHYSICAL_LIMIT,
Angle::zero(), TbotsProto::MaxAllowedSpeedMode::PHYSICAL_LIMIT,
TbotsProto::ObstacleAvoidanceMode::AGGRESSIVE);
result[0].emplace_back(move_tactics.at(defense_position_index));

Expand Down
4 changes: 2 additions & 2 deletions src/software/ai/hl/stp/play/kickoff_friendly_play.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ void KickoffFriendlyPlay::getNextTactics(TacticCoroutine::push_type &yield,
for (unsigned i = 0; i < kickoff_setup_positions.size(); i++)
{
move_tactics.at(i)->updateControlParams(kickoff_setup_positions.at(i),
Angle::zero(), 0);
Angle::zero());
result[0].emplace_back(move_tactics.at(i));
}

Expand Down Expand Up @@ -123,7 +123,7 @@ void KickoffFriendlyPlay::getNextTactics(TacticCoroutine::push_type &yield,
for (unsigned i = 1; i < kickoff_setup_positions.size(); i++)
{
move_tactics.at(i)->updateControlParams(kickoff_setup_positions.at(i),
Angle::zero(), 0);
Angle::zero());
result[0].emplace_back(move_tactics.at(i));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,11 @@ void PenaltyKickPlayFSM::setupPosition(const Update &event)
ROBOT_MAX_RADIUS_METERS;
penalty_setup_tactics.at(i)->updateControlParams(
Point(ball_position_x - 1.25, y_offset),
event.common.world_ptr->field().enemyGoalCenter().toVector().orientation(),
0);
event.common.world_ptr->field().enemyGoalCenter().toVector().orientation());
}

// Move shooting robot behind the ball
penalty_setup_tactics.back()->updateControlParams(behind_ball, shoot_angle, 0.0);
penalty_setup_tactics.back()->updateControlParams(behind_ball, shoot_angle);

tactics_to_run[0].insert(tactics_to_run[0].end(), penalty_setup_tactics.begin(),
penalty_setup_tactics.end());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@ void PenaltyKickEnemyPlayFSM::setupPosition(const Update &event)
move_tactics.at(i)->updateControlParams(
Point(event.common.world_ptr->field().enemyPenaltyMark().x() + 1.75,
y_offset),
event.common.world_ptr->field().enemyGoalCenter().toVector().orientation(),
0);
event.common.world_ptr->field().enemyGoalCenter().toVector().orientation());
}

// Move goalie to the goal line
Expand Down
2 changes: 1 addition & 1 deletion src/software/ai/hl/stp/play/shoot_or_chip_play.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ void ShootOrChipPlay::getNextTactics(TacticCoroutine::push_type &yield,
chip_targets[i].origin() -
Vector::createFromAngle(orientation).normalize(ROBOT_MAX_RADIUS_METERS);
;
move_to_open_area_tactics[i]->updateControlParams(position, orientation, 0.0);
move_to_open_area_tactics[i]->updateControlParams(position, orientation);
result[0].emplace_back(move_to_open_area_tactics[i]);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ void ShootOrPassPlayFSM::updateOffensivePositioningTactics(
Angle receiver_orientation =
(world->ball().position() - best_receiving_positions[i]).orientation();
offensive_positioning_tactics[i]->updateControlParams(
best_receiving_positions[i], receiver_orientation, 0.0,
best_receiving_positions[i], receiver_orientation,
TbotsProto::MaxAllowedSpeedMode::PHYSICAL_LIMIT,
TbotsProto::ObstacleAvoidanceMode::AGGRESSIVE);
}
Expand Down
6 changes: 3 additions & 3 deletions src/software/ai/hl/stp/play/stop_play.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,15 +80,15 @@ void StopPlay::getNextTactics(TacticCoroutine::push_type &yield,

move_tactics.at(0)->updateControlParams(
ball_defense_point_center,
(world_ptr->ball().position() - ball_defense_point_center).orientation(), 0,
(world_ptr->ball().position() - ball_defense_point_center).orientation(),
stop_mode, TbotsProto::ObstacleAvoidanceMode::SAFE);
move_tactics.at(1)->updateControlParams(
ball_defense_point_left,
(world_ptr->ball().position() - ball_defense_point_left).orientation(), 0,
(world_ptr->ball().position() - ball_defense_point_left).orientation(),
stop_mode, TbotsProto::ObstacleAvoidanceMode::SAFE);
move_tactics.at(2)->updateControlParams(
ball_defense_point_right,
(world_ptr->ball().position() - ball_defense_point_right).orientation(), 0,
(world_ptr->ball().position() - ball_defense_point_right).orientation(),
stop_mode, TbotsProto::ObstacleAvoidanceMode::SAFE);

std::get<0>(crease_defender_tactics)
Expand Down
7 changes: 3 additions & 4 deletions src/software/ai/hl/stp/play/test_plays/move_test_play.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,15 @@ void MoveTestPlay::getNextTactics(TacticCoroutine::push_type &yield,
do
{
move_test_tactic_friendly_goal->updateControlParams(
world_ptr->field().friendlyGoalCenter(), Angle::zero(), 0,
world_ptr->field().friendlyGoalCenter(), Angle::zero(),
TbotsProto::MaxAllowedSpeedMode::PHYSICAL_LIMIT,
TbotsProto::ObstacleAvoidanceMode::SAFE);
move_test_tactic_enemy_goal->updateControlParams(
world_ptr->field().enemyGoalCenter(), Angle::zero(), 0,
world_ptr->field().enemyGoalCenter(), Angle::zero(),
TbotsProto::MaxAllowedSpeedMode::PHYSICAL_LIMIT,
TbotsProto::ObstacleAvoidanceMode::SAFE);
move_test_tactic_center_field->updateControlParams(
Point(0, 0), Angle::zero(), 0,
TbotsProto::MaxAllowedSpeedMode::PHYSICAL_LIMIT,
Point(0, 0), Angle::zero(), TbotsProto::MaxAllowedSpeedMode::PHYSICAL_LIMIT,
TbotsProto::ObstacleAvoidanceMode::SAFE);

yield({{move_test_tactic_center_field, move_test_tactic_friendly_goal,
Expand Down
Loading
Loading