6
* This file YarpedSim.h is created at Almende B.V. It is open-source software and part
7
* of the Common Hybrid Agent Platform (CHAP). A toolbox with a lot of open-source tools.
8
* Ranging from thread pools, and TCP/IP components to control architectures and learning
9
* algorithms. This software is published under the GNU Lesser General Public license,
11
* It is not possible to add usage restrictions to an open-source license. Nevertheless,
12
* we personally strongly object against this software used by the military, in the
13
* bio-industry, for animal experimentation, or anything that violates the Universal
14
* Declaration of Human Rights.
16
* Author: Anne C. van Rossum
18
* Project: Replicator FP7
19
* Company: Almende B.V.
31
#include <dtGame/gmcomponent.h>
34
#include <yarp/os/BufferedPort.h>
35
#include <yarp/os/Bottle.h>
36
#include <yarp/os/Vocab.h>
37
#include <yarp/os/Network.h>
40
#include <srInterface/YarpUtil.h>
42
using namespace yarp::os;
44
namespace srInterface {
52
/* **************************************************************************************
53
* Interface of YarpedSim
54
* **************************************************************************************/
57
* The simulator can be interfaced over YARP via this class. It makes it possible to add
58
* and remove robots. It is a Delta3D component and a YARP module at once. The first parent
59
* class describes a ProcessMessage routine that needs to be implemented to receive game
60
* messages. The latter defines runModule, updateModule, etc. This leads to conflicts: which
61
* entity should be able to tick YarpedSim? We choose to call updateModule from the
62
* ProcessMessage routine ourselves. So, runModule will not be called at all.
64
class YarpedSim: public dtGame::GMComponent {
72
* Function: ~YarpedSim
77
* Function: ProcessMessage ticks
79
void ProcessMessage(const dtGame::Message &message);
82
* Get AddRobot information from bottle
84
bool ReadBottleAddRobot(Bottle &bottle, std::string &name, std::string &type,
85
int &id, osg::Vec3f &position);
89
void AddRobot(const std::string &name, const std::string &type, const int &id, const osg::Vec3f &position);
92
// Global port for YARP commands to Robot3D
93
BufferedPort<Bottle> globalYarpPort;
95
//Reference to YARP will be created when this object is created
101
#endif /* YARPEDSIM_H_ */