worldsim/include/phymarxbot.h

00001 /********************************************************************************
00002  *  WorldSim -- library for robot simulations                                   *
00003  *  Copyright (C) 2012-2013                                                     *
00004  *  Gianluca Massera <emmegian@yahoo.it>                                        *
00005  *  Fabrizio Papi <erkito87@gmail.com>                                          *
00006  *                                                                              *
00007  *  This program is free software; you can redistribute it and/or modify        *
00008  *  it under the terms of the GNU General Public License as published by        *
00009  *  the Free Software Foundation; either version 2 of the License, or           *
00010  *  (at your option) any later version.                                         *
00011  *                                                                              *
00012  *  This program is distributed in the hope that it will be useful,             *
00013  *  but WITHOUT ANY WARRANTY; without even the implied warranty of              *
00014  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               *
00015  *  GNU General Public License for more details.                                *
00016  *                                                                              *
00017  *  You should have received a copy of the GNU General Public License           *
00018  *  along with this program; if not, write to the Free Software                 *
00019  *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA  *
00020  ********************************************************************************/
00021 
00022 #ifndef PHYMARXBOT_H
00023 #define PHYMARXBOT_H
00024 
00025 #include "worldsimconfig.h"
00026 #include "wvector.h"
00027 #include "wmatrix.h"
00028 #include "world.h"
00029 #include "motorcontrollers.h"
00030 #include "sensorcontrollers.h"
00031 #include <QVector>
00032 
00033 namespace farsa {
00034     class PhyObject;
00035     class PhyJoint;
00036     class PhyCylinder;
00037     class PhyFixed;
00038     
00042     class FARSA_WSIM_API PhyMarXbot : public WObject {
00043         Q_OBJECT
00044     public:
00048         PhyMarXbot( World* world, QString name, const wMatrix& tm = wMatrix::identity() );
00051         virtual ~PhyMarXbot();
00053         WheelMotorController* wheelsController() {
00054             return wheelsCtrl;
00055         };
00057         IRSensorController* proximityIRSensorController() {
00058             return proximityIR;
00059         }
00061         IRSensorController* groundBottomIRSensorController() {
00062             return groundBottomIR;
00063         }
00065         IRSensorController* groundAroundIRSensorController() {
00066             return groundAroundIR;
00067         }
00072         virtual void preUpdate();
00077         virtual void postUpdate();
00079         void setProximityIRSensorsGraphicalProperties(bool drawSensor, bool drawRay = false, bool drawRealRay = false);
00081         void setGroundBottomIRSensorsGraphicalProperties(bool drawSensor, bool drawRay = false, bool drawRealRay = false);
00083         void setGroundAroundIRSensorsGraphicalProperties(bool drawSensor, bool drawRay = false, bool drawRealRay = false);
00084     public slots:
00085 
00086     protected:
00088         virtual void changedMatrix();
00089 
00090     private:
00092         PhyObject* base;
00094         QVector<PhyObject*> wheels;
00096         QVector<wMatrix> wheelstm;
00098         QVector<PhyJoint*> wheelJoints;
00100         WheelMotorController* wheelsCtrl;
00102         PhyObject* attachring;
00104         wMatrix attachringtm;
00106         PhyJoint* forcesensor;
00108         SimulatedIRProximitySensorController* proximityIR;
00110         SimulatedIRGroundSensorController* groundBottomIR;
00112         SimulatedIRGroundSensorController* groundAroundIR;
00113     };
00114 } // end namespace farsa
00115 
00116 #endif