00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef EVOROBOTVIEWER_H
00025 #define EVOROBOTVIEWER_H
00026
00027 #include "evorobotcomponent.h"
00028 #include "componentui.h"
00029 #include "evoga.h"
00030 #include "renderworld.h"
00031 #include "holisticviewer.h"
00032
00033 #include <QWidget>
00034 #include <QMenu>
00035 #include <QAction>
00036 #include <QMenuBar>
00037 #include <QFileDialog>
00038 #include <QLabel>
00039 #include <QList>
00040 #include <QString>
00041 #include <QWidget>
00042 #include <QMenuBar>
00043 #include <QVBoxLayout>
00044 #include <QObject>
00045
00046 namespace farsa {
00047
00048 class PhyiCub;
00049
00050 class EvoRobotExperiment;
00051 class NetworkDialog;
00052 class TestIndividual;
00053 class RenderWorldWrapperWidget;
00054
00055 class FARSA_EXPERIMENTS_API EvoRobotViewer : public QObject, public ComponentUI, public ConcurrentResourcesUser {
00056 Q_OBJECT
00057 public:
00061 EvoRobotViewer( EvoRobotComponent* component );
00063 ~EvoRobotViewer();
00069 void fillActionsMenu( QMenu* actionsMenu );
00075 QList<ComponentUIViewer> getViewers( QWidget* parent, Qt::WindowFlags flags );
00079 void addAdditionalMenus( QMenuBar* menuBar );
00080
00081 private:
00089 virtual void resourceChanged(QString resourceName, ResourceChangeType changeType);
00090
00091 ComponentUIViewer evogaControls( QWidget* parent, Qt::WindowFlags flags );
00092 ComponentUIViewer networkView( QWidget* parent, Qt::WindowFlags flags );
00093 ComponentUIViewer neuroMonitorView( QWidget* parent, Qt::WindowFlags flags );
00094
00095 ComponentUIViewer fitview( QWidget* parent, Qt::WindowFlags flags );
00096 ComponentUIViewer statview( QWidget* parent, Qt::WindowFlags flags );
00097 ComponentUIViewer holisticView( QWidget* parent, Qt::WindowFlags flags );
00098 ComponentUIViewer renderWorld( QWidget* parent, Qt::WindowFlags flags );
00099 ComponentUIViewer testIndividualUI( TestIndividual* test, QWidget* parent, Qt::WindowFlags flags );
00100
00101 EvoRobotComponent* evorobot;
00102 Evoga* ga;
00104 QWidget* statViewer;
00105 EvoDataViewer* edv;
00106 FitViewer* ftv;
00107 HolisticViewer* hlv;
00108
00109 RenderWorldWrapperWidget* renderworldwrapper;
00110 NetworkDialog *networkDialog;
00112 QLabel* infoEvoga;
00113
00114 private slots:
00118 void onEvonetUpdated();
00120 void onWorldAdvance();
00124 void onEvogaStartingReplication( int replication );
00128 void onEvogaRecoveredInterruptedEvolution( QString statfile );
00135 void onEvogaEndGeneration( int generation, int fmax, int faverage, int fmin );
00136
00138 void onActionFinished();
00139
00141 void evogaNextTrial();
00142
00144 void loadStat();
00146 void loadAllStat();
00147 };
00148
00157 class FARSA_EXPERIMENTS_API RenderWorldWrapperWidget : public QWidget, public ConcurrentResourcesUser
00158 {
00159 public:
00166 RenderWorldWrapperWidget(QWidget* parent = NULL, Qt::WindowFlags flags = 0);
00167
00171 virtual ~RenderWorldWrapperWidget();
00172
00176 void updateRenderWorld();
00177
00188 virtual void shareResourcesWith(ResourcesUser* buddy);
00189
00190 private:
00198 virtual void resourceChanged(QString resourceName, ResourceChangeType changeType);
00199
00208 virtual void customEvent(QEvent* event);
00209
00213 void lookAtRobot();
00214
00218 RenderWorld* const m_renderWorld;
00219
00223 QVBoxLayout* const m_layout;
00224
00231 bool m_renderWorldStateRestored;
00232
00236 bool m_setCameraToLookAtRobot;
00237
00243 wMatrix m_robotTm;
00244 };
00245
00246
00247
00248
00249
00250
00251
00252
00253
00254
00255
00256
00257
00258
00259
00260
00261
00262
00263
00264
00265
00266
00267
00268
00269
00270
00271
00272
00273
00274
00275
00276
00277
00278
00279
00280
00281
00282
00283
00284
00285
00286
00287
00288
00289
00290
00291
00292
00293
00294
00295
00296
00297
00298
00299
00300
00301
00302
00303
00304
00305
00306
00307
00308
00312 class FARSA_EXPERIMENTS_API TestIndividualGUI : public QWidget
00313 {
00314 Q_OBJECT
00315 private:
00316 TestIndividual* test;
00317 QStringList fileList;
00318 QComboBox* combo;
00319 QListWidget* list;
00320 public:
00321 TestIndividualGUI(TestIndividual* tb, QWidget *parent = NULL, Qt::WindowFlags flags=0);
00322 private slots:
00323 void agentClicked();
00324 void populateCombo();
00325 void seedWasChosen();
00326 };
00327
00328 }
00329
00330 #endif
00331