Fawkes API  Fawkes Development Version
position_mapper.cpp
1 
2 /***************************************************************************
3  * position_mapper.cpp - Mapper Position2dProxy to ObjectPositionInterface
4  *
5  * Created: Tue Sep 30 00:53:38 2008
6  * Copyright 2006-2008 Tim Niemueller [www.niemueller.de]
7  *
8  ****************************************************************************/
9 
10 /* This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation; either version 2 of the License, or
13  * (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  * GNU Library General Public License for more details.
19  *
20  * Read the full text in the LICENSE.GPL file in the doc directory.
21  */
22 
23 #include "position_mapper.h"
24 
25 #include <interfaces/ObjectPositionInterface.h>
26 #include <libplayerc++/playerc++.h>
27 
28 /** @class PlayerPositionMapper "position_mapper.h"
29  * Position mapper for player integration.
30  * This class is used to map a Player position2d proxy to a Fawkes
31  * ObjectPositionInterface.
32  * @author Tim Niemueller
33  */
34 
35 /** Constructor.
36  * @param varname variable name
37  * @param interface Fawkes interface instance
38  * @param proxy Player proxy instance
39  */
42  PlayerCc::Position2dProxy *proxy)
44 {
45  __interface = interface;
46  __proxy = proxy;
47 }
48 
49 
50 void
52 {
53  if ( __proxy->IsFresh() ) {
54  //printf("Setting %s to (%f, %f, %f)\n", varname().c_str(), __proxy->GetXPos(),
55  // __proxy->GetYPos(), __proxy->GetYaw());
56  __interface->set_relative_x(__proxy->GetXPos());
57  __interface->set_relative_y(__proxy->GetYPos());
58  __interface->set_relative_z(__proxy->GetYaw());
59  __interface->write();
60  __proxy->NotFresh();
61  }
62 }
63 
64 void
66 {
67 }
ObjectPositionInterface Fawkes BlackBoard Interface.
void set_relative_y(const float new_relative_y)
Set relative_y value.
void write()
Write from local copy into BlackBoard memory.
Definition: interface.cpp:500
virtual void sync_fawkes_to_player()
Sync Fawkes interface to Player proxy.
Player proxy to Fawkes interface mapper interface.
Definition: mapper.h:28
virtual void sync_player_to_fawkes()
Sync Player proxy to Fawkes interface.
PlayerPositionMapper(std::string varname, fawkes::ObjectPositionInterface *interface, PlayerCc::Position2dProxy *proxy)
Constructor.
void set_relative_x(const float new_relative_x)
Set relative_x value.
void set_relative_z(const float new_relative_z)
Set relative_z value.