LIBRCSC Docs
Documentation for HELIOS's BASE LIBRCSC library for RoboCup 2D Simulation League.
All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros
player_predicate.h
Go to the documentation of this file.
1// -*-c++-*-
2
8/*
9 *Copyright:
10
11 Copyright (C) Hiroki SHIMORA, Hidehisa AKIYAMA
12
13 This code is free software; you can redistribute it and/or
14 modify it under the terms of the GNU Lesser General Public
15 License as published by the Free Software Foundation; either
16 version 3 of the License, or (at your option) any later version.
17
18 This library is distributed in the hope that it will be useful,
19 but WITHOUT ANY WARRANTY; without even the implied warranty of
20 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21 Lesser General Public License for more details.
22
23 You should have received a copy of the GNU Lesser General Public
24 License along with this library; if not, write to the Free Software
25 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
26
27 *EndCopyright:
28 */
29
31
32
33#ifndef RCSC_PLAYER_PLAYER_PREDICATE_H
34#define RCSC_PLAYER_PLAYER_PREDICATE_H
35
38#include <rcsc/math_util.h>
39
40#include <memory>
41#include <vector>
42#include <algorithm>
43#include <cmath>
44
45namespace rcsc {
46
52public:
53 typedef std::shared_ptr< PlayerPredicate > Ptr;
54 typedef std::shared_ptr< const PlayerPredicate > ConstPtr;
55
56protected:
61 { }
62
63public:
67 virtual
69 { }
70
76 virtual
77 bool operator()( const AbstractPlayerObject & p ) const = 0;
78
83 virtual
84 Ptr clone() const = 0;
85};
86
92 : public PlayerPredicate {
93private:
95 std::vector< PlayerPredicate::ConstPtr > M_predicates;
96
97 // not used
98 AndPlayerPredicate() = delete;
99public:
100 // XXX: implicit_shared_ptr
101
108 const PlayerPredicate * p2 )
109 : M_predicates()
110 {
111 M_predicates.reserve( 2 );
112 M_predicates.push_back( ConstPtr( p1 ) );
113 M_predicates.push_back( ConstPtr( p2 ) );
114 }
115
123 const PlayerPredicate * p2 ,
124 const PlayerPredicate * p3 )
125 : M_predicates()
126 {
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 ) );
131 }
132
141 const PlayerPredicate * p2 ,
142 const PlayerPredicate * p3 ,
143 const PlayerPredicate * p4 )
144 : M_predicates()
145 {
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 ) );
151 }
152
162 const PlayerPredicate * p2 ,
163 const PlayerPredicate * p3 ,
164 const PlayerPredicate * p4 ,
165 const PlayerPredicate * p5 )
166 : M_predicates()
167 {
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 ) );
174 }
175
186 const PlayerPredicate * p2 ,
187 const PlayerPredicate * p3 ,
188 const PlayerPredicate * p4 ,
189 const PlayerPredicate * p5 ,
190 const PlayerPredicate * p6 )
191 : M_predicates()
192 {
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 ) );
200 }
201
213 const PlayerPredicate * p2 ,
214 const PlayerPredicate * p3 ,
215 const PlayerPredicate * p4 ,
216 const PlayerPredicate * p5 ,
217 const PlayerPredicate * p6 ,
218 const PlayerPredicate * p7 )
219 : M_predicates()
220 {
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 ) );
229 }
230
243 const PlayerPredicate * p2 ,
244 const PlayerPredicate * p3 ,
245 const PlayerPredicate * p4 ,
246 const PlayerPredicate * p5 ,
247 const PlayerPredicate * p6 ,
248 const PlayerPredicate * p7 ,
249 const PlayerPredicate * p8 )
250 : M_predicates()
251 {
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 ) );
261 }
262
263private:
268 AndPlayerPredicate( const std::vector< ConstPtr > & predicates )
269 : M_predicates( predicates )
270 { }
271
272public:
273
279 bool operator()( const AbstractPlayerObject & p ) const
280 {
281 for ( const ConstPtr & pred : M_predicates )
282 {
283 if ( ! (*pred)( p ) )
284 {
285 return false;
286 }
287 }
288
289 return true;
290 }
291
296 Ptr clone() const
297 {
298 return Ptr( new AndPlayerPredicate( M_predicates ) );
299 }
300};
301
307 : public PlayerPredicate {
308private:
310 std::vector< ConstPtr > M_predicates;
311
312 // not used
313 OrPlayerPredicate() = delete;
314public:
315 // XXX: implicit_shared_ptr
316
323 const PlayerPredicate * p2 )
324 : M_predicates()
325 {
326 M_predicates.push_back( ConstPtr( p1 ) );
327 M_predicates.push_back( ConstPtr( p2 ) );
328 }
329
337 const PlayerPredicate * p2 ,
338 const PlayerPredicate * p3 )
339 : M_predicates()
340 {
341 M_predicates.push_back( ConstPtr( p1 ) );
342 M_predicates.push_back( ConstPtr( p2 ) );
343 M_predicates.push_back( ConstPtr( p3 ) );
344 }
345
354 const PlayerPredicate * p2 ,
355 const PlayerPredicate * p3 ,
356 const PlayerPredicate * p4 )
357 : M_predicates()
358 {
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 ) );
363 }
364
374 const PlayerPredicate * p2 ,
375 const PlayerPredicate * p3 ,
376 const PlayerPredicate * p4 ,
377 const PlayerPredicate * p5 )
378 : M_predicates()
379 {
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 ) );
385 }
386
397 const PlayerPredicate * p2 ,
398 const PlayerPredicate * p3 ,
399 const PlayerPredicate * p4 ,
400 const PlayerPredicate * p5 ,
401 const PlayerPredicate * p6 )
402 : M_predicates()
403 {
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 ) );
410 }
411
423 const PlayerPredicate * p2 ,
424 const PlayerPredicate * p3 ,
425 const PlayerPredicate * p4 ,
426 const PlayerPredicate * p5 ,
427 const PlayerPredicate * p6 ,
428 const PlayerPredicate * p7 )
429 : M_predicates()
430 {
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 ) );
438 }
439
452 const PlayerPredicate * p2 ,
453 const PlayerPredicate * p3 ,
454 const PlayerPredicate * p4 ,
455 const PlayerPredicate * p5 ,
456 const PlayerPredicate * p6 ,
457 const PlayerPredicate * p7 ,
458 const PlayerPredicate * p8 )
459 : M_predicates()
460 {
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 ) );
469 }
470
471private:
476 OrPlayerPredicate( const std::vector< ConstPtr > & predicates )
477 : M_predicates( predicates )
478 { }
479
480public:
481
487 bool operator()( const AbstractPlayerObject & p ) const
488 {
489 for ( const ConstPtr & pred : M_predicates )
490 {
491 if ( (*pred)( p ) )
492 {
493 return true;
494 }
495 }
496
497 return false;
498 }
499
504 Ptr clone() const
505 {
506 return Ptr( new OrPlayerPredicate( M_predicates ) );
507 }
508};
509
515 : public PlayerPredicate {
516private:
518 ConstPtr M_predicate;
519
520 // not used
521 NotPlayerPredicate() = delete;
522public:
523
528 explicit
530 : M_predicate( predicate )
531 { }
532
537 explicit
539 : M_predicate( predicate )
540 { }
541
547 bool operator()( const AbstractPlayerObject & p ) const
548 {
549 return ! (*M_predicate)( p );
550 }
551
556 Ptr clone() const
557 {
558 return Ptr( new NotPlayerPredicate( M_predicate ) );
559 }
560};
561
567 : public PlayerPredicate {
568private:
570 const SideID M_our_side;
572 const int M_self_unum;
573
574 // not used
575 SelfPlayerPredicate() = delete;
576public:
581 explicit
583 : M_our_side( wm.ourSide() ),
584 M_self_unum( wm.self().unum() )
585 { }
586
592 explicit
594 const int self_unum )
595 : M_our_side( our_side ),
596 M_self_unum( self_unum )
597 { }
598
604 bool operator()( const AbstractPlayerObject & p ) const
605 {
606 return p.side() == M_our_side
607 && p.unum() == M_self_unum;
608 }
609
614 Ptr clone() const
615 {
616 return Ptr( new SelfPlayerPredicate( M_our_side, M_self_unum ) );
617 }
618};
619
625 : public PlayerPredicate {
626private:
628 const SideID M_our_side;
629
630 // not used
632public:
637 explicit
639 : M_our_side( wm.ourSide() )
640 { }
641
642 explicit
643 TeammateOrSelfPlayerPredicate( const SideID our_side )
644 : M_our_side( our_side )
645 { }
646
652 bool operator()( const AbstractPlayerObject & p ) const
653 {
654 return p.side() == M_our_side;
655 }
656
657
662 Ptr clone() const
663 {
664 return Ptr( new TeammateOrSelfPlayerPredicate( M_our_side ) );
665 }
666};
667
673 : public PlayerPredicate {
674private:
676 const SideID M_our_side;
678 const int M_self_unum;
679
680 // not used
681 TeammatePlayerPredicate() = delete;
682public:
687 explicit
689 : M_our_side( wm.ourSide() )
690 , M_self_unum( wm.self().unum() )
691 { }
692
698 explicit
700 const int self_unum )
701 : M_our_side( our_side )
702 , M_self_unum( self_unum )
703 { }
704
710 bool operator()( const AbstractPlayerObject & p ) const
711 {
712 return p.side() == M_our_side
713 && p.unum() != M_self_unum;
714 }
715
720 Ptr clone() const
721 {
722 return Ptr( new TeammatePlayerPredicate( M_our_side, M_self_unum ) );
723 }
724};
725
731 : public PlayerPredicate {
732private:
734 const SideID M_our_side;
735
736 // not used
737 OpponentPlayerPredicate() = delete;
738public:
743 explicit
745 : M_our_side( wm.ourSide() )
746 { }
747
752 explicit
754 : M_our_side( our_side )
755 { }
756
762 bool operator()( const AbstractPlayerObject & p ) const
763 {
764 return p.side() != M_our_side
765 && p.side() != NEUTRAL;
766 }
767
772 Ptr clone() const
773 {
774 return Ptr( new OpponentPlayerPredicate( M_our_side ) );
775 }
776};
777
783 : public PlayerPredicate {
784private:
786 const SideID M_our_side;
787
788 // not used
790public:
795 explicit
797 : M_our_side( wm.ourSide() )
798 { }
799
804 explicit
806 : M_our_side( our_side )
807 { }
808
814 bool operator()( const AbstractPlayerObject & p ) const
815 {
816 return p.side() != M_our_side;
817 }
818
823 Ptr clone() const
824 {
825 return Ptr( new OpponentOrUnknownPlayerPredicate( M_our_side ) );
826 }
827};
828
834 : public PlayerPredicate {
835public:
836
842 bool operator()( const AbstractPlayerObject & p ) const
843 {
844 return p.goalie();
845 }
846
851 Ptr clone() const
852 {
853 return Ptr( new GoaliePlayerPredicate() );
854 }
855};
856
862 : public PlayerPredicate {
863public:
864
870 bool operator()( const AbstractPlayerObject & p ) const
871 {
872 return ! p.goalie();
873 }
874
879 Ptr clone() const
880 {
881 return Ptr( new FieldPlayerPredicate() );
882 }
883};
884
890 : public PlayerPredicate {
891private:
893 const int M_threshold;
894
895 // not used
897public:
902 explicit
904 : M_threshold( threshold )
905 { }
906
912 bool operator()( const AbstractPlayerObject & p ) const
913 {
914 return p.posCount() <= M_threshold;
915 }
916
921 Ptr clone() const
922 {
923 return Ptr( new CoordinateAccuratePlayerPredicate( M_threshold ) );
924 }
925};
926
932 : public PlayerPredicate {
933private:
934
935public:
936
942 bool operator()( const AbstractPlayerObject & p ) const
943 {
944 return p.isGhost();
945 }
946
951 Ptr clone() const
952 {
953 return Ptr( new GhostPlayerPredicate() );
954 }
955};
956
962 : public PlayerPredicate {
963private:
965 const int M_threshold;
966
967 // not used
968 NoGhostPlayerPredicate() = delete;
969public:
974 explicit
975 NoGhostPlayerPredicate( const int threshold )
976 : M_threshold( threshold )
977 { }
978
984 bool operator()( const AbstractPlayerObject & p ) const
985 {
986 return ! p.isGhost()
987 && p.posCount() <= M_threshold;
988 }
989
994 Ptr clone() const
995 {
996 return Ptr( new NoGhostPlayerPredicate( M_threshold ) );
997 }
998};
999
1005 : public PlayerPredicate {
1006private:
1008 const double M_threshold;
1009
1010 // not used
1012public:
1017 explicit
1018 XCoordinateForwardPlayerPredicate( const double & threshold )
1019 : M_threshold( threshold )
1020 { }
1021
1027 bool operator()( const AbstractPlayerObject & p ) const
1028 {
1029 return p.pos().x >= M_threshold;
1030 }
1031
1036 Ptr clone() const
1037 {
1038 return Ptr( new XCoordinateForwardPlayerPredicate( M_threshold ) );
1039 }
1040};
1041
1047 : public PlayerPredicate {
1048private:
1050 const double M_threshold;
1051
1052 // not used
1054public:
1059 explicit
1060 XCoordinateBackwardPlayerPredicate( const double & threshold )
1061 : M_threshold( threshold )
1062 { }
1063
1069 bool operator()( const AbstractPlayerObject & p ) const
1070 {
1071 return p.pos().x <= M_threshold;
1072 }
1073
1078 Ptr clone() const
1079 {
1080 return Ptr( new XCoordinateBackwardPlayerPredicate( M_threshold ) );
1081 }
1082};
1083
1089 : public PlayerPredicate {
1090private:
1092 const double M_threshold;
1093
1094 // not used
1096public:
1101 explicit
1102 YCoordinatePlusPlayerPredicate( const double & threshold )
1103 : M_threshold( threshold )
1104 { }
1105
1111 bool operator()( const AbstractPlayerObject & p ) const
1112 {
1113 return p.pos().y >= M_threshold;
1114 }
1115
1120 Ptr clone() const
1121 {
1122 return Ptr( new YCoordinatePlusPlayerPredicate( M_threshold ) );
1123 }
1124};
1125
1131 : public PlayerPredicate {
1132private:
1134 const double M_threshold;
1135
1136 // not used
1138public:
1143 explicit
1144 YCoordinateMinusPlayerPredicate( const double & threshold )
1145 : M_threshold( threshold )
1146 { }
1147
1153 bool operator()( const AbstractPlayerObject & p ) const
1154 {
1155 return p.pos().y <= M_threshold;
1156 }
1157
1162 Ptr clone() const
1163 {
1164 return Ptr( new YCoordinateMinusPlayerPredicate( M_threshold ) );
1165 }
1166};
1167
1173 : public PlayerPredicate {
1174private:
1176 const Vector2D M_base_point;
1178 const double M_threshold2;
1179
1180 // not used
1181 PointFarPlayerPredicate() = delete;
1182public:
1189 const double & threshold )
1190 : M_base_point( base_point )
1191 , M_threshold2( threshold * threshold )
1192 { }
1193
1199 bool operator()( const AbstractPlayerObject & p ) const
1200 {
1201 return ( p.pos() - M_base_point ).r2() >= M_threshold2;
1202 }
1203
1208 Ptr clone() const
1209 {
1210 return Ptr( new PointFarPlayerPredicate( M_base_point, M_threshold2 ) );
1211 }
1212};
1213
1219 : public PlayerPredicate {
1220private:
1222 const Vector2D M_base_point;
1224 const double M_threshold2;
1225
1226 // not used
1227 PointNearPlayerPredicate() = delete;
1228public:
1235 const double & threshold )
1236 : M_base_point( base_point ),
1237 M_threshold2( threshold * threshold )
1238 { }
1239
1245 bool operator()( const AbstractPlayerObject & p ) const
1246 {
1247 return ( p.pos() - M_base_point ).r2() <= M_threshold2;
1248 }
1249
1254 Ptr clone() const
1255 {
1256 return Ptr( new PointNearPlayerPredicate( M_base_point, M_threshold2 ) );
1257 }
1258};
1259
1265 : public PlayerPredicate {
1266private:
1268 const Vector2D M_base_point;
1270 const AngleDeg M_base_angle;
1272 const double M_threshold;
1273
1274 // not used
1276public:
1284 const AngleDeg & base_angle,
1285 const double & degree_threshold )
1286 : M_base_point( base_point ),
1287 M_base_angle( base_angle ),
1288 M_threshold( std::fabs( degree_threshold ) )
1289 { }
1290
1296 bool operator()( const AbstractPlayerObject & p ) const
1297 {
1298 return ( ( p.pos() - M_base_point ).th() - M_base_angle ).abs() <= M_threshold;
1299 }
1300
1305 Ptr clone() const
1306 {
1307 return Ptr( new AbsAngleDiffLessPlayerPredicate( M_base_point, M_base_angle, M_threshold ) );
1308 }
1309};
1310
1316 : public PlayerPredicate {
1317private:
1319 const Vector2D M_base_point;
1321 const AngleDeg M_base_angle;
1323 const double M_threshold;
1324
1325 // not used
1327public:
1335 const AngleDeg & base_angle,
1336 const double & threshold )
1337 : M_base_point( base_point ),
1338 M_base_angle( base_angle ),
1339 M_threshold( std::fabs( threshold ) )
1340 { }
1341
1347 bool operator()( const AbstractPlayerObject & p ) const
1348 {
1349 return ( ( p.pos() - M_base_point ).th() - M_base_angle ).abs() >= M_threshold;
1350 }
1351
1356 Ptr clone() const
1357 {
1358 return Ptr( new AbsAngleDiffGreaterPlayerPredicate( M_base_point, M_base_angle, M_threshold ) );
1359 }
1360};
1361
1367 : public PlayerPredicate {
1368private:
1370 const WorldModel & M_world;
1371
1372 // not used
1374public:
1380 : M_world( wm )
1381 { }
1382
1388 bool operator()( const AbstractPlayerObject & p ) const
1389 {
1390 if ( p.side() == M_world.self().side() )
1391 {
1392 return p.pos().x > M_world.offsideLineX();
1393 }
1394 else if ( p.side() == NEUTRAL )
1395 {
1396 return false;
1397 }
1398 else
1399 {
1400 return p.pos().x < bound( M_world.ball().pos().x, M_world.ourDefenseLineX(), 0.0 );
1401 }
1402 }
1403
1408 Ptr clone() const
1409 {
1410 return Ptr( new OffsidePositionPlayerPredicate( M_world ) );
1411 }
1412};
1413
1419 : public PlayerPredicate {
1420
1421private:
1423 const rcsc::WorldModel & M_world;
1424
1426 ConstPtr M_predicate;
1427
1429 double M_threshold2;
1430
1431public:
1439 ConstPtr predicate,
1440 const double & threshold )
1441 : M_world( wm ),
1442 M_predicate( predicate ),
1443 M_threshold2( threshold * threshold )
1444 { }
1445
1451 bool operator() ( const AbstractPlayerObject & p ) const
1452 {
1453 for ( const AbstractPlayerObject * target : M_world.allPlayers() )
1454 {
1455 if ( ( target->pos() - p.pos() ).r2() <= M_threshold2
1456 && (*M_predicate)( *target ) )
1457 {
1458 return true;
1459 }
1460 }
1461
1462 return false;
1463 }
1464
1469 Ptr clone() const
1470 {
1471 return Ptr( new ExistNearPlayerPlayerPredicate( M_world,
1472 M_predicate->clone(),
1473 std::sqrt( M_threshold2 ) ) );
1474 }
1475};
1476
1481template< typename T >
1483 : public PlayerPredicate {
1484private:
1486 T M_region;
1487
1488public:
1489
1494 ContainsPlayerPredicate( const T & region )
1495 : M_region( region )
1496 { }
1497
1503 bool operator()( const AbstractPlayerObject & p ) const
1504 {
1505 return M_region.contains( p.pos() );
1506 }
1507
1513 {
1514 return Ptr( new ContainsPlayerPredicate( M_region ) );
1515 }
1516};
1517
1518}
1519
1520#endif
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 &degree_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 &region)
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
world model Header File