00001 #include "OMKHumanoPlayer.h" 00002 #include "OMKParametersAccessor.inl" 00003 #include "OMKTransform.h" 00004 #include "OMKVisBase.h" 00005 #include "OMKAddVisualObjectPrm.h" 00006 #include "OMKConversion.h" 00007 00008 using namespace OMK ; 00009 using namespace OMK::Type ; 00010 using namespace OMK::Vis ; 00011 00012 00013 //============================================================================= 00014 00015 //----------------------------------------------------------------------------- 00016 REGISTER_OBJECT_FACTORY( OMK::HumanoPlayer, "HumanoPlayer" ) ; 00017 //----------------------------------------------------------------------------- 00018 00019 HumanoPlayer::HumanoPlayer( Controller& ctrl, const ObjectDescriptor& objectDescriptor ) 00020 : MovingHumano( ctrl, objectDescriptor ), 00021 _loop( "Loop", false ), 00022 _oneStep( "OneStep", false ), 00023 _stop( "Stop", false ), 00024 _player() 00025 { 00026 addAttribute( _loop ) ; 00027 addAttribute( _oneStep ) ; 00028 addAttribute( _stop ) ; 00029 } 00030 //----------------------------------------------------------------------------- 00031 HumanoPlayer::~HumanoPlayer() 00032 { 00033 delete _initialisationSequence ; 00034 } 00035 //----------------------------------------------------------------------------- 00036 bool HumanoPlayer::loadParameters( const ConfigurationParameterDescriptor * node ) 00037 { 00038 bool ok = true ; 00039 // Get the humano to record 00040 std::string file ; 00041 ok = ok && ParametersAccessor::get( node, "File", file, this ) ; 00042 00043 if( ok ) 00044 { 00045 // get the file to output data 00046 _initialisationSequence = new HBT::InitialisationSequence ; 00047 _player.open( file.c_str() ) ; 00048 _player.setLoop( _loop ) ; 00049 _player.read( *_initialisationSequence ) ; 00050 // change the name to the current one 00051 _initialisationSequence->humanName = getName().getString() ; 00052 } 00053 00054 return ok && MovingHumano::loadParameters( node ) ; 00055 } 00056 00057 //----------------------------------------------------------------------------- 00058 void HumanoPlayer::computeParameters() 00059 { 00060 _player.setLoop( _loop ) ; 00061 if( _initDone && ( !_stop || _oneStep ) ) 00062 { 00063 unsigned int date ; 00064 HBT::PostureData posture ; 00065 _player.read( date, posture ) ; 00066 _posture.set( posture ) ; 00067 _oneStep.set( false ) ; 00068 } 00069 MovingHumano::computeParameters() ; 00070 } 00071 //-----------------------------------------------------------------------------
Documentation generated on Mon Jun 9 11:45:56 2008 |
Generated with doxygen by Dimitri van Heesch , 1997-2007 |