experimentslibinitializer.cpp
1 /********************************************************************************
2  * FARSA Experimentes Library *
3  * Copyright (C) 2007-2012 *
4  * Gianluca Massera <emmegian@yahoo.it> *
5  * Stefano Nolfi <stefano.nolfi@istc.cnr.it> *
6  * Tomassino Ferrauto <tomassino.ferrauto@istc.cnr.it> *
7  * *
8  * This program is free software; you can redistribute it and/or modify *
9  * it under the terms of the GNU General Public License as published by *
10  * the Free Software Foundation; either version 2 of the License, or *
11  * (at your option) any later version. *
12  * *
13  * This program is distributed in the hope that it will be useful, *
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
16  * GNU General Public License for more details. *
17  * *
18  * You should have received a copy of the GNU General Public License *
19  * along with this program; if not, write to the Free Software *
20  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *
21  ********************************************************************************/
22 
23 #include "experimentsconfig.h"
24 #include "evonet.h"
25 #include "component.h"
26 #include "sensors.h"
27 #include "motors.h"
28 #include "icubsensors.h"
29 #include "icubmotors.h"
30 #include "marxbotsensors.h"
31 #include "marxbotmotors.h"
32 #include "epucksensors.h"
33 #include "epuckmotors.h"
34 #include "kheperasensors.h"
35 #include "kheperamotors.h"
36 #include "evoga.h"
37 #include "icubsimulator.h"
38 #include "abstracttest.h"
39 #include "tests.h"
40 #include "evorobotcomponent.h"
41 #include "factory.h"
42 #include "logger.h"
43 #include "robots.h"
44 #include "arena.h"
45 
46 namespace farsa {
47 
48 bool FARSA_EXPERIMENTS_API initExperimentsLib() {
49  static bool dummy = false;
50  if ( dummy ) return true;
51  dummy = true;
52  // Registering main types to factory
53  Factory::getInstance().registerClass<Component>( "Component", "ParameterSettableWithConfigureFunction" );
54 
55  // Evonet does not comply with ConfigurationParameters
56  Factory::getInstance().registerClass<Evonet>( "Evonet", "ParameterSettableWithConfigureFunction" );
57 
58  // Registering all robots
59  Factory::getInstance().registerClass<Robot>( "Robot", "ParameterSettableInConstructor" );
60 #ifdef FARSA_USE_YARP_AND_ICUB
61  Factory::getInstance().registerClass<iCubRobot>( "iCubRobot", "Robot" );
62 #endif
63  Factory::getInstance().registerClass<MarXbot>( "MarXbot", "Robot" );
64  Factory::getInstance().registerClass<Epuck>( "Epuck", "Robot" );
65  Factory::getInstance().registerClass<Khepera>( "Khepera", "Robot" );
66 
67  // Registering the arena
68  Factory::getInstance().registerClass<Arena>( "Arena", "ParameterSettableInConstructor" );
69 
70 #ifdef FARSA_USE_YARP_AND_ICUB
71  // Registering all types for icubsimulator component
72  Factory::getInstance().registerClass<iCubSimulator>( "iCubSimulator", "Component" );
73 #endif
74 
75  // Registering all types for evorobot component
76  Factory::getInstance().registerClass<EvoRobotComponent>( "EvoRobotComponent", "Component" );
77  Factory::getInstance().registerClass<Evoga>("Evoga", "ParameterSettableWithConfigureFunction");
78  Factory::getInstance().registerClass<AbstractTest>("AbstractTest", "ParameterSettableWithConfigureFunction");
79  Factory::getInstance().registerClass<EvoRobotExperiment>("EvoRobotExperiment", "ParameterSettableWithConfigureFunction");
80  Factory::getInstance().registerClass<TestRandom>("TestRandom", "AbstractTest");
81  Factory::getInstance().registerClass<TestIndividual>("TestIndividual", "AbstractTest");
82 
83  // Registering sensors
84  Factory::getInstance().registerClass<Sensor>("Sensor", "ParameterSettableInConstructor");
85  Factory::getInstance().registerClass<FakeSensor>("FakeSensor", "Sensor");
86  Factory::getInstance().registerClass<ObjectPositionSensor>("ObjectPositionSensor", "Sensor");
87 #ifdef FARSA_USE_YARP_AND_ICUB
88  Factory::getInstance().registerClass<iCubSensor>("iCubSensor", "Sensor");
89  Factory::getInstance().registerClass<iCubArmJointsSensor>("iCubArmJointsSensor", "iCubSensor");
90  Factory::getInstance().registerClass<ColorCameraSensor>("ColorCameraSensor", "iCubSensor");
91  Factory::getInstance().registerClass<LinearCameraSensor>("LinearCameraSensor", "iCubSensor");
92  Factory::getInstance().registerClass<iCubHeadJointsSensor>("iCubHeadJointsSensor", "iCubSensor");
93  Factory::getInstance().registerClass<iCubPCHeadJointsSensor>("iCubPCHeadJointsSensor", "iCubSensor");
94  Factory::getInstance().registerClass<iCubTorsoJointsSensor>("iCubTorsoJointsSensor", "iCubSensor");
95  Factory::getInstance().registerClass<iCubHandJointsSensor>("iCubHandJointsSensor", "iCubSensor");
96  Factory::getInstance().registerClass<iCubPalmTargetDistSensor>("iCubPalmTargetDistSensor", "iCubSensor");
97  Factory::getInstance().registerClass<iCubPalmTouchSensor>("iCubPalmTouchSensor", "iCubSensor");
98  Factory::getInstance().registerClass<iCubHandTouchSensor>("iCubHandTouchSensor", "iCubSensor");
99  Factory::getInstance().registerClass<iCubFingertipsTouchSensor>("iCubFingertipsTouchSensor", "iCubSensor");
100  Factory::getInstance().registerClass<iCubPalmPatchesTouchSensor>("iCubPalmPatchesTouchSensor", "iCubSensor");
101  Factory::getInstance().registerClass<HandObjectVisualOffsetSensor>("HandObjectVisualOffsetSensor", "iCubSensor");
102 #endif
103  Factory::getInstance().registerClass<MarXbotSensor>("MarXbotSensor", "Sensor");
104  Factory::getInstance().registerClass<MarXbotProximityIRSensor>("MarXbotProximityIRSensor", "MarXbotSensor");
105  Factory::getInstance().registerClass<MarXbotGroundBottomIRSensor>("MarXbotGroundBottomIRSensor", "MarXbotSensor");
106  Factory::getInstance().registerClass<MarXbotGroundAroundIRSensor>("MarXbotGroundAroundIRSensor", "MarXbotSensor");
107  Factory::getInstance().registerClass<MarXbotLinearCameraSensor>("MarXbotLinearCameraSensor", "MarXbotSensor");
108  Factory::getInstance().registerClass<MarXbotTractionSensor>("MarXbotTractionSensor", "MarXbotSensor");
109  Factory::getInstance().registerClass<MarXbotSampledProximityIRSensor>("MarXbotSampledProximityIRSensor", "MarXbotSensor");
110  Factory::getInstance().registerClass<MarXbotAttachmentDeviceSensor>("MarXbotAttachmentDeviceSensor", "MarXbotSensor");
111  Factory::getInstance().registerClass<EpuckSensor>("EpuckSensor", "Sensor");
112  Factory::getInstance().registerClass<EpuckProximityIRSensor>("EpuckProximityIRSensor", "EpuckSensor");
113  Factory::getInstance().registerClass<EpuckGroundIRSensor>("EpuckGroundIRSensor", "EpuckSensor");
114  Factory::getInstance().registerClass<EpuckLinearCameraSensor>("EpuckLinearCameraSensor", "EpuckSensor");
115  Factory::getInstance().registerClass<EpuckSampledProximityIRSensor>("EpuckSampledProximityIRSensor", "EpuckSensor");
116  Factory::getInstance().registerClass<KheperaSensor>("KheperaSensor", "Sensor");
117  Factory::getInstance().registerClass<KheperaProximityIRSensor>("KheperaProximityIRSensor", "KheperaSensor");
118  Factory::getInstance().registerClass<KheperaSampledProximityIRSensor>("KheperaSampledProximityIRSensor", "KheperaSensor");
119 
120  // Registering motors
121  Factory::getInstance().registerClass<Motor>("Motor", "ParameterSettableInConstructor");
122  Factory::getInstance().registerClass<FakeMotor>("FakeMotor", "Motor");
123 #ifdef FARSA_USE_YARP_AND_ICUB
124  Factory::getInstance().registerClass<iCubMotor>("iCubMotor", "Motor");
125  Factory::getInstance().registerClass<iCubArmRandomMotor>("iCubArmRandomMotor", "iCubMotor");
126  Factory::getInstance().registerClass<iCubArmMusclesMotor>("iCubArmMusclesMotor", "iCubMotor");
127  Factory::getInstance().registerClass<iCubHandMusclesMotor>("iCubHandMusclesMotor", "iCubMotor");
128  Factory::getInstance().registerClass<iCubHeadMusclesMotor>("iCubHeadMusclesMotor", "iCubMotor");
129  Factory::getInstance().registerClass<iCubTorsoMusclesMotor>("iCubTorsoMusclesMotor", "iCubMotor");
130  Factory::getInstance().registerClass<iCubPosToVelMotor>("iCubPosToVelMotor", "iCubMotor");
131  Factory::getInstance().registerClass<iCubHeadPosToVelMotor>("iCubHeadPosToVelMotor", "iCubPosToVelMotor");
132  Factory::getInstance().registerClass<iCubTorsoPosToVelMotor>("iCubTorsoPosToVelMotor", "iCubPosToVelMotor");
133  Factory::getInstance().registerClass<iCubArmPosToVelMotor>("iCubArmPosToVelMotor", "iCubPosToVelMotor");
134  Factory::getInstance().registerClass<iCubConfigurableHandPosToVelMotor>("iCubConfigurableHandPosToVelMotor", "iCubPosToVelMotor");
135  Factory::getInstance().registerClass<iCubHeadVelocityMotor>("iCubHeadVelocityMotor", "iCubMotor");
136  Factory::getInstance().registerClass<iCubArmPosToPostureMotor>("iCubArmPosToPostureMotor", "iCubMotor" );
137  Factory::getInstance().registerClass<iCubTorsoPosToPostureMotor>("iCubTorsoPosToPostureMotor", "iCubMotor");
138  Factory::getInstance().registerClass<iCubArmVelocityMotor>("iCubArmVelocityMotor", "iCubMotor" );
139  Factory::getInstance().registerClass<iCubTorsoVelocityMotor>("iCubTorsoVelocityMotor", "iCubMotor");
140 #endif
141  Factory::getInstance().registerClass<MarXbotMotor>("MarXbotMotor", "Motor");
142  Factory::getInstance().registerClass<MarXbotWheelVelocityMotor>("MarXbotWheelVelocityMotor", "MarXbotMotor");
143  Factory::getInstance().registerClass<MarXbotColorMotor>("MarXbotColorMotor", "MarXbotMotor");
144  Factory::getInstance().registerClass<MarXbotAttachmentDeviceMotor>("MarXbotAttachmentDeviceMotor", "MarXbotMotor");
145  Factory::getInstance().registerClass<EpuckMotor>("EpuckMotor", "Motor");
146  Factory::getInstance().registerClass<EpuckWheelVelocityMotor>("EpuckWheelVelocityMotor", "EpuckMotor");
147  Factory::getInstance().registerClass<KheperaMotor>("KheperaMotor", "Motor");
148  Factory::getInstance().registerClass<KheperaWheelVelocityMotor>("KheperaWheelVelocityMotor", "KheperaMotor");
149 
150 
151  Logger::info( "Library Experiments Initialized" );
152  return true;
153 }
154 
155 } // end namespace farsa