Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

Modules/BehaviorControl/CommonXabsl2BasicBehaviors/CommonBasicBehaviors.cpp

Go to the documentation of this file.
00001 /** 
00002 * @file CommonBasicBehaviors.cpp
00003 *
00004 * Implementation of basic behaviors defined in simple-basic-behaviors.xml.
00005 *
00006 * @author Uwe Düffert
00007 * @author Matthias Jüngel
00008 * @author Martin Lötzsch
00009 * @author Max Risler
00010 */
00011 
00012 #include "CommonBasicBehaviors.h"
00013 
00014 void CommonBasicBehaviors::registerBasicBehaviors(Xabsl2Engine& engine)
00015 {
00016   engine.registerBasicBehavior(basicBehaviorDoNothing);
00017   engine.registerBasicBehavior(basicBehaviorShutdown);
00018   engine.registerBasicBehavior(basicBehaviorSpecialAction);
00019   engine.registerBasicBehavior(basicBehaviorStand);
00020   engine.registerBasicBehavior(basicBehaviorPlayDead);
00021   engine.registerBasicBehavior(basicBehaviorWalk);
00022 }
00023 
00024 void BasicBehaviorShutdown::execute()
00025 {
00026   SystemCall::shutdown();
00027 }
00028 
00029 void BasicBehaviorDoNothing::execute()
00030 {
00031   // do nothing;
00032 }
00033 
00034 void BasicBehaviorWalk::execute()
00035 {
00036   motionRequest.motionType = MotionRequest::walk;
00037   motionRequest.walkRequest.walkType   = static_cast<WalkRequest::WalkType>(static_cast<int>(type));
00038   if(motionRequest.walkRequest.walkType >= WalkRequest::numOfWalkType || motionRequest.walkRequest.walkType < 0)
00039     motionRequest.walkRequest.walkType = WalkRequest::normal;
00040   motionRequest.walkRequest.walkParams.translation.x = speedX;
00041   motionRequest.walkRequest.walkParams.translation.y = speedY;
00042   motionRequest.walkRequest.walkParams.rotation = fromDegrees(rotationSpeed);
00043 }
00044 
00045 void BasicBehaviorSpecialAction::execute()
00046 {
00047   motionRequest.motionType = MotionRequest::specialAction;
00048   motionRequest.specialActionRequest.specialActionType = static_cast<SpecialActionRequest::SpecialActionID>(static_cast<int>(specialActionID));
00049 }
00050 
00051 void BasicBehaviorStand::execute()
00052 {
00053   accelerationRestrictor.saveLastWalkParameters();
00054 
00055   motionRequest.walkRequest.walkParams.translation.x = 0;
00056   motionRequest.walkRequest.walkParams.translation.y = 0;
00057   motionRequest.walkRequest.walkParams.rotation = 0;
00058 
00059   accelerationRestrictor.restrictAccelerations(250,250,150);
00060 
00061   if (fabs(motionRequest.walkRequest.walkParams.translation.x) < 30
00062     && fabs(motionRequest.walkRequest.walkParams.translation.y) < 30
00063     && fabs(motionRequest.walkRequest.walkParams.rotation) < fromDegrees(30))
00064   {
00065     motionRequest.motionType = MotionRequest::stand;
00066   }
00067 }
00068 void BasicBehaviorPlayDead::execute()
00069 {
00070   motionRequest.motionType = MotionRequest::playDead;
00071 }
00072 
00073 
00074 /*
00075 * Change Log
00076 * 
00077 * $Log: CommonBasicBehaviors.cpp,v $
00078 * Revision 1.4  2004/06/17 14:14:28  spranger
00079 * if walk is selected in the xabsl-dialog, stupid things can happen with walk-type
00080 * fixed
00081 *
00082 * Revision 1.3  2004/06/14 15:06:13  spranger
00083 * added playDead-basic behavior
00084 *
00085 * Revision 1.2  2004/06/02 17:18:23  spranger
00086 * MotionRequest cleanup
00087 *
00088 * Revision 1.1.1.1  2004/05/22 17:16:56  cvsadm
00089 * created new repository GT2004_WM
00090 *
00091 * Revision 1.8  2004/05/04 20:24:54  loetzsch
00092 * minor improvments
00093 *
00094 * Revision 1.7  2004/05/04 10:48:58  loetzsch
00095 * replaced all enums
00096 * xxxBehaviorControlTimeAfterWhichCommunicatedBallsAreAccepted
00097 * by
00098 * behaviorControlTimeAfterWhichCommunicatedBallsAreAccepted
00099 * (this mechanism was neither fully implemented nor used)
00100 *
00101 * Revision 1.6  2004/04/08 15:33:01  wachter
00102 * GT04 checkin of Microsoft-Hellounds
00103 *
00104 * Revision 1.5  2004/04/07 13:44:33  risler
00105 * ddd checkin after go04 - second part fixed walktype
00106 *
00107 * Revision 1.4  2004/04/07 12:28:56  risler
00108 * ddd checkin after go04 - first part
00109 *
00110 * Revision 1.3  2004/03/29 17:49:27  loetzsch
00111 * added walk type turnWithBall4
00112 *
00113 * Revision 1.2  2004/03/17 21:08:38  cesarz
00114 * Added turnWithBall3, which points to MSH2004TurnWithBallWalkingParameters.
00115 *
00116 * Revision 1.1  2003/10/22 22:18:44  loetzsch
00117 * prepared the cloning of the GT2003BehaviorControl
00118 *
00119 */
00120 

Generated on Thu Sep 23 19:57:25 2004 for GT2004 by doxygen 1.3.6