00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013 #ifndef __GT2005SimpleBasicBehaviors_h_
00014 #define __GT2005SimpleBasicBehaviors_h_
00015
00016 #include "../../BehaviorControl.h"
00017 #include "Tools/Xabsl2/Xabsl2Engine/Xabsl2Engine.h"
00018 #include "Tools/Actorics/WalkAccelerationRestrictor.h"
00019 #include "Tools/Math/PIDsmoothedValue.h"
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029 class GT2005BasicBehaviorNewGoToBall : public Xabsl2BasicBehavior, public BehaviorControlInterfaces
00030 {
00031 public:
00032
00033
00034
00035
00036
00037 GT2005BasicBehaviorNewGoToBall(BehaviorControlInterfaces& interfaces,
00038 Xabsl2ErrorHandler& errorHandler)
00039 : Xabsl2BasicBehavior("new-go-to-ball", errorHandler),
00040 BehaviorControlInterfaces(interfaces),
00041 accelerationRestrictor(motionRequest)
00042 {
00043 registerParameter("new-go-to-ball.distance",distanceAtEnd);
00044 registerParameter("new-go-to-ball.max-speed", maxSpeed);
00045 registerParameter("new-go-to-ball.max-speed.y", maxSpeedY);
00046 registerParameter("new-go-to-ball.max-turn-speed", maxTurnSpeed);
00047 registerParameter("new-go-to-ball.angle-factor", angleFactor);
00048 registerParameter("new-go-to-ball.y-offset", yOffset);
00049 registerParameter("new-go-to-ball.walk-type", walkType);
00050 registerParameter("new-go-to-ball.slow-down-distance", slowDownDistance);
00051 }
00052
00053
00054 virtual void execute();
00055
00056 private:
00057
00058 double distanceAtEnd;
00059
00060
00061 double maxSpeed;
00062
00063
00064 double maxSpeedY;
00065
00066
00067 WalkAccelerationRestrictor accelerationRestrictor;
00068
00069
00070 double angleFactor;
00071
00072
00073 double slowDownDistance;
00074
00075
00076 double yOffset;
00077
00078
00079 double walkType;
00080
00081
00082 double maxTurnSpeed;
00083 };
00084
00085
00086
00087
00088
00089
00090
00091 class GT2005BasicBehaviorGoToBall : public Xabsl2BasicBehavior, public BehaviorControlInterfaces
00092 {
00093 public:
00094
00095
00096
00097
00098
00099 GT2005BasicBehaviorGoToBall(BehaviorControlInterfaces& interfaces,
00100 Xabsl2ErrorHandler& errorHandler)
00101 : Xabsl2BasicBehavior("go-to-ball", errorHandler),
00102 BehaviorControlInterfaces(interfaces),
00103 accelerationRestrictor(motionRequest)
00104 {
00105 registerParameter("go-to-ball.distance",distanceAtEnd);
00106 registerParameter("go-to-ball.max-speed", maxSpeed);
00107 registerParameter("go-to-ball.max-speed.y", maxSpeedY);
00108 registerParameter("go-to-ball.max-turn-speed", maxTurnSpeed);
00109 registerParameter("go-to-ball.target-angle-to-ball", targetAngleToBall);
00110 registerParameter("go-to-ball.walk-type", walkType);
00111 registerParameter("go-to-ball.y-offset", yOffset);
00112 registerParameter("go-to-ball.slow-down-distance", slowDownDistance);
00113 }
00114
00115
00116 virtual void execute();
00117
00118 private:
00119
00120 double distanceAtEnd;
00121
00122
00123 double maxSpeed;
00124
00125
00126 double maxSpeedY;
00127
00128
00129 WalkAccelerationRestrictor accelerationRestrictor;
00130
00131
00132 double targetAngleToBall;
00133
00134
00135 double yOffset;
00136
00137
00138 double walkType;
00139
00140
00141 double maxTurnSpeed;
00142
00143
00144 double slowDownDistance;
00145
00146 };
00147
00148 class GT2005BasicBehaviorGoToBallPropagated : public Xabsl2BasicBehavior, public BehaviorControlInterfaces
00149 {
00150 public:
00151
00152
00153
00154
00155
00156 GT2005BasicBehaviorGoToBallPropagated(BehaviorControlInterfaces& interfaces,
00157 Xabsl2ErrorHandler& errorHandler)
00158 : Xabsl2BasicBehavior("go-to-ball-propagated", errorHandler),
00159 BehaviorControlInterfaces(interfaces),
00160 accelerationRestrictor(motionRequest)
00161 {
00162 registerParameter("go-to-ball-propagated.distance",distanceAtEnd);
00163 registerParameter("go-to-ball-propagated.max-speed", maxSpeed);
00164 registerParameter("go-to-ball-propagated.max-speed.y", maxSpeedY);
00165 registerParameter("go-to-ball-propagated.max-turn-speed", maxTurnSpeed);
00166 registerParameter("go-to-ball-propagated.target-angle-to-ball", targetAngleToBall);
00167 registerParameter("go-to-ball-propagated.walk-type", walkType);
00168 registerParameter("go-to-ball-propagated.y-offset", yOffset);
00169 }
00170
00171
00172 virtual void execute();
00173
00174 private:
00175
00176 double distanceAtEnd;
00177
00178
00179 double maxSpeed;
00180
00181
00182 double maxSpeedY;
00183
00184
00185 WalkAccelerationRestrictor accelerationRestrictor;
00186
00187
00188 double targetAngleToBall;
00189
00190
00191 double yOffset;
00192
00193
00194 double walkType;
00195
00196
00197 double maxTurnSpeed;
00198 };
00199
00200
00201
00202
00203
00204
00205
00206 class GT2005BasicBehaviorGoToBallWithoutTurning: public Xabsl2BasicBehavior, public BehaviorControlInterfaces
00207 {
00208 public:
00209
00210
00211
00212
00213
00214 GT2005BasicBehaviorGoToBallWithoutTurning(BehaviorControlInterfaces& interfaces,
00215 Xabsl2ErrorHandler& errorHandler)
00216 : Xabsl2BasicBehavior("go-to-ball-without-turning", errorHandler),
00217 BehaviorControlInterfaces(interfaces),
00218 accelerationRestrictor(motionRequest)
00219 {
00220 registerParameter("go-to-ball-without-turning.max-speed", maxSpeed);
00221 }
00222
00223
00224 virtual void execute();
00225
00226 private:
00227
00228 double distanceAtEnd;
00229
00230
00231 double maxSpeed;
00232
00233
00234 double maxSpeedY;
00235
00236
00237 WalkAccelerationRestrictor accelerationRestrictor;
00238
00239
00240 double targetAngleToBall;
00241
00242
00243 double yOffset;
00244
00245
00246 double walkType;
00247
00248
00249 double maxTurnSpeed;
00250 };
00251
00252
00253
00254
00255
00256
00257
00258 class GT2005BasicBehaviorGoToPoint : public Xabsl2BasicBehavior, public BehaviorControlInterfaces
00259 {
00260 public:
00261
00262
00263
00264
00265
00266 GT2005BasicBehaviorGoToPoint(BehaviorControlInterfaces& interfaces,
00267 Xabsl2ErrorHandler& errorHandler)
00268 : Xabsl2BasicBehavior("go-to-point", errorHandler),
00269 BehaviorControlInterfaces(interfaces),
00270 accelerationRestrictor(motionRequest)
00271 {
00272 registerParameter("go-to-point.x", x);
00273 registerParameter("go-to-point.y", y);
00274 registerParameter("go-to-point.destination-angle", destinationAngle);
00275 registerParameter("go-to-point.distance-remain", distanceRemain);
00276 registerParameter("go-to-point.angle-remain", angleRemain);
00277 registerParameter("go-to-point.max-speed", maxSpeed);
00278 registerParameter("go-to-point.max-speed.y", maxSpeedY);
00279 registerParameter("go-to-point.walk-type", walkType);
00280 }
00281
00282
00283 virtual void execute();
00284
00285 protected:
00286
00287 double x;
00288
00289
00290 double y;
00291
00292
00293 double destinationAngle;
00294
00295
00296 double distanceRemain;
00297
00298
00299 double angleRemain;
00300
00301
00302 double maxSpeed;
00303
00304
00305 double maxSpeedY;
00306
00307
00308 double walkType;
00309
00310
00311 WalkAccelerationRestrictor accelerationRestrictor;
00312 };
00313
00314
00315
00316
00317
00318 class GT2005BasicBehaviorGoToRelativePoint : public Xabsl2BasicBehavior, public BehaviorControlInterfaces
00319 {
00320 public:
00321
00322
00323
00324
00325
00326 GT2005BasicBehaviorGoToRelativePoint(BehaviorControlInterfaces& interfaces, Xabsl2ErrorHandler& errorHandler)
00327 : Xabsl2BasicBehavior("go-to-relative-point", errorHandler),
00328 BehaviorControlInterfaces(interfaces), accelerationRestrictor(motionRequest)
00329 {
00330 registerParameter("go-to-relative-point.x", x);
00331 registerParameter("go-to-relative-point.y", y);
00332 registerParameter("go-to-relative-point.destination-angle", destinationAngle);
00333 registerParameter("go-to-relative-point.distance-remain", distanceRemain);
00334 registerParameter("go-to-relative-point.angle-remain", angleRemain);
00335 registerParameter("go-to-relative-point.max-speed", maxSpeed);
00336 registerParameter("go-to-relative-point.max-speed.y", maxSpeedY);
00337 registerParameter("go-to-relative-point.walk-type", walkType);
00338 }
00339
00340
00341 virtual void execute();
00342
00343 protected:
00344
00345 double x;
00346
00347
00348 double y;
00349
00350
00351 double destinationAngle;
00352
00353
00354 double distanceRemain;
00355
00356
00357 double angleRemain;
00358
00359
00360 double maxSpeed;
00361
00362
00363 double maxSpeedY;
00364
00365
00366 double walkType;
00367
00368
00369 WalkAccelerationRestrictor accelerationRestrictor;
00370
00371 double startX;
00372 double startY;
00373 double startRot;
00374 };
00375
00376
00377
00378
00379
00380
00381 class GT2005BasicBehaviorGoToPointFast : public Xabsl2BasicBehavior, public BehaviorControlInterfaces
00382 {
00383 public:
00384
00385
00386
00387
00388
00389 GT2005BasicBehaviorGoToPointFast(BehaviorControlInterfaces& interfaces,
00390 Xabsl2ErrorHandler& errorHandler)
00391 : Xabsl2BasicBehavior("go-to-point-fast", errorHandler),
00392 BehaviorControlInterfaces(interfaces)
00393 {
00394 registerParameter("go-to-point-fast.x", x);
00395 registerParameter("go-to-point-fast.y", y);
00396 registerParameter("go-to-point-fast.destination-angle", destinationAngle);
00397 registerParameter("go-to-point-fast.distance-remain", distanceRemain);
00398 registerParameter("go-to-point-fast.angle-remain", angleRemain);
00399 registerParameter("go-to-point-fast.max-speed", maxSpeed);
00400 registerParameter("go-to-point-fast.max-speed.y", maxSpeedY);
00401 registerParameter("go-to-point-fast.walk-type", walkType);
00402 }
00403
00404
00405 virtual void execute();
00406
00407 protected:
00408
00409 double x;
00410
00411
00412 double y;
00413
00414
00415 double destinationAngle;
00416
00417
00418 double distanceRemain;
00419
00420
00421 double angleRemain;
00422
00423
00424 double maxSpeed;
00425
00426
00427 double maxSpeedY;
00428
00429
00430 double walkType;
00431 };
00432
00433
00434
00435
00436
00437
00438 class GT2005BasicBehaviorGoToInterceptionPoint : public Xabsl2BasicBehavior, public BehaviorControlInterfaces
00439 {
00440 public:
00441
00442
00443
00444
00445
00446 GT2005BasicBehaviorGoToInterceptionPoint(BehaviorControlInterfaces& interfaces,
00447 Xabsl2ErrorHandler& errorHandler)
00448 : Xabsl2BasicBehavior("go-to-interception-point", errorHandler),
00449 BehaviorControlInterfaces(interfaces),
00450 accelerationRestrictor(motionRequest)
00451 {
00452 registerParameter("go-to-interception-point.interception-point.x",x);
00453 registerParameter("go-to-interception-point.interception-point.y",y);
00454 registerParameter("go-to-interception-point.distance",distanceAtEnd);
00455 registerParameter("go-to-interception-point.max-speed", maxSpeed);
00456 registerParameter("go-to-interception-point.max-speed.y", maxSpeedY);
00457 registerParameter("go-to-interception-point.max-turn-speed", maxTurnSpeed);
00458 registerParameter("go-to-interception-point.walk-type", walkType);
00459 registerParameter("go-to-interception-point.y-offset", yOffset);
00460 registerParameter("go-to-interception-point.slow-down-distance", slowDownDistance);
00461 registerParameter("go-to-interception-point.angle-factor", angleFactor);
00462 }
00463
00464
00465 virtual void execute();
00466
00467 private:
00468
00469 double x;
00470
00471
00472 double y;
00473
00474
00475 double distanceAtEnd;
00476
00477
00478 double maxSpeed;
00479
00480
00481 double maxSpeedY;
00482
00483
00484 WalkAccelerationRestrictor accelerationRestrictor;
00485
00486
00487 double yOffset;
00488
00489
00490 double walkType;
00491
00492
00493 double maxTurnSpeed;
00494
00495
00496 double angleFactor;
00497
00498
00499 double slowDownDistance;
00500 };
00501
00502
00503
00504
00505
00506
00507 class GT2005BasicBehaviorTurnAroundPoint : public Xabsl2BasicBehavior, public BehaviorControlInterfaces
00508 {
00509 public:
00510
00511
00512
00513
00514
00515 GT2005BasicBehaviorTurnAroundPoint(BehaviorControlInterfaces& interfaces,
00516 Xabsl2ErrorHandler& errorHandler)
00517 : Xabsl2BasicBehavior("turn-around-point", errorHandler),
00518 BehaviorControlInterfaces(interfaces),
00519 accelerationRestrictor(motionRequest)
00520 {
00521 registerParameter("turn-around-point.x", x);
00522 registerParameter("turn-around-point.y", y);
00523 registerParameter("turn-around-point.radius", radius);
00524 registerParameter("turn-around-point.left-right", leftRight);
00525 registerParameter("turn-around-point.forward-component", forwardComponent);
00526 }
00527
00528
00529 virtual void execute();
00530
00531 protected:
00532
00533 double x;
00534
00535
00536 double y;
00537
00538
00539 double radius;
00540
00541
00542 double leftRight;
00543
00544
00545 double forwardComponent;
00546
00547
00548 WalkAccelerationRestrictor accelerationRestrictor;
00549 };
00550
00551
00552
00553
00554
00555 class GT2005BasicBehaviorTurnAroundPointFast : public Xabsl2BasicBehavior, public BehaviorControlInterfaces
00556 {
00557 public:
00558
00559
00560
00561
00562
00563 GT2005BasicBehaviorTurnAroundPointFast(BehaviorControlInterfaces& interfaces,
00564 Xabsl2ErrorHandler& errorHandler)
00565 : Xabsl2BasicBehavior("turn-around-point-fast", errorHandler),
00566 BehaviorControlInterfaces(interfaces),
00567 accelerationRestrictor(motionRequest)
00568 {
00569 registerParameter("turn-around-point-fast.x", x);
00570 registerParameter("turn-around-point-fast.y", y);
00571 registerParameter("turn-around-point-fast.radius", radius);
00572 registerParameter("turn-around-point-fast.left-right", leftRight);
00573 registerParameter("turn-around-point-fast.forward-component", forwardComponent);
00574 }
00575
00576
00577 virtual void execute();
00578
00579 protected:
00580
00581 double x;
00582
00583
00584 double y;
00585
00586
00587 double radius;
00588
00589
00590 double leftRight;
00591
00592
00593 double forwardComponent;
00594
00595
00596 WalkAccelerationRestrictor accelerationRestrictor;
00597 };
00598
00599
00600
00601
00602
00603 class GT2005BasicBehaviorTurnAroundPointWithRadius : public Xabsl2BasicBehavior, public BehaviorControlInterfaces
00604 {
00605 public:
00606
00607
00608
00609
00610
00611 GT2005BasicBehaviorTurnAroundPointWithRadius(BehaviorControlInterfaces& interfaces,
00612 Xabsl2ErrorHandler& errorHandler)
00613 : Xabsl2BasicBehavior("turn-around-point-with-radius", errorHandler),
00614 BehaviorControlInterfaces(interfaces)
00615 {
00616 registerParameter("turn-around-point-with-radius.x", x);
00617 registerParameter("turn-around-point-with-radius.y", y);
00618 registerParameter("turn-around-point-with-radius.radius", radius);
00619 registerParameter("turn-around-point-with-radius.left-right", leftRight);
00620 registerParameter("turn-around-point-with-radius.forward-component", forwardComponent);
00621 }
00622
00623
00624 virtual void execute();
00625
00626 protected:
00627
00628 double x;
00629
00630
00631 double y;
00632
00633
00634 double radius;
00635
00636
00637 double leftRight;
00638
00639
00640 double forwardComponent;
00641 };
00642
00643
00644
00645 class GT2005BasicBehaviorGoaliePosition : public Xabsl2BasicBehavior, public BehaviorControlInterfaces
00646 {
00647 public:
00648
00649
00650
00651
00652
00653 GT2005BasicBehaviorGoaliePosition(BehaviorControlInterfaces& interfaces,
00654 Xabsl2ErrorHandler& errorHandler)
00655 : Xabsl2BasicBehavior("goalie-position", errorHandler),
00656 BehaviorControlInterfaces(interfaces)
00657 {
00658 registerParameter("goalie-position.max-speed", maxSpeed);
00659 registerParameter("goalie-position.min-x-trans", minXTrans);
00660 registerParameter("goalie-position.min-y-trans", minYTrans);
00661 registerParameter("goalie-position.weight-pose", weightPose);
00662 registerParameter("goalie-position.weight-odo", weightOdo);
00663 registerParameter("goalie-position.cut-y", cutY);
00664 registerParameter("goalie-position.guard-direct-to-goal", guardDirectToGoal);
00665 registerParameter("goalie-position.guard-line", guardLine);
00666 }
00667
00668
00669 virtual void execute();
00670
00671 protected:
00672
00673 double maxSpeed;
00674 double minXTrans;
00675 double minYTrans;
00676 double weightPose;
00677 double weightOdo;
00678 double cutY;
00679 double guardDirectToGoal;
00680 double guardLine;
00681
00682 Pose2D lastRobotPose;
00683 Pose2D lastOdometry;
00684 Pose2D goaliePose;
00685 Pose2D lastGoaliePose;
00686
00687
00688 };
00689
00690
00691
00692
00693
00694 class GT2005BasicBehaviorGoaliePositionReturn : public Xabsl2BasicBehavior, public BehaviorControlInterfaces
00695 {
00696 public:
00697
00698
00699
00700
00701
00702 GT2005BasicBehaviorGoaliePositionReturn(BehaviorControlInterfaces& interfaces,
00703 Xabsl2ErrorHandler& errorHandler)
00704 : Xabsl2BasicBehavior("goalie-position-return", errorHandler),
00705 BehaviorControlInterfaces(interfaces),
00706 accelerationRestrictor(motionRequest)
00707 {
00708 registerParameter("goalie-position-return.x", x);
00709 registerParameter("goalie-position-return.y", y);
00710 registerParameter("goalie-position-return.destination-angle", destinationAngle);
00711 registerParameter("goalie-position-return.max-speed", maxSpeed);
00712 }
00713
00714
00715 virtual void execute();
00716
00717 protected:
00718
00719 double x;
00720
00721
00722 double y;
00723
00724
00725 double destinationAngle;
00726
00727
00728 double maxSpeed;
00729
00730
00731 WalkAccelerationRestrictor accelerationRestrictor;
00732 };
00733
00734
00735
00736
00737
00738 class GT2005BasicBehaviorGoalieReturnToGoal : public Xabsl2BasicBehavior, public BehaviorControlInterfaces
00739 {
00740 public:
00741
00742
00743
00744
00745
00746 GT2005BasicBehaviorGoalieReturnToGoal(BehaviorControlInterfaces& interfaces,
00747 Xabsl2ErrorHandler& errorHandler)
00748 : Xabsl2BasicBehavior("goalie-return-to-goal", errorHandler),
00749 BehaviorControlInterfaces(interfaces),
00750 accelerationRestrictor(motionRequest)
00751 {
00752 registerParameter("goalie-return-to-goal.x", x);
00753 registerParameter("goalie-return-to-goal.y", y);
00754 registerParameter("goalie-return-to-goal.max-speed", maxSpeed);
00755 }
00756
00757
00758 virtual void execute();
00759
00760 protected:
00761
00762 double x;
00763
00764
00765 double y;
00766
00767
00768 double maxSpeed;
00769
00770
00771 WalkAccelerationRestrictor accelerationRestrictor;
00772 };
00773
00774
00775
00776
00777
00778
00779 class GT2005BasicBehaviorGoForwardToPoint : public Xabsl2BasicBehavior, public BehaviorControlInterfaces
00780 {
00781 public:
00782
00783
00784
00785
00786
00787 GT2005BasicBehaviorGoForwardToPoint(BehaviorControlInterfaces& interfaces,
00788 Xabsl2ErrorHandler& errorHandler)
00789 : Xabsl2BasicBehavior("go-forward-to-point", errorHandler),
00790 BehaviorControlInterfaces(interfaces),
00791 accelerationRestrictor(motionRequest)
00792 {
00793 registerParameter("go-forward-to-point.x", x);
00794 registerParameter("go-forward-to-point.y", y);
00795 registerParameter("go-forward-to-point.max-speed", maxSpeed);
00796 }
00797
00798
00799 virtual void execute();
00800
00801 protected:
00802
00803 double x;
00804
00805
00806 double y;
00807
00808
00809 double maxSpeed;
00810
00811
00812 WalkAccelerationRestrictor accelerationRestrictor;
00813 };
00814
00815
00816
00817
00818
00819 class GT2005BasicBehaviorGoToPointAndAvoidObstacles : public Xabsl2BasicBehavior, public BehaviorControlInterfaces
00820 {
00821 public:
00822
00823
00824
00825
00826
00827 GT2005BasicBehaviorGoToPointAndAvoidObstacles(BehaviorControlInterfaces& interfaces,
00828 Xabsl2ErrorHandler& errorHandler)
00829 : Xabsl2BasicBehavior("go-to-point-and-avoid-obstacles", errorHandler),
00830 BehaviorControlInterfaces(interfaces),
00831 turnSpeed(0, .5, 0, 0, -pi, pi, pi/2),
00832 speedX(0, .3, 0, 0, -80, 500, 100),
00833 speedY(0, .3, 0, 0, -150, 150, 100)
00834 {
00835 registerParameter("go-to-point-and-avoid-obstacles.x", x);
00836 registerParameter("go-to-point-and-avoid-obstacles.y", y);
00837 registerParameter("go-to-point-and-avoid-obstacles.max-speed", maxSpeed);
00838 registerParameter("go-to-point-and-avoid-obstacles.avoidance-level", avoidanceLevel);
00839 }
00840
00841
00842 virtual void execute();
00843
00844 private:
00845
00846 double x;
00847
00848
00849 double y;
00850
00851
00852 double maxSpeed;
00853
00854
00855 double avoidanceLevel;
00856
00857
00858 PIDsmoothedValue turnSpeed;
00859
00860
00861 PIDsmoothedValue speedX;
00862
00863
00864 PIDsmoothedValue speedY;
00865
00866
00867 long lastTimeExecuted;
00868 };
00869
00870
00871
00872
00873
00874
00875
00876
00877
00878
00879
00880
00881
00882
00883
00884
00885
00886
00887
00888
00889
00890
00891
00892
00893
00894
00895 struct WLanInfo
00896 {
00897 unsigned long measures;
00898 double link;
00899 double noise;
00900 double signal;
00901
00902 double dLink;
00903 double dNoise;
00904 double dSignal;
00905 };
00906
00907 #define FILTEREDINFO 16
00908 #define WLANINFO 360
00909
00910
00911
00912
00913
00914
00915 class GT2005BasicBehaviorCalcWlanBearing : public Xabsl2BasicBehavior, public BehaviorControlInterfaces
00916 {
00917 public:
00918
00919
00920
00921
00922
00923 GT2005BasicBehaviorCalcWlanBearing(BehaviorControlInterfaces& interfaces,
00924 Xabsl2ErrorHandler& errorHandler)
00925 : Xabsl2BasicBehavior("calc-wlan-bearing", errorHandler),
00926 BehaviorControlInterfaces(interfaces)
00927
00928
00929
00930 {
00931 registerParameter("calc-wlan-bearing.init", state);
00932
00933 initExecuted = false;
00934 filterExecuted = false;
00935
00936 numMeasure = 0;
00937 }
00938
00939
00940 virtual void init();
00941
00942
00943 virtual void execute();
00944
00945 virtual void Filter();
00946
00947 private:
00948 unsigned int numMeasure;
00949 unsigned long startTime;
00950
00951 double state;
00952
00953 unsigned int frames;
00954 WLanInfo wlanInfo[WLANINFO];
00955
00956 WLanInfo filteredInfo[FILTEREDINFO];
00957
00958 bool initExecuted;
00959 bool filterExecuted;
00960
00961 OdometryData lastOdometry;
00962
00963 double rotationAngle;
00964 };
00965
00966
00967
00968
00969
00970
00971 class GT2005BasicBehaviorLocateMaxGreen : public Xabsl2BasicBehavior, public BehaviorControlInterfaces
00972 {
00973 public:
00974
00975
00976
00977
00978
00979 GT2005BasicBehaviorLocateMaxGreen(BehaviorControlInterfaces& interfaces,
00980 Xabsl2ErrorHandler& errorHandler)
00981 : Xabsl2BasicBehavior("locate-max-green", errorHandler),
00982 BehaviorControlInterfaces(interfaces)
00983 {
00984 registerParameter("locate-max-green.param", param);
00985
00986 Init ();
00987 }
00988
00989
00990 virtual void execute();
00991 private:
00992 void Init ();
00993 OdometryData lastOdometry;
00994
00995 double rotationAngle;
00996
00997 double param;
00998 };
00999
01000
01001
01002
01003
01004
01005 class GT2005BasicBehaviorTurn : public Xabsl2BasicBehavior, public BehaviorControlInterfaces
01006 {
01007 public:
01008
01009
01010
01011
01012
01013 GT2005BasicBehaviorTurn(BehaviorControlInterfaces& interfaces,
01014 Xabsl2ErrorHandler& errorHandler)
01015 : Xabsl2BasicBehavior("turn", errorHandler),
01016 BehaviorControlInterfaces(interfaces)
01017 {
01018 registerParameter("turn.angle", angle);
01019 registerParameter("turn.radian", radian);
01020 registerParameter("turn.param", param);
01021 }
01022
01023
01024 virtual void execute();
01025 private:
01026 void Init ();
01027
01028 OdometryData lastOdometry;
01029
01030 double angle;
01031
01032 double radian;
01033
01034 double rotationAngle;
01035
01036 double targetRotation;
01037
01038 double param;
01039 };
01040
01041
01042
01043
01044
01045
01046 class GT2005SimpleBasicBehaviors : public BehaviorControlInterfaces
01047 {
01048 public:
01049
01050
01051
01052 GT2005SimpleBasicBehaviors(BehaviorControlInterfaces& interfaces,
01053 Xabsl2ErrorHandler& errorHandler)
01054 : BehaviorControlInterfaces(interfaces),
01055 errorHandler(errorHandler),
01056 basicBehaviorGoToBallWoTurning(interfaces,errorHandler),
01057 basicBehaviorNewGoToBall(interfaces,errorHandler),
01058 basicBehaviorGoToBallPropagated(interfaces,errorHandler),
01059 basicBehaviorGoToBall(interfaces,errorHandler),
01060 basicBehaviorGoToPoint(interfaces,errorHandler),
01061 basicBehaviorGoToPointFast(interfaces,errorHandler),
01062 basicBehaviorGoToInterceptionPoint(interfaces,errorHandler),
01063 basicBehaviorGoForwardToPoint(interfaces,errorHandler),
01064 basicBehaviorTurnAroundPoint(interfaces,errorHandler),
01065 basicBehaviorGoToPointAndAvoidObstacles(interfaces,errorHandler),
01066
01067 basicBehaviorGoaliePosition(interfaces,errorHandler),
01068 basicBehaviorGoalieReturnToGoal(interfaces,errorHandler),
01069 basicBehaviorGoaliePositionReturn(interfaces,errorHandler),
01070 basicBehaviorTurnAroundPointWithRadius(interfaces,errorHandler),
01071 basicBehaviorGoToRelativePoint(interfaces,errorHandler),
01072 basicBehaviorCalcWLanBearing(interfaces,errorHandler),
01073 basicBehaviorLocateMaxGreen(interfaces,errorHandler),
01074 basicBehaviorTurnAroundPointFast(interfaces,errorHandler),
01075 basicBehaviorTurn(interfaces,errorHandler)
01076 {}
01077
01078
01079 void registerBasicBehaviors(Xabsl2Engine& engine)
01080 {
01081 engine.registerBasicBehavior(basicBehaviorGoToBallWoTurning);
01082 engine.registerBasicBehavior(basicBehaviorNewGoToBall);
01083 engine.registerBasicBehavior(basicBehaviorGoToBallPropagated);
01084 engine.registerBasicBehavior(basicBehaviorGoToBall);
01085 engine.registerBasicBehavior(basicBehaviorGoToPoint);
01086 engine.registerBasicBehavior(basicBehaviorGoToPointFast);
01087 engine.registerBasicBehavior(basicBehaviorGoToInterceptionPoint);
01088 engine.registerBasicBehavior(basicBehaviorGoForwardToPoint);
01089 engine.registerBasicBehavior(basicBehaviorGoToPointAndAvoidObstacles);
01090 engine.registerBasicBehavior(basicBehaviorTurnAroundPoint);
01091
01092 engine.registerBasicBehavior(basicBehaviorGoaliePosition);
01093 engine.registerBasicBehavior(basicBehaviorGoalieReturnToGoal);
01094 engine.registerBasicBehavior(basicBehaviorGoaliePositionReturn);
01095 engine.registerBasicBehavior(basicBehaviorTurnAroundPointWithRadius);
01096 engine.registerBasicBehavior(basicBehaviorGoToRelativePoint);
01097 engine.registerBasicBehavior(basicBehaviorCalcWLanBearing);
01098 engine.registerBasicBehavior(basicBehaviorLocateMaxGreen);
01099 engine.registerBasicBehavior(basicBehaviorTurnAroundPointFast);
01100 engine.registerBasicBehavior(basicBehaviorTurn);
01101 }
01102
01103 private:
01104
01105 Xabsl2ErrorHandler& errorHandler;
01106
01107
01108
01109 GT2005BasicBehaviorGoToBallWithoutTurning basicBehaviorGoToBallWoTurning;
01110 GT2005BasicBehaviorNewGoToBall basicBehaviorNewGoToBall;
01111 GT2005BasicBehaviorGoToBall basicBehaviorGoToBall;
01112 GT2005BasicBehaviorGoToBallPropagated basicBehaviorGoToBallPropagated;
01113 GT2005BasicBehaviorGoToPoint basicBehaviorGoToPoint;
01114 GT2005BasicBehaviorGoToPointFast basicBehaviorGoToPointFast;
01115 GT2005BasicBehaviorGoToInterceptionPoint basicBehaviorGoToInterceptionPoint;
01116 GT2005BasicBehaviorGoForwardToPoint basicBehaviorGoForwardToPoint;
01117 GT2005BasicBehaviorTurnAroundPoint basicBehaviorTurnAroundPoint;
01118 GT2005BasicBehaviorGoToPointAndAvoidObstacles basicBehaviorGoToPointAndAvoidObstacles;
01119
01120 GT2005BasicBehaviorGoaliePosition basicBehaviorGoaliePosition;
01121 GT2005BasicBehaviorGoalieReturnToGoal basicBehaviorGoalieReturnToGoal;
01122 GT2005BasicBehaviorGoaliePositionReturn basicBehaviorGoaliePositionReturn;
01123 GT2005BasicBehaviorTurnAroundPointWithRadius basicBehaviorTurnAroundPointWithRadius;
01124 GT2005BasicBehaviorGoToRelativePoint basicBehaviorGoToRelativePoint;
01125 GT2005BasicBehaviorCalcWlanBearing basicBehaviorCalcWLanBearing;
01126 GT2005BasicBehaviorLocateMaxGreen basicBehaviorLocateMaxGreen;
01127 GT2005BasicBehaviorTurnAroundPointFast basicBehaviorTurnAroundPointFast;
01128 GT2005BasicBehaviorTurn basicBehaviorTurn;
01129
01130 };
01131
01132 #endif // __GT2005SimpleBasicBehaviors_h_
01133