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   motionRequest.motionType = MotionRequest::stand;
00069 }
00070 void BasicBehaviorPlayDead::execute()
00071 {
00072   motionRequest.motionType = MotionRequest::playDead;
00073 }
00074 

Generated on Mon Mar 20 21:59:40 2006 for GT2005 by doxygen 1.3.6