Fawkes API Fawkes Development Version
|
00001 00002 /*************************************************************************** 00003 * position_mapper.cpp - Mapper Position2dProxy to ObjectPositionInterface 00004 * 00005 * Created: Tue Sep 30 00:53:38 2008 00006 * Copyright 2006-2008 Tim Niemueller [www.niemueller.de] 00007 * 00008 ****************************************************************************/ 00009 00010 /* This program is free software; you can redistribute it and/or modify 00011 * it under the terms of the GNU General Public License as published by 00012 * the Free Software Foundation; either version 2 of the License, or 00013 * (at your option) any later version. 00014 * 00015 * This program is distributed in the hope that it will be useful, 00016 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00017 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00018 * GNU Library General Public License for more details. 00019 * 00020 * Read the full text in the LICENSE.GPL file in the doc directory. 00021 */ 00022 00023 #include "position_mapper.h" 00024 00025 #include <interfaces/ObjectPositionInterface.h> 00026 #include <libplayerc++/playerc++.h> 00027 00028 /** @class PlayerPositionMapper "position_mapper.h" 00029 * Position mapper for player integration. 00030 * This class is used to map a Player position2d proxy to a Fawkes 00031 * ObjectPositionInterface. 00032 * @author Tim Niemueller 00033 */ 00034 00035 /** Constructor. 00036 * @param varname variable name 00037 * @param interface Fawkes interface instance 00038 * @param proxy Player proxy instance 00039 */ 00040 PlayerPositionMapper::PlayerPositionMapper(std::string varname, 00041 fawkes::ObjectPositionInterface *interface, 00042 PlayerCc::Position2dProxy *proxy) 00043 : PlayerProxyFawkesInterfaceMapper(varname) 00044 { 00045 __interface = interface; 00046 __proxy = proxy; 00047 } 00048 00049 00050 void 00051 PlayerPositionMapper::sync_player_to_fawkes() 00052 { 00053 if ( __proxy->IsFresh() ) { 00054 //printf("Setting %s to (%f, %f, %f)\n", varname().c_str(), __proxy->GetXPos(), 00055 // __proxy->GetYPos(), __proxy->GetYaw()); 00056 __interface->set_relative_x(__proxy->GetXPos()); 00057 __interface->set_relative_y(__proxy->GetYPos()); 00058 __interface->set_relative_z(__proxy->GetYaw()); 00059 __interface->write(); 00060 __proxy->NotFresh(); 00061 } 00062 } 00063 00064 void 00065 PlayerPositionMapper::sync_fawkes_to_player() 00066 { 00067 }