Thunderbots Project
Loading...
Searching...
No Matches
defender_assignment.h
1#pragma once
2
3#include "proto/parameters.pb.h"
4#include "software/ai/evaluation/enemy_threat.h"
5#include "software/geom/point.h"
6#include "software/geom/segment.h"
7#include "software/world/field.h"
8
9// Indicates the type of defender for a DefenderAssignment
10enum DefenderAssignmentType
11{
12 CREASE_DEFENDER,
13 PASS_DEFENDER
14};
15
16// This struct stores the concept of a defender assignment, which describes
17// the location on the field that a defender could target to block a potential
18// enemy pass or shot on net
20{
21 // The type of defender for this assignment
22 DefenderAssignmentType type;
23
24 // The location on the field that the defender should target
25 Point target;
26
27 // The coverage rating of the assignment, which scores the defender's ability
28 // to block high-danger enemy scoring chances or passes
29 double coverage_rating;
30
31 // Equality operator for unit testing.
32 bool operator==(const DefenderAssignment &other) const
33 {
34 return this->type == other.type && this->target == other.target &&
35 this->coverage_rating == other.coverage_rating;
36 }
37};
38
39// This struct stores the concept of a shooting lane, which describes
40// a potential passing or shooting lane an enemy robot could shoot the
41// ball along
43{
44 // The segment representing the lane on the field, starting from
45 // the position of the enemy robot and ending at the intended point
46 // where the ball will be received or enter the net
47 Segment lane;
48
49 // The threat rating of the lane, which scores the dangerousness
50 // of the lane relative to other lanes (i.e. how likely a pass or shot
51 // along the lane will eventually result in the enemy team scoring)
52 double threat_rating;
53
54 // Equality operator for unit testing.
55 bool operator==(const ShootingLane &other) const
56 {
57 return this->lane == other.lane && this->threat_rating == other.threat_rating;
58 }
59};
60
61// A goal lane describes a shooting lane from an enemy robot to the goal
63{
64 // The angle in radians from the enemy robot to the goal that the goal lane describes
65 Angle angle_to_goal;
66
67 // Equality operator for unit testing.
68 bool operator==(const GoalLane &other) const
69 {
70 return this->lane == other.lane && this->threat_rating == other.threat_rating &&
71 this->angle_to_goal == other.angle_to_goal;
72 }
73};
74
88std::vector<DefenderAssignment> getAllDefenderAssignments(
89 const std::vector<EnemyThreat> &threats, const Field &field, const Ball &ball,
90 const TbotsProto::DefensePlayConfig::DefenderAssignmentConfig &config);
91
117std::vector<EnemyThreat> filterOutSimilarThreats(const std::vector<EnemyThreat> &threats,
118 double min_distance,
119 const Angle &min_angle);
120
131std::vector<std::vector<GoalLane>> groupGoalLanesByDensity(
132 std::vector<GoalLane> &goal_lanes, double density_threshold);
Definition angle.h:15
Definition ball.h:11
Definition field.h:36
Definition point.h:14
Definition segment.h:7
Definition defender_assignment.h:20
Definition defender_assignment.h:63
Definition defender_assignment.h:43