33#ifndef RCSC_PLAYER_PLAYER_PREDICATE_H
34#define RCSC_PLAYER_PLAYER_PREDICATE_H
53 typedef std::shared_ptr< PlayerPredicate >
Ptr;
54 typedef std::shared_ptr< const PlayerPredicate >
ConstPtr;
95 std::vector< PlayerPredicate::ConstPtr > M_predicates;
111 M_predicates.reserve( 2 );
112 M_predicates.push_back(
ConstPtr( p1 ) );
113 M_predicates.push_back(
ConstPtr( p2 ) );
127 M_predicates.reserve( 3 );
128 M_predicates.push_back(
ConstPtr( p1 ) );
129 M_predicates.push_back(
ConstPtr( p2 ) );
130 M_predicates.push_back(
ConstPtr( p3 ) );
146 M_predicates.reserve( 4 );
147 M_predicates.push_back(
ConstPtr( p1 ) );
148 M_predicates.push_back(
ConstPtr( p2 ) );
149 M_predicates.push_back(
ConstPtr( p3 ) );
150 M_predicates.push_back(
ConstPtr( p4 ) );
168 M_predicates.reserve( 5 );
169 M_predicates.push_back(
ConstPtr( p1 ) );
170 M_predicates.push_back(
ConstPtr( p2 ) );
171 M_predicates.push_back(
ConstPtr( p3 ) );
172 M_predicates.push_back(
ConstPtr( p4 ) );
173 M_predicates.push_back(
ConstPtr( p5 ) );
193 M_predicates.reserve( 6 );
194 M_predicates.push_back(
ConstPtr( p1 ) );
195 M_predicates.push_back(
ConstPtr( p2 ) );
196 M_predicates.push_back(
ConstPtr( p3 ) );
197 M_predicates.push_back(
ConstPtr( p4 ) );
198 M_predicates.push_back(
ConstPtr( p5 ) );
199 M_predicates.push_back(
ConstPtr( p6 ) );
221 M_predicates.reserve( 7 );
222 M_predicates.push_back(
ConstPtr( p1 ) );
223 M_predicates.push_back(
ConstPtr( p2 ) );
224 M_predicates.push_back(
ConstPtr( p3 ) );
225 M_predicates.push_back(
ConstPtr( p4 ) );
226 M_predicates.push_back(
ConstPtr( p5 ) );
227 M_predicates.push_back(
ConstPtr( p6 ) );
228 M_predicates.push_back(
ConstPtr( p7 ) );
252 M_predicates.reserve( 8 );
253 M_predicates.push_back(
ConstPtr( p1 ) );
254 M_predicates.push_back(
ConstPtr( p2 ) );
255 M_predicates.push_back(
ConstPtr( p3 ) );
256 M_predicates.push_back(
ConstPtr( p4 ) );
257 M_predicates.push_back(
ConstPtr( p5 ) );
258 M_predicates.push_back(
ConstPtr( p6 ) );
259 M_predicates.push_back(
ConstPtr( p7 ) );
260 M_predicates.push_back(
ConstPtr( p8 ) );
269 : M_predicates( predicates )
281 for (
const ConstPtr & pred : M_predicates )
283 if ( ! (*pred)( p ) )
310 std::vector< ConstPtr > M_predicates;
326 M_predicates.push_back(
ConstPtr( p1 ) );
327 M_predicates.push_back(
ConstPtr( p2 ) );
341 M_predicates.push_back(
ConstPtr( p1 ) );
342 M_predicates.push_back(
ConstPtr( p2 ) );
343 M_predicates.push_back(
ConstPtr( p3 ) );
359 M_predicates.push_back(
ConstPtr( p1 ) );
360 M_predicates.push_back(
ConstPtr( p2 ) );
361 M_predicates.push_back(
ConstPtr( p3 ) );
362 M_predicates.push_back(
ConstPtr( p4 ) );
380 M_predicates.push_back(
ConstPtr( p1 ) );
381 M_predicates.push_back(
ConstPtr( p2 ) );
382 M_predicates.push_back(
ConstPtr( p3 ) );
383 M_predicates.push_back(
ConstPtr( p4 ) );
384 M_predicates.push_back(
ConstPtr( p5 ) );
404 M_predicates.push_back(
ConstPtr( p1 ) );
405 M_predicates.push_back(
ConstPtr( p2 ) );
406 M_predicates.push_back(
ConstPtr( p3 ) );
407 M_predicates.push_back(
ConstPtr( p4 ) );
408 M_predicates.push_back(
ConstPtr( p5 ) );
409 M_predicates.push_back(
ConstPtr( p6 ) );
431 M_predicates.push_back(
ConstPtr( p1 ) );
432 M_predicates.push_back(
ConstPtr( p2 ) );
433 M_predicates.push_back(
ConstPtr( p3 ) );
434 M_predicates.push_back(
ConstPtr( p4 ) );
435 M_predicates.push_back(
ConstPtr( p5 ) );
436 M_predicates.push_back(
ConstPtr( p6 ) );
437 M_predicates.push_back(
ConstPtr( p7 ) );
461 M_predicates.push_back(
ConstPtr( p1 ) );
462 M_predicates.push_back(
ConstPtr( p2 ) );
463 M_predicates.push_back(
ConstPtr( p3 ) );
464 M_predicates.push_back(
ConstPtr( p4 ) );
465 M_predicates.push_back(
ConstPtr( p5 ) );
466 M_predicates.push_back(
ConstPtr( p6 ) );
467 M_predicates.push_back(
ConstPtr( p7 ) );
468 M_predicates.push_back(
ConstPtr( p8 ) );
477 : M_predicates( predicates )
489 for (
const ConstPtr & pred : M_predicates )
530 : M_predicate( predicate )
539 : M_predicate( predicate )
549 return ! (*M_predicate)( p );
572 const int M_self_unum;
583 : M_our_side( wm.ourSide() ),
584 M_self_unum( wm.self().unum() )
594 const int self_unum )
595 : M_our_side( our_side ),
596 M_self_unum( self_unum )
606 return p.
side() == M_our_side
607 && p.
unum() == M_self_unum;
639 : M_our_side( wm.ourSide() )
644 : M_our_side( our_side )
654 return p.
side() == M_our_side;
678 const int M_self_unum;
689 : M_our_side( wm.ourSide() )
690 , M_self_unum( wm.self().unum() )
700 const int self_unum )
701 : M_our_side( our_side )
702 , M_self_unum( self_unum )
712 return p.
side() == M_our_side
713 && p.
unum() != M_self_unum;
745 : M_our_side( wm.ourSide() )
754 : M_our_side( our_side )
764 return p.
side() != M_our_side
765 && p.
side() != NEUTRAL;
797 : M_our_side( wm.ourSide() )
806 : M_our_side( our_side )
816 return p.
side() != M_our_side;
893 const int M_threshold;
904 : M_threshold( threshold )
965 const int M_threshold;
976 : M_threshold( threshold )
1008 const double M_threshold;
1019 : M_threshold( threshold )
1029 return p.
pos().
x >= M_threshold;
1050 const double M_threshold;
1061 : M_threshold( threshold )
1071 return p.
pos().
x <= M_threshold;
1092 const double M_threshold;
1103 : M_threshold( threshold )
1113 return p.
pos().
y >= M_threshold;
1134 const double M_threshold;
1145 : M_threshold( threshold )
1155 return p.
pos().
y <= M_threshold;
1178 const double M_threshold2;
1189 const double & threshold )
1190 : M_base_point( base_point )
1191 , M_threshold2( threshold * threshold )
1201 return ( p.
pos() - M_base_point ).r2() >= M_threshold2;
1224 const double M_threshold2;
1235 const double & threshold )
1236 : M_base_point( base_point ),
1237 M_threshold2( threshold * threshold )
1247 return ( p.
pos() - M_base_point ).r2() <= M_threshold2;
1272 const double M_threshold;
1285 const double & degree_threshold )
1286 : M_base_point( base_point ),
1287 M_base_angle( base_angle ),
1288 M_threshold( std::fabs( degree_threshold ) )
1298 return ( ( p.
pos() - M_base_point ).th() - M_base_angle ).abs() <= M_threshold;
1323 const double M_threshold;
1336 const double & threshold )
1337 : M_base_point( base_point ),
1338 M_base_angle( base_angle ),
1339 M_threshold( std::fabs( threshold ) )
1349 return ( ( p.
pos() - M_base_point ).th() - M_base_angle ).abs() >= M_threshold;
1394 else if ( p.
side() == NEUTRAL )
1429 double M_threshold2;
1440 const double & threshold )
1442 M_predicate( predicate ),
1443 M_threshold2( threshold * threshold )
1455 if ( ( target->pos() - p.
pos() ).r2() <= M_threshold2
1456 && (*M_predicate)( *target ) )
1472 M_predicate->clone(),
1473 std::sqrt( M_threshold2 ) ) );
1481template<
typename T >
1495 : M_region( region )
1505 return M_region.contains( p.
pos() );
abstract player object class Header File
check if target player's absolute angle difference from base angle is greater than threshold angle
Definition: player_predicate.h:1316
bool operator()(const AbstractPlayerObject &p) const
predicate function
Definition: player_predicate.h:1347
Ptr clone() const
create clone object.
Definition: player_predicate.h:1356
AbsAngleDiffGreaterPlayerPredicate(const Vector2D &base_point, const AngleDeg &base_angle, const double &threshold)
construct with base point and threshold distance
Definition: player_predicate.h:1334
check if target player's absolute angle difference from base angle is less than threshold angle
Definition: player_predicate.h:1265
bool operator()(const AbstractPlayerObject &p) const
predicate function
Definition: player_predicate.h:1296
AbsAngleDiffLessPlayerPredicate(const Vector2D &base_point, const AngleDeg &base_angle, const double °ree_threshold)
construct with base point and threshold distance
Definition: player_predicate.h:1283
Ptr clone() const
create clone object.
Definition: player_predicate.h:1305
abstact player object class
Definition: abstract_player_object.h:52
const Vector2D & pos() const
get global position
Definition: abstract_player_object.h:265
bool goalie() const
get goalie flag
Definition: abstract_player_object.h:238
virtual bool isGhost() const
check if this player is ghost object or not
Definition: abstract_player_object.h:146
int posCount() const
get global position accuracy
Definition: abstract_player_object.h:274
int unum() const
get player's uniform number
Definition: abstract_player_object.h:220
SideID side() const
get team side id
Definition: abstract_player_object.h:211
composite logical "and" predicate
Definition: player_predicate.h:92
AndPlayerPredicate(const PlayerPredicate *p1, const PlayerPredicate *p2, const PlayerPredicate *p3, const PlayerPredicate *p4, const PlayerPredicate *p5)
construct with 5 predicates. all arguments must be a dynamically allocated object.
Definition: player_predicate.h:161
AndPlayerPredicate(const PlayerPredicate *p1, const PlayerPredicate *p2, const PlayerPredicate *p3, const PlayerPredicate *p4, const PlayerPredicate *p5, const PlayerPredicate *p6, const PlayerPredicate *p7)
construct with 7 predicates. all arguments must be a dynamically allocated object.
Definition: player_predicate.h:212
AndPlayerPredicate(const PlayerPredicate *p1, const PlayerPredicate *p2, const PlayerPredicate *p3, const PlayerPredicate *p4)
construct with 4 predicates. all arguments must be a dynamically allocated object.
Definition: player_predicate.h:140
AndPlayerPredicate(const PlayerPredicate *p1, const PlayerPredicate *p2)
construct with 2 predicates. all arguments must be a dynamically allocated object.
Definition: player_predicate.h:107
AndPlayerPredicate(const PlayerPredicate *p1, const PlayerPredicate *p2, const PlayerPredicate *p3, const PlayerPredicate *p4, const PlayerPredicate *p5, const PlayerPredicate *p6)
construct with 6 predicates. all arguments must be a dynamically allocated object.
Definition: player_predicate.h:185
Ptr clone() const
create clone object.
Definition: player_predicate.h:296
bool operator()(const AbstractPlayerObject &p) const
predicate function
Definition: player_predicate.h:279
AndPlayerPredicate(const PlayerPredicate *p1, const PlayerPredicate *p2, const PlayerPredicate *p3, const PlayerPredicate *p4, const PlayerPredicate *p5, const PlayerPredicate *p6, const PlayerPredicate *p7, const PlayerPredicate *p8)
construct with 8 predicates. all arguments must be a dynamically allocated object.
Definition: player_predicate.h:242
AndPlayerPredicate(const PlayerPredicate *p1, const PlayerPredicate *p2, const PlayerPredicate *p3)
construct with 3 predicates. all arguments must be a dynamically allocated object.
Definition: player_predicate.h:122
degree wrapper class
Definition: angle_deg.h:45
const Vector2D & pos() const
get estimated global coordinate
Definition: ball_object.h:134
check if target player is in region
Definition: player_predicate.h:1483
bool operator()(const AbstractPlayerObject &p) const
predicate function
Definition: player_predicate.h:1503
ContainsPlayerPredicate(const T ®ion)
construct with the geometry object
Definition: player_predicate.h:1494
PlayerPredicate::Ptr clone() const
create clone object.
Definition: player_predicate.h:1512
check if target player's positional information has enough accuracy.
Definition: player_predicate.h:890
CoordinateAccuratePlayerPredicate(const int threshold)
construct with threshold value
Definition: player_predicate.h:903
Ptr clone() const
create clone object.
Definition: player_predicate.h:921
bool operator()(const AbstractPlayerObject &p) const
predicate function
Definition: player_predicate.h:912
check if a player exists within the specified distance from the filtered player.
Definition: player_predicate.h:1419
Ptr clone() const
create clone object.
Definition: player_predicate.h:1469
ExistNearPlayerPlayerPredicate(const WorldModel &wm, ConstPtr predicate, const double &threshold)
constructor
Definition: player_predicate.h:1438
bool operator()(const AbstractPlayerObject &p) const
predicate function
Definition: player_predicate.h:1451
check if target player is field player or not
Definition: player_predicate.h:862
bool operator()(const AbstractPlayerObject &p) const
predicate function
Definition: player_predicate.h:870
Ptr clone() const
create clone object.
Definition: player_predicate.h:879
check if target player is ghost object or not
Definition: player_predicate.h:932
Ptr clone() const
create clone object.
Definition: player_predicate.h:951
bool operator()(const AbstractPlayerObject &p) const
predicate function
Definition: player_predicate.h:942
check if target player is goalie or not
Definition: player_predicate.h:834
bool operator()(const AbstractPlayerObject &p) const
predicate function
Definition: player_predicate.h:842
Ptr clone() const
create clone object.
Definition: player_predicate.h:851
check if target player is not ghost and has enough accuracy.
Definition: player_predicate.h:962
Ptr clone() const
create clone object.
Definition: player_predicate.h:994
NoGhostPlayerPredicate(const int threshold)
construct with threshold value
Definition: player_predicate.h:975
bool operator()(const AbstractPlayerObject &p) const
predicate function
Definition: player_predicate.h:984
logical "not" predicate
Definition: player_predicate.h:515
Ptr clone() const
create clone object.
Definition: player_predicate.h:556
NotPlayerPredicate(ConstPtr predicate)
construct with the predicate.
Definition: player_predicate.h:538
bool operator()(const AbstractPlayerObject &p) const
predicate function
Definition: player_predicate.h:547
NotPlayerPredicate(const PlayerPredicate *predicate)
construct with the predicate. argument must be a dynamically allocated object.
Definition: player_predicate.h:529
check if target player is in offside area
Definition: player_predicate.h:1367
OffsidePositionPlayerPredicate(const WorldModel &wm)
construct with the WorldModel instance
Definition: player_predicate.h:1379
Ptr clone() const
create clone object.
Definition: player_predicate.h:1408
bool operator()(const AbstractPlayerObject &p) const
predicate function
Definition: player_predicate.h:1388
check if target player is opponent (include unknown player) or not
Definition: player_predicate.h:783
OpponentOrUnknownPlayerPredicate(const SideID our_side)
construct with side and uniform number of self
Definition: player_predicate.h:805
OpponentOrUnknownPlayerPredicate(const WorldModel &wm)
construct with the WorldModel instance
Definition: player_predicate.h:796
Ptr clone() const
create clone object.
Definition: player_predicate.h:823
bool operator()(const AbstractPlayerObject &p) const
predicate function
Definition: player_predicate.h:814
check if target player is opponent (not include unknown player) or not
Definition: player_predicate.h:731
bool operator()(const AbstractPlayerObject &p) const
predicate function
Definition: player_predicate.h:762
OpponentPlayerPredicate(const WorldModel &wm)
construct with the WorldModel instance
Definition: player_predicate.h:744
OpponentPlayerPredicate(const SideID our_side)
construct with side and uniform number of self
Definition: player_predicate.h:753
Ptr clone() const
create clone object.
Definition: player_predicate.h:772
composite logical "or" predicate
Definition: player_predicate.h:307
OrPlayerPredicate(const PlayerPredicate *p1, const PlayerPredicate *p2, const PlayerPredicate *p3, const PlayerPredicate *p4, const PlayerPredicate *p5, const PlayerPredicate *p6)
construct with 6 predicates. all arguments must be a dynamically allocated object.
Definition: player_predicate.h:396
bool operator()(const AbstractPlayerObject &p) const
predicate function
Definition: player_predicate.h:487
OrPlayerPredicate(const PlayerPredicate *p1, const PlayerPredicate *p2, const PlayerPredicate *p3, const PlayerPredicate *p4, const PlayerPredicate *p5, const PlayerPredicate *p6, const PlayerPredicate *p7)
construct with 7 predicates. all arguments must be a dynamically allocated object.
Definition: player_predicate.h:422
OrPlayerPredicate(const PlayerPredicate *p1, const PlayerPredicate *p2)
construct with 2 predicates. all arguments must be a dynamically allocated object.
Definition: player_predicate.h:322
OrPlayerPredicate(const PlayerPredicate *p1, const PlayerPredicate *p2, const PlayerPredicate *p3, const PlayerPredicate *p4)
construct with 4 predicates. all arguments must be a dynamically allocated object.
Definition: player_predicate.h:353
OrPlayerPredicate(const PlayerPredicate *p1, const PlayerPredicate *p2, const PlayerPredicate *p3, const PlayerPredicate *p4, const PlayerPredicate *p5)
construct with 5 predicates. all arguments must be a dynamically allocated object.
Definition: player_predicate.h:373
Ptr clone() const
create clone object.
Definition: player_predicate.h:504
OrPlayerPredicate(const PlayerPredicate *p1, const PlayerPredicate *p2, const PlayerPredicate *p3)
construct with 3 predicates. all arguments must be a dynamically allocated object.
Definition: player_predicate.h:336
OrPlayerPredicate(const PlayerPredicate *p1, const PlayerPredicate *p2, const PlayerPredicate *p3, const PlayerPredicate *p4, const PlayerPredicate *p5, const PlayerPredicate *p6, const PlayerPredicate *p7, const PlayerPredicate *p8)
construct with 8 predicates. all arguments must be a dynamically allocated object.
Definition: player_predicate.h:451
abstract predicate class for player matching
Definition: player_predicate.h:51
virtual bool operator()(const AbstractPlayerObject &p) const =0
predicate function
std::shared_ptr< const PlayerPredicate > ConstPtr
const smart pointer type
Definition: player_predicate.h:54
std::shared_ptr< PlayerPredicate > Ptr
smart pointer type
Definition: player_predicate.h:53
PlayerPredicate()
protected constructor
Definition: player_predicate.h:60
virtual Ptr clone() const =0
create clone object.
virtual ~PlayerPredicate()
virtual destructor
Definition: player_predicate.h:68
check if target player's distance from tha base point is greater than threshold distance
Definition: player_predicate.h:1173
Ptr clone() const
create clone object.
Definition: player_predicate.h:1208
PointFarPlayerPredicate(const Vector2D &base_point, const double &threshold)
construct with base point and threshold distance
Definition: player_predicate.h:1188
bool operator()(const AbstractPlayerObject &p) const
predicate function
Definition: player_predicate.h:1199
check if target player's distance from tha base point is less than threshold distance
Definition: player_predicate.h:1219
bool operator()(const AbstractPlayerObject &p) const
predicate function
Definition: player_predicate.h:1245
PointNearPlayerPredicate(const Vector2D &base_point, const double &threshold)
construct with base point and threshold distance
Definition: player_predicate.h:1234
Ptr clone() const
create clone object.
Definition: player_predicate.h:1254
check if target player is self or not
Definition: player_predicate.h:567
Ptr clone() const
create clone object.
Definition: player_predicate.h:614
SelfPlayerPredicate(const SideID our_side, const int self_unum)
construct with side and uniform number of self
Definition: player_predicate.h:593
bool operator()(const AbstractPlayerObject &p) const
predicate function
Definition: player_predicate.h:604
SelfPlayerPredicate(const WorldModel &wm)
construct with the WorldModel instance
Definition: player_predicate.h:582
check if target player is teammate (include self) or not
Definition: player_predicate.h:625
Ptr clone() const
create clone object.
Definition: player_predicate.h:662
TeammateOrSelfPlayerPredicate(const WorldModel &wm)
construct with the WorldModel instance
Definition: player_predicate.h:638
bool operator()(const AbstractPlayerObject &p) const
predicate function
Definition: player_predicate.h:652
check if target player is teammate (not include self) or not
Definition: player_predicate.h:673
TeammatePlayerPredicate(const WorldModel &wm)
construct with the WorldModel instance
Definition: player_predicate.h:688
Ptr clone() const
create clone object.
Definition: player_predicate.h:720
TeammatePlayerPredicate(const SideID our_side, const int self_unum)
construct with side and uniform number of self
Definition: player_predicate.h:699
bool operator()(const AbstractPlayerObject &p) const
predicate function
Definition: player_predicate.h:710
2D point vector class
Definition: vector_2d.h:46
double y
Y coordinate.
Definition: vector_2d.h:64
double x
X coordinate.
Definition: vector_2d.h:63
player's internal field status
Definition: world_model.h:67
double ourDefenseLineX() const
get our defense line (consider ball pos)(offside line for opponent)
Definition: world_model.h:1052
const AbstractPlayerObject::Cont & allPlayers() const
get all players includes self.
Definition: world_model.h:824
double offsideLineX() const
get estimated offside line x coordinate
Definition: world_model.h:1028
const SelfObject & self() const
get self info
Definition: world_model.h:756
const BallObject & ball() const
get the current ball info
Definition: world_model.h:762
check if target player's x coordinate is less(backwarder) than threshold value
Definition: player_predicate.h:1047
Ptr clone() const
create clone object.
Definition: player_predicate.h:1078
XCoordinateBackwardPlayerPredicate(const double &threshold)
construct with threshold value
Definition: player_predicate.h:1060
bool operator()(const AbstractPlayerObject &p) const
predicate function
Definition: player_predicate.h:1069
check if target player's x coordinate is greater(forwarder) than threshold value
Definition: player_predicate.h:1005
bool operator()(const AbstractPlayerObject &p) const
predicate function
Definition: player_predicate.h:1027
XCoordinateForwardPlayerPredicate(const double &threshold)
construct with threshold value
Definition: player_predicate.h:1018
Ptr clone() const
create clone object.
Definition: player_predicate.h:1036
check if target player's y coordinate is more left than threshold value
Definition: player_predicate.h:1131
Ptr clone() const
create clone object.
Definition: player_predicate.h:1162
bool operator()(const AbstractPlayerObject &p) const
predicate function
Definition: player_predicate.h:1153
YCoordinateMinusPlayerPredicate(const double &threshold)
construct with threshold value
Definition: player_predicate.h:1144
check if target player's y coordinate is more right than threshold value
Definition: player_predicate.h:1089
Ptr clone() const
create clone object.
Definition: player_predicate.h:1120
bool operator()(const AbstractPlayerObject &p) const
predicate function
Definition: player_predicate.h:1111
YCoordinatePlusPlayerPredicate(const double &threshold)
construct with threshold value
Definition: player_predicate.h:1102
generic math utility Header File.
const T & bound(const T &low, const T &x, const T &high)
bound value within the range [low, high]
Definition: math_util.h:53
SideID
side type definition
Definition: types.h:47