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