00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifdef FARSA_USE_YARP_AND_ICUB
00024
00025 #include "icubsimulatorviewer.h"
00026 #include <QLabel>
00027 #include <QVBoxLayout>
00028 #include <QMenu>
00029 #include <QAction>
00030
00031 using namespace qglviewer;
00032
00033 namespace farsa {
00034
00035 iCubSimulatorViewer::iCubSimulatorViewer( iCubSimulator* icubsim )
00036 : ComponentUI() {
00037 this->icubsimulator = icubsim;
00038 }
00039
00040 iCubSimulatorViewer::~iCubSimulatorViewer() {
00041 }
00042
00043 void iCubSimulatorViewer::fillActionsMenu( QMenu* actionsMenu ) {
00044 actionsMenu->addAction( "Start", icubsimulator, SLOT(start()) );
00045 actionsMenu->addAction( "Suspend", icubsimulator, SLOT(suspend()) );
00046 actionsMenu->addAction( "Step", icubsimulator, SLOT(step()) );
00047 }
00048
00049 QList<ComponentUIViewer> iCubSimulatorViewer::getViewers( QWidget* parent, Qt::WindowFlags flags ) {
00050 renderworld = new RenderWorld( parent );
00051 renderworld->setWorld(icubsimulator->getWorld());
00052 renderworld->setWindowFlags( flags );
00053 wMatrix icubTm = icubsimulator->getICub()->matrix();
00054 wVector cameraDefaultPosition = icubTm.transformVector( wVector( -0.8f, 0.0f, +0.6f ) );
00055 renderworld->camera()->setPosition( Vec( cameraDefaultPosition[0], cameraDefaultPosition[1], cameraDefaultPosition[2] ) );
00056 renderworld->camera()->setUpVector( Vec(0.0f, 0.0f, 1.0f) );
00057 renderworld->camera()->lookAt( Vec( icubTm.w_pos[0], icubTm.w_pos[1], icubTm.w_pos[2] ) );
00058
00059 QList<ComponentUIViewer> viewsList;
00060 viewsList.append( ComponentUIViewer( renderworld, "iCub Simulator", QString(), "3D visualization of the world and the iCub robot" ) );
00061 return viewsList;
00062 }
00063
00064 }
00065
00066 #endif // FARSA_USE_YARP_AND_ICUB