00001
00002
00003
00004
00005
00006
00007
00008
00009 #include "Xabsl2HeadControl.h"
00010 #include "Platform/GTAssert.h"
00011
00012 Xabsl2HeadControl::Xabsl2HeadControl
00013 (const HeadControlInterfaces& interfaces,
00014 SolutionRequest::xabsl2EngineID id
00015 ) :
00016 HeadControl(interfaces),
00017 GTXabsl2EngineExecutor(id,SolutionRequest::headControl,frameNumber)
00018 {
00019 }
00020
00021 void Xabsl2HeadControl::executeIfEngineCouldNotBeCreated()
00022 {
00023 headMotionRequest.pan = 1500000;
00024 headMotionRequest.tilt = 1000000;
00025 headMotionRequest.roll = 0;
00026 headMotionRequest.mouth = -700000;
00027 }
00028
00029 void Xabsl2HeadControl::printGeneratedMainActionToString(char* buf)
00030 {
00031 sprintf(buf, "t1: %2.3f pan: %2.3f t2: %2.3f [rad]",
00032 (double)headMotionRequest.tilt/1000000.0,
00033 (double)headMotionRequest.pan/1000000.0,
00034 (double)headMotionRequest.roll/1000000.0);
00035 }
00036
00037 bool Xabsl2HeadControl::handleMessage(InMessage& message)
00038 {
00039 return GTXabsl2EngineExecutor::handleMessage(message);
00040 }
00041
00042 Xabsl2HeadControlAgentInterface::Xabsl2HeadControlAgentInterface
00043 (const char* name,
00044 Xabsl2HeadControl* headControl,
00045 const HeadControlInterfaces& interfaces
00046 ) :
00047 HeadControl(interfaces), Xabsl2NamedItem(name), headControl(headControl)
00048 {
00049 ASSERT(headControl != 0);
00050 }
00051
00052 Xabsl2HeadControlAgentInterface::~Xabsl2HeadControlAgentInterface()
00053 {
00054 if (headControl != 0) delete headControl;
00055 }
00056
00057 void Xabsl2HeadControlAgentInterface::execute()
00058 {
00059 ASSERT(headControl != 0);
00060 headControl->setSelectedAgent(n);
00061 headControl->execute();
00062 }
00063
00064 bool Xabsl2HeadControlAgentInterface::handleMessage(InMessage& message)
00065 {
00066 ASSERT(headControl != 0);
00067 return headControl->handleMessage(message);
00068 }
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094