gui_global.cpp

gehe zur Dokumentation dieser Datei
00001 #include "gui.h"
00002 
00006 Simulation::~Simulation() {
00007    delete (this->pkt);
00008 }
00013 Simulation::Simulation(QApplication *_mainApp) {
00014 
00015    dad = _mainApp;
00016    
00017    this->lg = new SimulationMainWindow (this);
00018    this->sd = new SimulationDialog();
00019 
00020    this->lg->viSpeedSlider->setEnabled(false);
00021    this->lg->ViTab->setEnabled(false);
00022    this->lg->QTab->setEnabled(false);
00023 
00024    // Default-Werte initialisieren
00025    this->lg->viValueTable->setNumRows(0);
00026    this->lg->viValueTable->setNumCols(0);
00027    this->lg->strategyTable->setNumRows(0);
00028    this->lg->strategyTable->setNumCols(0);
00029 
00030    this->lg->viSpeedSlider->setEnabled(false);
00031    this->lg->viGammaInput->setText("0.9");
00032    this->lg->debugLabel->setEnabled(true);
00033    this->lg->numRows->setMaxValue(YMAX);
00034    this->lg->numCols->setMaxValue(XMAX);
00035    this->lg->viLearnWithNN->setEnabled(false);
00036    this->lg->viLearnWithVI->setEnabled(false);
00037    this->lg->viLearnWithNN->setChecked(false);
00038    this->lg->viLearnWithVI->setChecked(false);
00039 
00040    this->pkt = NULL;
00041 
00042    this->tableMutex = new QMutex;
00043    this->debugMutex = new QMutex;
00044    this->guiMutex = new QMutex;
00045    this->guiMutex->unlock();
00046 
00047    DBG();
00048 
00049    lg->show();
00050    this->i_update=0;
00051    this->iMantisse = 0;
00052 
00053    // Timer für die Simulation initialisieren
00054    this->st = new QTimer();
00055    connect(this->st, SIGNAL(timeout()), this, SLOT(simulationWalk()));
00056    this->simuDialog = NULL;
00057    this->simuPos.setX(0);
00058    this->simuPos.setY(0);
00059 
00060         connect(lg->applyButton, SIGNAL(clicked()), this, SLOT(apply_button_clicked()));
00061         connect(lg->applyButtonVI, SIGNAL(clicked()), this, SLOT(apply_button_clicked()));
00062 
00063         connect(lg->viLernenButton, SIGNAL(clicked()), this, SLOT(learn_button_clicked()));
00064         connect(lg->viDeleteButton, SIGNAL(clicked()), this, SLOT(delete_button_clicked()));
00065    connect(lg->viStopButton, SIGNAL(clicked()), this, SLOT(stop_button_clicked()));
00066    connect(lg->viIterationButton, SIGNAL(clicked()), this, SLOT(iteration_button_clicked()));
00067         connect(lg->viLernenButton2, SIGNAL(clicked()), this, SLOT(learn_button_clicked()));
00068         connect(lg->viDeleteButton2, SIGNAL(clicked()), this, SLOT(delete_button_clicked()));
00069    connect(lg->viStopButton2, SIGNAL(clicked()), this, SLOT(stop_button_clicked()));
00070    connect(lg->viIterationButton2, SIGNAL(clicked()), this, SLOT(iteration_button_clicked()));
00071 
00072 
00073    connect(lg->envLoadFileButton, SIGNAL(clicked()), this, SLOT(load_button_clicked()));
00074    connect(lg->envSaveFileButton, SIGNAL(clicked()), this, SLOT(save_button_clicked()));
00075    connect(lg->envSaveMatlabFileButton, SIGNAL(clicked()), this, SLOT(save_matlab_button_clicked()));
00076    connect(lg->envSaveRewardButton, SIGNAL(clicked()), this, SLOT(save_feedback_clicked()));
00077    connect(lg->viLearnWithNN, SIGNAL(clicked()), this, SLOT(learn_method_nn_clicked()));
00078    connect(lg->viLearnWithVI, SIGNAL(clicked()), this, SLOT(learn_method_vi_clicked()));
00079 
00080    // V24 Test
00081    connect(lg->v24StartWalkingButton, SIGNAL(clicked()), this, SLOT(v24_start_walking_button_clicked()));
00082    connect(lg->v24StopWalkingButton, SIGNAL(clicked()), this, SLOT(v24_stop_walking_button_clicked()));
00083    connect(lg->v24StartLearningButton, SIGNAL(clicked()), this, SLOT(v24_start_learning_button_clicked()));
00084    connect(lg->v24CopyStatesAndGammaToRobotButton, SIGNAL(clicked()), this, SLOT(v24_copy_states_and_gamma_to_robot_button_clicked()));
00085    connect(lg->v24GetStatesAndGammaFromRobotButton, SIGNAL(clicked()), this, SLOT(v24_get_states_and_gamma_from_robot_button_clicked()));
00086    connect(lg->v24GetPositionAndModeButton, SIGNAL(clicked()), this, SLOT(v24_getPositionAndMode_button_clicked()));
00087    connect(lg->v24RamtestButton, SIGNAL(clicked()), this, SLOT(v24_ramtest_button_clicked()));
00088    connect(lg->v24ExploreFeedbackButton, SIGNAL(clicked()), this, SLOT(v24_explore_feedback_button_clicked()));
00089    v24 = new V24Control(this->guiMutex, this);
00090    connect(lg->v24AcceptButton, SIGNAL(clicked()), this, SLOT(v24_accept_button_clicked()));
00091    connect(lg->v24GetDistanceButton, SIGNAL(clicked()), this, SLOT(v24_distance_button_clicked()));
00092    connect(lg->v24ResetDistanceButton, SIGNAL(clicked()), this, SLOT(v24_reset_distance_button_clicked()));
00093    connect(lg->v24ExplorationAcceptButton, SIGNAL(clicked()), this, SLOT(v24_exploration_accept_clicked()));
00094    connect(lg->v24GetExplorationButton, SIGNAL(clicked()), this, SLOT(v24_get_exploration_clicked()));
00095    connect(lg->v24ExplorationModeEGreedy, SIGNAL(clicked()), this, SLOT(v24_exploration_mode_changed()));
00096    connect(lg->v24ExplorationModeValueBased, SIGNAL(clicked()), this, SLOT(v24_exploration_mode_changed()));
00097    connect(lg->v24DebugButton, SIGNAL(clicked()), this, SLOT(v24_debug_button_clicked()));
00098    
00099    // Bilder initialisieren
00100    pix[0] = QPixmap ((QString)"pix/0.png");
00101    pix[1] = QPixmap ((QString)"pix/1.png");
00102    pix[2] = QPixmap ((QString)"pix/2.png");
00103    pix[3] = QPixmap ((QString)"pix/3.png");
00104    pix[4] = QPixmap ((QString)"pix/4.png");
00105    pix[5] = QPixmap ((QString)"pix/5.png");
00106 
00107 
00108    // Simulationsdialog
00109    this->lg->stopSimulationButton->setEnabled(false);
00110    this->lg->startSimulationButton->setEnabled(false);
00111    this->lg->resumeSimulationButton->setEnabled(false);  
00112    this->sd->stopSimulationButton->setEnabled(false);
00113    this->sd->startSimulationButton->setEnabled(false);
00114    this->sd->resumeSimulationButton->setEnabled(false);     
00115    connect(lg->startSimulationButton, SIGNAL(clicked()), this, SLOT(start_simulation_clicked()));
00116    connect(lg->stopSimulationButton, SIGNAL(clicked()), this, SLOT(stop_simulation_clicked()));
00117    connect(lg->resumeSimulationButton, SIGNAL(clicked()), this, SLOT(resume_simulation_clicked()));
00118    connect(sd->startSimulationButton, SIGNAL(clicked()), this, SLOT(start_simulation_clicked()));
00119    connect(sd->stopSimulationButton, SIGNAL(clicked()), this, SLOT(stop_simulation_clicked()));
00120    connect(sd->resumeSimulationButton, SIGNAL(clicked()), this, SLOT(resume_simulation_clicked()));
00121 
00122 
00123 }
00124 
00130 void Simulation::debugOutput (QString _d) {
00131 
00132    lg->debugLabel->setText (_d);
00133 }
00134 
00138 void Simulation::stopLearningThread() {
00139    DBG();
00140    if (this->pkt != NULL) {
00141       pkt->setModusFromExtern('p');
00142    }
00143 }
00147 void Simulation::adjust_network_error(double _newError) {
00148    // Debug-Ausgabe
00149    DBG();
00150    printf ("network error automatically adjusted from %f to: %f\n",              this->lg->netDesiredError->text().toDouble(), 
00151       _newError);
00152 
00153    // Textfeld aktualisieren
00154    this->lg->netDesiredError->setText (QString::number(_newError));
00155 }

Erzeugt am Mon Nov 24 15:30:59 2008 für Walking Robot Simulation GUI - API Documentation von  doxygen 1.5.5