Changeset 286 in flair-src
- Timestamp:
- Jan 8, 2019, 10:13:03 AM (6 years ago)
- Location:
- trunk
- Files:
-
- 4 added
- 28 edited
- 16 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/demos/CircleFollower/simulator/build_core2_64/bin/simulator_x4.sh
r234 r286 8 8 . $FLAIR_ROOT/flair-dev/scripts/distribution_specific_hack.sh 9 9 10 $EXEC -n x4_0 -t x4 -p 9000 -a 127.0.0.1 -x setup_x4.xml -o 10 0-m $FLAIR_ROOT/flair-bin/models -s $FLAIR_ROOT/flair-bin/models/indoor_flight_arena.xml10 $EXEC -n x4_0 -t x4 -p 9000 -a 127.0.0.1 -x setup_x4.xml -o 10 -m $FLAIR_ROOT/flair-bin/models -s $FLAIR_ROOT/flair-bin/models/indoor_flight_arena.xml -
trunk/lib/FlairFilter/src/SimulatedAhrs.cpp
r285 r286 4 4 // %flair:license} 5 5 // created: 2014/02/07 6 // filename: Simu Ahrs.cpp6 // filename: SimulatedAhrs.cpp 7 7 // 8 8 // author: Guillaume Sanahuja … … 17 17 #ifdef CORE2_64 18 18 19 #include "Simu Ahrs.h"20 #include "Simu Imu.h"19 #include "SimulatedAhrs.h" 20 #include "SimulatedImu.h" 21 21 #include <AhrsData.h> 22 22 … … 28 28 namespace filter { 29 29 30 Simu Ahrs::SimuAhrs(string name, uint32_t modelId,uint32_t deviceId,30 SimulatedAhrs::SimulatedAhrs(string name, uint32_t modelId,uint32_t deviceId, 31 31 uint8_t priority) 32 : Ahrs(new Simu Imu("imu", modelId,deviceId, priority), name) {32 : Ahrs(new SimulatedImu("imu", modelId,deviceId, priority), name) { 33 33 SetIsReady(true); 34 34 } 35 35 36 Simu Ahrs::~SimuAhrs() {}36 SimulatedAhrs::~SimulatedAhrs() {} 37 37 38 // datas from Simu Imu are AhrsData!39 void Simu Ahrs::UpdateFrom(const io_data *data) {38 // datas from SimulatedImu are AhrsData! 39 void SimulatedAhrs::UpdateFrom(const io_data *data) { 40 40 AhrsData *input = (AhrsData *)data; 41 41 AhrsData *output; -
trunk/lib/FlairFilter/src/SimulatedAhrs.h
r285 r286 4 4 // %flair:license} 5 5 /*! 6 * \file Simu Ahrs.h6 * \file SimulatedAhrs.h 7 7 * \brief Class for a simulation Ahrs 8 8 * \author Guillaume Sanahuja, Copyright Heudiasyc UMR UTC/CNRS 7253 … … 19 19 namespace flair { 20 20 namespace filter { 21 /*! \class Simu Ahrs21 /*! \class SimulatedAhrs 22 22 * 23 23 * \brief Class for a simulation Ahrs 24 24 * 25 * This class constructs a Simu Imu as Imu of this Ahrs.25 * This class constructs a SimulatedImu as Imu of this Ahrs. 26 26 */ 27 class Simu Ahrs : public filter::Ahrs {27 class SimulatedAhrs : public filter::Ahrs { 28 28 public: 29 29 /*! … … 35 35 * \param modelId Model id 36 36 * \param deviceId Ahrs id of the Model 37 * \param priority priority of the Simu Imu Thread37 * \param priority priority of the SimulatedImu Thread 38 38 */ 39 Simu Ahrs(std::string name,39 SimulatedAhrs(std::string name, 40 40 uint32_t modelId,uint32_t deviceId, uint8_t priority); 41 41 … … 44 44 * 45 45 */ 46 ~Simu Ahrs();46 ~SimulatedAhrs(); 47 47 48 48 private: -
trunk/lib/FlairMeta/src/MetaVrpnObject.cpp
r214 r286 18 18 19 19 #include "MetaVrpnObject.h" 20 #include "VrpnClient.h"21 20 #include <EulerDerivative.h> 22 21 #include <LowPassFilter.h> … … 38 37 namespace meta { 39 38 40 MetaVrpnObject::MetaVrpnObject(string name )41 : VrpnObject( name, GetVrpnClient()->GetTabWidget()) {42 ConstructorCommon(name );39 MetaVrpnObject::MetaVrpnObject(string name,VrpnClient *client) 40 : VrpnObject( name, client->GetTabWidget(),client) { 41 ConstructorCommon(name,client); 43 42 } 44 43 45 MetaVrpnObject::MetaVrpnObject(std::string name, 46 uint8_t id) 47 : VrpnObject(name, id, GetVrpnClient()->GetTabWidget()) { 48 ConstructorCommon( name); 44 MetaVrpnObject::MetaVrpnObject(std::string name,uint8_t id,VrpnClient *client) 45 : VrpnObject(name, id, client->GetTabWidget(),client) { 46 ConstructorCommon( name,client); 49 47 } 50 48 51 void MetaVrpnObject::ConstructorCommon(string name ) {49 void MetaVrpnObject::ConstructorCommon(string name,VrpnClient *client) { 52 50 cvmatrix_descriptor *desc = new cvmatrix_descriptor(7, 1); 53 51 for (int i = 0; i < desc->Rows(); i++) { … … 57 55 delete desc; 58 56 59 pbas = new LowPassFilter(this, GetVrpnClient()->GetLayout()->NewRow(),57 pbas = new LowPassFilter(this, client->GetLayout()->NewRow(), 60 58 name + " Passe bas", prev_value); 61 59 delete prev_value; … … 68 66 delete desc; 69 67 70 euler = new EulerDerivative(pbas, GetVrpnClient()->GetLayout()->NewRow(),68 euler = new EulerDerivative(pbas, client->GetLayout()->NewRow(), 71 69 name + "_euler", prev_value); 72 70 delete prev_value; … … 79 77 vz_opti_plot->AddCurve(euler->GetMatrix()->Element(6)); 80 78 81 plot_tab = new Tab( GetVrpnClient()->GetTabWidget(), "Mesures (xy) " + name);79 plot_tab = new Tab(client->GetTabWidget(), "Mesures (xy) " + name); 82 80 xy_plot = new DataPlot2D(plot_tab->NewRow(), "xy", "y", -5, 5, "x", -5, 5); 83 81 xy_plot->AddCurve(Output()->Element(5, 0), Output()->Element(4, 0)); -
trunk/lib/FlairMeta/src/MetaVrpnObject.h
r167 r286 15 15 16 16 #include <VrpnObject.h> 17 #include <VrpnClient.h> 17 18 #include <io_data.h> 18 19 #include <Vector3D.h> … … 41 42 class MetaVrpnObject : public sensor::VrpnObject { 42 43 public: 43 MetaVrpnObject(std::string name );44 MetaVrpnObject(std::string name,uint8_t id );44 MetaVrpnObject(std::string name,sensor::VrpnClient *client=sensor::GetVrpnClient()); 45 MetaVrpnObject(std::string name,uint8_t id,sensor::VrpnClient *client=sensor::GetVrpnClient()); 45 46 ~MetaVrpnObject(); 46 47 gui::DataPlot1D *VxPlot(void) const; // 1,0 … … 51 52 52 53 private: 53 void ConstructorCommon(std::string name );54 void ConstructorCommon(std::string name,sensor::VrpnClient *client); 54 55 filter::LowPassFilter *pbas; 55 56 filter::EulerDerivative *euler; -
trunk/lib/FlairMeta/src/SimuX4.cpp
r268 r286 20 20 #include <FrameworkManager.h> 21 21 #include <X4X8Multiplex.h> 22 #include <Simu Imu.h>23 #include <Simu Ahrs.h>24 #include <Simu Bldc.h>25 #include <Simu Us.h>26 #include <Simu Camera.h>27 #include <Simu PressureSensor.h>22 #include <SimulatedImu.h> 23 #include <SimulatedAhrs.h> 24 #include <SimulatedBldc.h> 25 #include <SimulatedUs.h> 26 #include <SimulatedCamera.h> 27 #include <SimulatedPressureSensor.h> 28 28 #include <BatteryMonitor.h> 29 #include <Simu Gps.h>29 #include <SimulatedGps.h> 30 30 #include <Tab.h> 31 31 #include <FindArgument.h> … … 48 48 SetMultiplex(new X4X8Multiplex("motors", X4X8Multiplex::X4)); 49 49 50 SetBldc(new Simu Bldc(GetUavMultiplex(), GetUavMultiplex()->GetLayout(),50 SetBldc(new SimulatedBldc(GetUavMultiplex(), GetUavMultiplex()->GetLayout(), 51 51 "motors", GetUavMultiplex()->MotorsCount(), simu_id,0)); 52 SetUsRangeFinder(new Simu Us("us", simu_id,0, 60));53 SetAhrs(new Simu Ahrs("ahrs", simu_id, 0,70));52 SetUsRangeFinder(new SimulatedUs("us", simu_id,0, 60)); 53 SetAhrs(new SimulatedAhrs("ahrs", simu_id, 0,70)); 54 54 Tab *bat_tab = new Tab(getFrameworkManager()->GetTabWidget(), "battery"); 55 55 SetBatteryMonitor(new BatteryMonitor(bat_tab->NewRow(), "battery")); … … 59 59 ReadCameraResolutionOption(options,"camv",camvWidth,camvHeight); 60 60 Info("using vertical camera resolution: %ix%i\n",camvWidth, camvHeight); 61 SetVerticalCamera(new Simu Camera("simu_cam_v", camvWidth, camvHeight, 3, simu_id,0, 10));61 SetVerticalCamera(new SimulatedCamera("simu_cam_v", camvWidth, camvHeight, 3, simu_id,0, 10)); 62 62 63 63 uint16_t camhWidth=320,camhHeight=240; 64 64 ReadCameraResolutionOption(options,"camh",camhWidth,camhHeight); 65 65 Info("using horizontal camera resolution: %ix%i\n",camhWidth, camhHeight); 66 SetHorizontalCamera(new Simu Camera("simu_cam_h", camhWidth, camhHeight, 3, simu_id,1, 10));66 SetHorizontalCamera(new SimulatedCamera("simu_cam_h", camhWidth, camhHeight, 3, simu_id,1, 10)); 67 67 68 68 string useGps=FindArgument(options,"use_gps=",false); 69 69 if(useGps=="true") { 70 SetGps(new Simu Gps("gps", (NmeaGps::NMEAFlags_t)(NmeaGps::GGA | NmeaGps::VTG), 0,0, 40));70 SetGps(new SimulatedGps("gps", (NmeaGps::NMEAFlags_t)(NmeaGps::GGA | NmeaGps::VTG), 0,0, 40)); 71 71 } 72 72 73 73 string usePressureSensor=FindArgument(options,"use_pressure_sensor=",false); 74 74 if(usePressureSensor=="true") { 75 SetPressureSensor(new Simu PressureSensor("pressuresensor", 0,0, 10));75 SetPressureSensor(new SimulatedPressureSensor("pressuresensor", 0,0, 10)); 76 76 } 77 77 } … … 80 80 81 81 void SimuX4::StartSensors(void) { 82 ((Simu Imu *)(GetAhrs()->GetImu()))->Start();83 ((Simu Us *)GetUsRangeFinder())->Start();84 ((Simu Camera *)GetVerticalCamera())->Start();85 ((Simu Camera *)GetHorizontalCamera())->Start();86 if(GetGps()) ((Simu Gps *)GetGps())->Start();87 if(GetPressureSensor()) ((Simu PressureSensor *)GetPressureSensor())->Start();82 ((SimulatedImu *)(GetAhrs()->GetImu()))->Start(); 83 ((SimulatedUs *)GetUsRangeFinder())->Start(); 84 ((SimulatedCamera *)GetVerticalCamera())->Start(); 85 ((SimulatedCamera *)GetHorizontalCamera())->Start(); 86 if(GetGps()) ((SimulatedGps *)GetGps())->Start(); 87 if(GetPressureSensor()) ((SimulatedPressureSensor *)GetPressureSensor())->Start(); 88 88 } 89 89 -
trunk/lib/FlairMeta/src/SimuX8.cpp
r268 r286 20 20 #include <FrameworkManager.h> 21 21 #include <X4X8Multiplex.h> 22 #include <Simu Imu.h>23 #include <Simu Ahrs.h>24 #include <Simu Bldc.h>25 #include <Simu Us.h>26 #include <Simu Camera.h>27 #include <Simu PressureSensor.h>22 #include <SimulatedImu.h> 23 #include <SimulatedAhrs.h> 24 #include <SimulatedBldc.h> 25 #include <SimulatedUs.h> 26 #include <SimulatedCamera.h> 27 #include <SimulatedPressureSensor.h> 28 28 #include <BatteryMonitor.h> 29 #include <Simu Gps.h>29 #include <SimulatedGps.h> 30 30 #include <Tab.h> 31 31 #include <FindArgument.h> … … 48 48 SetMultiplex(new X4X8Multiplex("motors", X4X8Multiplex::X8)); 49 49 50 SetBldc(new Simu Bldc(GetUavMultiplex(), GetUavMultiplex()->GetLayout(),50 SetBldc(new SimulatedBldc(GetUavMultiplex(), GetUavMultiplex()->GetLayout(), 51 51 "motors", GetUavMultiplex()->MotorsCount(), simu_id,0)); 52 SetUsRangeFinder(new Simu Us("us", simu_id,0, 60));53 SetAhrs(new Simu Ahrs("ahrs", simu_id, 0,70));52 SetUsRangeFinder(new SimulatedUs("us", simu_id,0, 60)); 53 SetAhrs(new SimulatedAhrs("ahrs", simu_id, 0,70)); 54 54 Tab *bat_tab = new Tab(getFrameworkManager()->GetTabWidget(), "battery"); 55 55 SetBatteryMonitor(new BatteryMonitor(bat_tab->NewRow(), "battery")); … … 59 59 ReadCameraResolutionOption(options,"camv",camvWidth,camvHeight); 60 60 Info("using vertical camera resolution: %ix%i\n",camvWidth, camvHeight); 61 SetVerticalCamera(new Simu Camera("simu_cam_v", camvWidth, camvHeight, 3, simu_id,0, 10));61 SetVerticalCamera(new SimulatedCamera("simu_cam_v", camvWidth, camvHeight, 3, simu_id,0, 10)); 62 62 63 63 uint16_t camhWidth=320,camhHeight=240; 64 64 ReadCameraResolutionOption(options,"camh",camhWidth,camhHeight); 65 65 Info("using horizontal camera resolution: %ix%i\n",camhWidth, camhHeight); 66 SetHorizontalCamera(new Simu Camera("simu_cam_h", camhWidth, camhHeight, 3, simu_id,1, 10));66 SetHorizontalCamera(new SimulatedCamera("simu_cam_h", camhWidth, camhHeight, 3, simu_id,1, 10)); 67 67 68 68 string useGps=FindArgument(options,"use_gps=",false); 69 69 if(useGps=="true") { 70 SetGps(new Simu Gps("gps", (NmeaGps::NMEAFlags_t)(NmeaGps::GGA | NmeaGps::VTG), 0,0, 40));70 SetGps(new SimulatedGps("gps", (NmeaGps::NMEAFlags_t)(NmeaGps::GGA | NmeaGps::VTG), 0,0, 40)); 71 71 } 72 72 73 73 string usePressureSensor=FindArgument(options,"use_pressure_sensor=",false); 74 74 if(usePressureSensor=="true") { 75 SetPressureSensor(new Simu PressureSensor("pressuresensor", 0,0, 10));75 SetPressureSensor(new SimulatedPressureSensor("pressuresensor", 0,0, 10)); 76 76 } 77 77 } … … 80 80 81 81 void SimuX8::StartSensors(void) { 82 ((Simu Imu *)(GetAhrs()->GetImu()))->Start();83 ((Simu Us *)GetUsRangeFinder())->Start();84 ((Simu Camera *)GetVerticalCamera())->Start();85 ((Simu Camera *)GetHorizontalCamera())->Start();86 if(GetGps()) ((Simu Gps *)GetGps())->Start();87 if(GetPressureSensor()) ((Simu PressureSensor *)GetPressureSensor())->Start();82 ((SimulatedImu *)(GetAhrs()->GetImu()))->Start(); 83 ((SimulatedUs *)GetUsRangeFinder())->Start(); 84 ((SimulatedCamera *)GetVerticalCamera())->Start(); 85 ((SimulatedCamera *)GetHorizontalCamera())->Start(); 86 if(GetGps()) ((SimulatedGps *)GetGps())->Start(); 87 if(GetPressureSensor()) ((SimulatedPressureSensor *)GetPressureSensor())->Start(); 88 88 } 89 89 -
trunk/lib/FlairSensorActuator/src/SimulatedBldc.cpp
r285 r286 4 4 // %flair:license} 5 5 // created: 2014/02/07 6 // filename: Simu Bldc.cpp6 // filename: SimulatedBldc.cpp 7 7 // 8 8 // author: Guillaume Sanahuja … … 17 17 #ifdef CORE2_64 18 18 19 #include "Simu Bldc.h"19 #include "SimulatedBldc.h" 20 20 #include <FrameworkManager.h> 21 21 #include <GridLayout.h> … … 35 35 namespace actuator { 36 36 37 Simu Bldc::SimuBldc(const IODevice *parent, Layout *layout, string name,37 SimulatedBldc::SimulatedBldc(const IODevice *parent, Layout *layout, string name, 38 38 uint8_t motors_count, uint32_t modelId,uint32_t deviceId) 39 39 : Bldc(parent, layout, name, motors_count) { … … 52 52 } 53 53 54 Simu Bldc::~SimuBldc() {54 SimulatedBldc::~SimulatedBldc() { 55 55 if(buf!=NULL) free(buf); 56 56 } 57 57 58 string Simu Bldc::ShMemName(uint32_t modelId,uint32_t deviceId) {58 string SimulatedBldc::ShMemName(uint32_t modelId,uint32_t deviceId) { 59 59 ostringstream dev_name; 60 60 dev_name << "simu" << modelId << "_bldc_" << deviceId; … … 62 62 } 63 63 64 void Simu Bldc::SetMotors(float *value) {64 void SimulatedBldc::SetMotors(float *value) { 65 65 float *values=(float*)buf; 66 66 for (int i = 0; i < MotorsCount(); i++) values[i] = k->Value() * value[i]; -
trunk/lib/FlairSensorActuator/src/SimulatedBldc.h
r285 r286 4 4 // %flair:license} 5 5 /*! 6 * \file Simu Bldc.h6 * \file SimulatedBldc.h 7 7 * \brief Class for a simulation bldc 8 8 * \author Guillaume Sanahuja, Copyright Heudiasyc UMR UTC/CNRS 7253 … … 11 11 */ 12 12 13 #ifndef SIMU BLDC_H14 #define SIMU BLDC_H13 #ifndef SIMULATEDBLDC_H 14 #define SIMULATEDBLDC_H 15 15 16 16 #include <Bldc.h> … … 30 30 namespace flair { 31 31 namespace actuator { 32 /*! \class Simu Bldc32 /*! \class SimulatedBldc 33 33 * 34 34 * \brief Class for a simulation bldc 35 35 * 36 36 */ 37 class Simu Bldc : public Bldc {37 class SimulatedBldc : public Bldc { 38 38 public: 39 39 /*! 40 40 * \brief Constructor 41 41 * 42 * Construct a Simu Bldc42 * Construct a SimulatedBldc 43 43 * 44 44 * \param parent parent … … 49 49 * \param deviceId Bldc id of the Model 50 50 */ 51 Simu Bldc(const core::IODevice *parent, gui::Layout *layout, std::string name,51 SimulatedBldc(const core::IODevice *parent, gui::Layout *layout, std::string name, 52 52 uint8_t motors_count, uint32_t modelId,uint32_t deviceId); 53 53 … … 56 56 * 57 57 */ 58 ~Simu Bldc();58 ~SimulatedBldc(); 59 59 60 60 /*! … … 95 95 } // end namespace actuator 96 96 } // end namespace flair 97 #endif // SIMU BLDC_H97 #endif // SIMULATEDBLDC_H -
trunk/lib/FlairSensorActuator/src/SimulatedCamera.cpp
r285 r286 4 4 // %flair:license} 5 5 // created: 2014/03/06 6 // filename: Simu Camera.cpp6 // filename: SimulatedCamera.cpp 7 7 // 8 8 // author: Guillaume Sanahuja … … 17 17 #ifdef CORE2_64 18 18 19 #include "Simu Camera.h"19 #include "SimulatedCamera.h" 20 20 #include <FrameworkManager.h> 21 21 #include <GroupBox.h> … … 31 31 namespace sensor { 32 32 33 Simu Camera::SimuCamera(string name,33 SimulatedCamera::SimulatedCamera(string name, 34 34 uint16_t width, uint16_t height, uint8_t channels, 35 35 uint32_t modelId,uint32_t deviceId, uint8_t priority) … … 42 42 output->img->imageData = shmemReadBuf; 43 43 44 ostringstream dev_name;45 dev_name << "simu" << modelId << "_cam_" << deviceId;46 44 shmem = new SharedMem((Thread *)this,ShMemName(modelId, deviceId), buf_size, SharedMem::Type::producerConsumer); 47 45 … … 50 48 51 49 52 Simu Camera::~SimuCamera() {50 SimulatedCamera::~SimulatedCamera() { 53 51 SafeStop(); 54 52 Join(); … … 56 54 } 57 55 58 string Simu Camera::ShMemName(uint32_t modelId,uint32_t deviceId) {56 string SimulatedCamera::ShMemName(uint32_t modelId,uint32_t deviceId) { 59 57 ostringstream dev_name; 60 58 dev_name << "simu" << modelId << "_cam_" << deviceId; … … 62 60 } 63 61 64 void Simu Camera::Run(void) {62 void SimulatedCamera::Run(void) { 65 63 Time time; 66 64 -
trunk/lib/FlairSensorActuator/src/SimulatedCamera.h
r285 r286 4 4 // %flair:license} 5 5 /*! 6 * \file Simu Camera.h6 * \file SimulatedCamera.h 7 7 * \brief Class for a simulation camera 8 8 * \author Guillaume Sanahuja, Copyright Heudiasyc UMR UTC/CNRS 7253 … … 11 11 */ 12 12 13 #ifndef SIMU CAMERA_H14 #define SIMU CAMERA_H13 #ifndef SIMULATEDCAMERA_H 14 #define SIMULATEDCAMERA_H 15 15 16 16 #include <Camera.h> … … 26 26 namespace flair { 27 27 namespace sensor { 28 /*! \class Simu Camera28 /*! \class SimulatedCamera 29 29 * 30 30 * \brief Class for a simulation camera 31 31 */ 32 class Simu Camera : public core::Thread, public Camera {32 class SimulatedCamera : public core::Thread, public Camera { 33 33 public: 34 34 /*! 35 35 * \brief Constructor 36 36 * 37 * Construct a Simu Camera.37 * Construct a SimulatedCamera. 38 38 * It will be child of the FrameworkManager. 39 39 * … … 46 46 * \param priority priority of the Thread 47 47 */ 48 Simu Camera(std::string name,48 SimulatedCamera(std::string name, 49 49 uint16_t width, uint16_t height, uint8_t channels, uint32_t modelId,uint32_t deviceId, 50 50 uint8_t priority); … … 55 55 * 56 56 */ 57 ~Simu Camera();57 ~SimulatedCamera(); 58 58 59 59 protected: … … 89 89 } // end namespace sensor 90 90 } // end namespace flair 91 #endif // SIMU CAMERA_H91 #endif // SIMULATEDCAMERA_H -
trunk/lib/FlairSensorActuator/src/SimulatedGps.cpp
r285 r286 4 4 // %flair:license} 5 5 // created: 2014/05/26 6 // filename: Simu Gps.cpp6 // filename: SimulatedGps.cpp 7 7 // 8 8 // author: Guillaume Sanahuja … … 17 17 #ifdef CORE2_64 18 18 19 #include "Simu Gps.h"19 #include "SimulatedGps.h" 20 20 #include <FrameworkManager.h> 21 21 #include <GpsData.h> … … 38 38 namespace sensor { 39 39 40 Simu Gps::SimuGps(string name,40 SimulatedGps::SimulatedGps(string name, 41 41 NmeaGps::NMEAFlags_t NMEAFlags, uint32_t modelId,uint32_t deviceId,uint8_t priority) 42 42 : NmeaGps(name, NMEAFlags),Thread(getFrameworkManager(), name, priority) { … … 57 57 58 58 59 Simu Gps::~SimuGps() {59 SimulatedGps::~SimulatedGps() { 60 60 SafeStop(); 61 61 Join(); 62 62 } 63 63 64 string Simu Gps::ShMemName(uint32_t modelId,uint32_t deviceId) {64 string SimulatedGps::ShMemName(uint32_t modelId,uint32_t deviceId) { 65 65 ostringstream dev_name; 66 66 dev_name << "simu" << modelId << "_gps_" << deviceId; … … 68 68 } 69 69 70 void Simu Gps::Run(void) {70 void SimulatedGps::Run(void) { 71 71 gps_states_t state; 72 72 char buf[512]; -
trunk/lib/FlairSensorActuator/src/SimulatedGps.h
r285 r286 4 4 // %flair:license} 5 5 /*! 6 * \file Simu Gps.h6 * \file SimulatedGps.h 7 7 * \brief Class for a simulation GPS 8 8 * \author Guillaume Sanahuja, Copyright Heudiasyc UMR UTC/CNRS 7253 … … 11 11 */ 12 12 13 #ifndef S IMUGPS_H14 #define S IMUGPS_H13 #ifndef SimulatedGPS_H 14 #define SimulatedGPS_H 15 15 16 16 #include <Thread.h> … … 29 29 namespace flair { 30 30 namespace sensor { 31 /*! \class Simu Gps31 /*! \class SimulatedGps 32 32 * 33 33 * \brief Class for a simulation GPS 34 34 */ 35 class Simu Gps : public core::Thread, public NmeaGps {35 class SimulatedGps : public core::Thread, public NmeaGps { 36 36 public: 37 37 /*! … … 47 47 * \param priority priority of the Thread 48 48 */ 49 Simu Gps(std::string name,49 SimulatedGps(std::string name, 50 50 NmeaGps::NMEAFlags_t NMEAFlags, uint32_t modelId,uint32_t deviceId,uint8_t priority); 51 51 … … 54 54 * 55 55 */ 56 ~Simu Gps();56 ~SimulatedGps(); 57 57 58 58 private: … … 90 90 } // end namespace sensor 91 91 } // end namespace flair 92 #endif // SIMU GPS_H92 #endif // SIMULATEDGPS_H -
trunk/lib/FlairSensorActuator/src/SimulatedImu.cpp
r285 r286 4 4 // %flair:license} 5 5 // created: 2014/02/07 6 // filename: Simu Imu.cpp6 // filename: SimulatedImu.cpp 7 7 // 8 8 // author: Guillaume Sanahuja … … 17 17 #ifdef CORE2_64 18 18 19 #include "Simu Imu.h"19 #include "SimulatedImu.h" 20 20 #include <FrameworkManager.h> 21 21 #include <ImuData.h> … … 35 35 namespace sensor { 36 36 37 Simu Imu::SimuImu(string name, uint32_t modelId,uint32_t deviceId,37 SimulatedImu::SimulatedImu(string name, uint32_t modelId,uint32_t deviceId, 38 38 uint8_t priority) 39 39 : Imu(name,false), Thread(getFrameworkManager(), name, priority) { … … 47 47 } 48 48 49 Simu Imu::~SimuImu() {49 SimulatedImu::~SimulatedImu() { 50 50 SafeStop(); 51 51 Join(); 52 52 } 53 53 54 string Simu Imu::ShMemName(uint32_t modelId,uint32_t deviceId) {54 string SimulatedImu::ShMemName(uint32_t modelId,uint32_t deviceId) { 55 55 ostringstream dev_name; 56 56 dev_name << "simu" << modelId << "_imu_" << deviceId; … … 58 58 } 59 59 60 void Simu Imu::Run(void) {60 void SimulatedImu::Run(void) { 61 61 imu_states_t state; 62 62 ImuData *imuData; -
trunk/lib/FlairSensorActuator/src/SimulatedImu.h
r285 r286 4 4 // %flair:license} 5 5 /*! 6 * \file Simu Imu.h6 * \file SimulatedImu.h 7 7 * \brief Class for a simulation Imu 8 8 * \author Guillaume Sanahuja, Copyright Heudiasyc UMR UTC/CNRS 7253 … … 11 11 */ 12 12 13 #ifndef SIMU IMU_H14 #define SIMU IMU_H13 #ifndef SIMULATEDIMU_H 14 #define SIMULATEDIMU_H 15 15 16 16 #include <Imu.h> … … 29 29 namespace flair { 30 30 namespace sensor { 31 /*! \class Simu Imu31 /*! \class SimulatedImu 32 32 * 33 33 * \brief Class for a simulation Imu 34 34 */ 35 class Simu Imu : public Imu, public core::Thread {35 class SimulatedImu : public Imu, public core::Thread { 36 36 public: 37 37 /*! 38 38 * \brief Constructor 39 39 * 40 * Construct a Simu Imu.40 * Construct a SimulatedImu. 41 41 * It will be child of the FrameworkManager. 42 42 * … … 46 46 * \param priority priority of the Thread 47 47 */ 48 Simu Imu(std::string name,48 SimulatedImu(std::string name, 49 49 uint32_t modelId,uint32_t deviceId, uint8_t priority); 50 50 … … 53 53 * 54 54 */ 55 ~Simu Imu();55 ~SimulatedImu(); 56 56 57 57 private: … … 97 97 } // end namespace sensor 98 98 } // end namespace flair 99 #endif // SIMU IMU_H99 #endif // SIMULATEDIMU_H -
trunk/lib/FlairSensorActuator/src/SimulatedLaser.cpp
r285 r286 4 4 // %flair:license} 5 5 // created: 2014/02/07 6 // filename: Simu Us.cpp6 // filename: SimulatedUs.cpp 7 7 // 8 8 // author: Guillaume Sanahuja … … 17 17 #ifdef CORE2_64 18 18 19 #include "Simu Laser.h"19 #include "SimulatedLaser.h" 20 20 #include <FrameworkManager.h> 21 21 #include <SpinBox.h> … … 33 33 namespace sensor { 34 34 35 Simu Laser::SimuLaser(string name,35 SimulatedLaser::SimulatedLaser(string name, 36 36 uint32_t modelId,uint32_t deviceId, uint8_t priority) 37 37 : Thread(getFrameworkManager(), name, priority), LaserRangeFinder(name) { … … 44 44 } 45 45 46 Simu Laser::~SimuLaser() {46 SimulatedLaser::~SimulatedLaser() { 47 47 SafeStop(); 48 48 Join(); 49 49 } 50 50 51 string Simu Laser::ShMemName(uint32_t modelId,uint32_t deviceId) {51 string SimulatedLaser::ShMemName(uint32_t modelId,uint32_t deviceId) { 52 52 ostringstream dev_name; 53 53 dev_name << "simu" << modelId << "_laser_" << deviceId; … … 55 55 } 56 56 57 void Simu Laser::Run(void) {57 void SimulatedLaser::Run(void) { 58 58 float z[360]; 59 59 -
trunk/lib/FlairSensorActuator/src/SimulatedLaser.h
r285 r286 4 4 // %flair:license} 5 5 /*! 6 * \file Simu Us.h6 * \file SimulatedUs.h 7 7 * \brief Class for a simulation UsRangeFinder 8 8 * \author Guillaume Sanahuja, Copyright Heudiasyc UMR UTC/CNRS 7253 … … 11 11 */ 12 12 13 #ifndef SIMULA SER_H14 #define SIMULA SER_H13 #ifndef SIMULATEDLASER_H 14 #define SIMULATEDLASER_H 15 15 16 16 #include <LaserRangeFinder.h> … … 28 28 namespace flair { 29 29 namespace sensor { 30 /*! \class Simu Us30 /*! \class SimulatedUs 31 31 * 32 32 * \brief Class for a simulation UsRangeFinder 33 33 */ 34 class Simu Laser : public core::Thread, public LaserRangeFinder {34 class SimulatedLaser : public core::Thread, public LaserRangeFinder { 35 35 public: 36 36 /*! 37 37 * \brief Constructor 38 38 * 39 * Construct a Simu Us.39 * Construct a SimulatedUs. 40 40 * 41 41 * \param name name … … 44 44 * \param priority priority of the Thread 45 45 */ 46 Simu Laser(std::string name,46 SimulatedLaser(std::string name, 47 47 uint32_t modelId,uint32_t deviceId, uint8_t priority); 48 48 … … 51 51 * 52 52 */ 53 ~Simu Laser();53 ~SimulatedLaser(); 54 54 55 55 protected: … … 83 83 } // end namespace sensor 84 84 } // end namespace flair 85 #endif // SIMULA SER_H85 #endif // SIMULATEDLASER_H -
trunk/lib/FlairSensorActuator/src/SimulatedPressureSensor.cpp
r285 r286 4 4 // %flair:license} 5 5 // created: 2018/05/24 6 // filename: Simu PressureSensor.cpp6 // filename: SimulatedPressureSensor.cpp 7 7 // 8 8 // author: Guillaume Sanahuja … … 17 17 #ifdef CORE2_64 18 18 19 #include "Simu PressureSensor.h"19 #include "SimulatedPressureSensor.h" 20 20 #include <FrameworkManager.h> 21 21 #include <SpinBox.h> … … 33 33 namespace sensor { 34 34 35 Simu PressureSensor::SimuPressureSensor(string name, uint32_t modelId,uint32_t deviceId,35 SimulatedPressureSensor::SimulatedPressureSensor(string name, uint32_t modelId,uint32_t deviceId, 36 36 uint8_t priority) 37 37 : Thread(getFrameworkManager(), name, priority), PressureSensor( name) { … … 44 44 } 45 45 46 Simu PressureSensor::~SimuPressureSensor() {46 SimulatedPressureSensor::~SimulatedPressureSensor() { 47 47 SafeStop(); 48 48 Join(); 49 49 } 50 50 51 string Simu PressureSensor::ShMemName(uint32_t modelId,uint32_t deviceId) {51 string SimulatedPressureSensor::ShMemName(uint32_t modelId,uint32_t deviceId) { 52 52 ostringstream dev_name; 53 53 dev_name << "simu" << modelId << "_pressure_" << deviceId; … … 55 55 } 56 56 57 void Simu PressureSensor::Run(void) {57 void SimulatedPressureSensor::Run(void) { 58 58 float p; 59 59 -
trunk/lib/FlairSensorActuator/src/SimulatedPressureSensor.h
r285 r286 4 4 // %flair:license} 5 5 /*! 6 * \file Simu PressureSensor.h6 * \file SimulatedPressureSensor.h 7 7 * \brief Class for a simulation PressureSensor 8 8 * \author Guillaume Sanahuja, Copyright Heudiasyc UMR UTC/CNRS 7253 … … 11 11 */ 12 12 13 #ifndef SIMU PRESSURESENSOR_H14 #define SIMU PRESSURESENSOR_H13 #ifndef SIMULATEDPRESSURESENSOR_H 14 #define SIMULATEDPRESSURESENSOR_H 15 15 16 16 #include <PressureSensor.h> … … 28 28 namespace flair { 29 29 namespace sensor { 30 /*! \class Simu PressureSensor30 /*! \class SimulatedPressureSensor 31 31 * 32 32 * \brief Class for a simulation PressureSensor 33 33 */ 34 class Simu PressureSensor : public core::Thread, public PressureSensor {34 class SimulatedPressureSensor : public core::Thread, public PressureSensor { 35 35 public: 36 36 /*! 37 37 * \brief Constructor 38 38 * 39 * Construct a Simu PressureSensor.39 * Construct a SimulatedPressureSensor. 40 40 * It will be child of the FrameworkManager. 41 41 * … … 45 45 * \param priority priority of the Thread 46 46 */ 47 Simu PressureSensor(std::string name,47 SimulatedPressureSensor(std::string name, 48 48 uint32_t modelId,uint32_t deviceId, uint8_t priority); 49 49 … … 52 52 * 53 53 */ 54 ~Simu PressureSensor();54 ~SimulatedPressureSensor(); 55 55 56 56 protected: … … 84 84 } // end namespace sensor 85 85 } // end namespace flair 86 #endif // SIMU PRESSURESENSOR_H86 #endif // SIMULATEDPRESSURESENSOR_H -
trunk/lib/FlairSensorActuator/src/SimulatedUs.cpp
r285 r286 4 4 // %flair:license} 5 5 // created: 2014/02/07 6 // filename: Simu Us.cpp6 // filename: SimulatedUs.cpp 7 7 // 8 8 // author: Guillaume Sanahuja … … 17 17 #ifdef CORE2_64 18 18 19 #include "Simu Us.h"19 #include "SimulatedUs.h" 20 20 #include <FrameworkManager.h> 21 21 #include <SpinBox.h> … … 33 33 namespace sensor { 34 34 35 Simu Us::SimuUs(string name, uint32_t modelId,uint32_t deviceId,35 SimulatedUs::SimulatedUs(string name, uint32_t modelId,uint32_t deviceId, 36 36 uint8_t priority) 37 37 : Thread(getFrameworkManager(), name, priority), UsRangeFinder( name) { … … 44 44 } 45 45 46 Simu Us::~SimuUs() {46 SimulatedUs::~SimulatedUs() { 47 47 SafeStop(); 48 48 Join(); 49 49 } 50 50 51 string Simu Us::ShMemName(uint32_t modelId,uint32_t deviceId) {51 string SimulatedUs::ShMemName(uint32_t modelId,uint32_t deviceId) { 52 52 ostringstream dev_name; 53 53 dev_name << "simu" << modelId << "_us_" << deviceId; … … 55 55 } 56 56 57 void Simu Us::Run(void) {57 void SimulatedUs::Run(void) { 58 58 float z; 59 59 -
trunk/lib/FlairSensorActuator/src/SimulatedUs.h
r285 r286 4 4 // %flair:license} 5 5 /*! 6 * \file Simu Us.h6 * \file SimulatedUs.h 7 7 * \brief Class for a simulation UsRangeFinder 8 8 * \author Guillaume Sanahuja, Copyright Heudiasyc UMR UTC/CNRS 7253 … … 11 11 */ 12 12 13 #ifndef SIMU US_H14 #define SIMU US_H13 #ifndef SIMULATEDUS_H 14 #define SIMULATEDUS_H 15 15 16 16 #include <UsRangeFinder.h> … … 28 28 namespace flair { 29 29 namespace sensor { 30 /*! \class Simu Us30 /*! \class SimulatedUs 31 31 * 32 32 * \brief Class for a simulation UsRangeFinder 33 33 */ 34 class Simu Us : public core::Thread, public UsRangeFinder {34 class SimulatedUs : public core::Thread, public UsRangeFinder { 35 35 public: 36 36 /*! 37 37 * \brief Constructor 38 38 * 39 * Construct a Simu Us.39 * Construct a SimulatedUs. 40 40 * It will be child of the FrameworkManager. 41 41 * … … 45 45 * \param priority priority of the Thread 46 46 */ 47 Simu Us(std::string name,47 SimulatedUs(std::string name, 48 48 uint32_t modelId,uint32_t deviceId, uint8_t priority); 49 49 … … 52 52 * 53 53 */ 54 ~Simu Us();54 ~SimulatedUs(); 55 55 56 56 protected: … … 84 84 } // end namespace sensor 85 85 } // end namespace flair 86 #endif // SIMU US_H86 #endif // SIMULATEDUS_H -
trunk/lib/FlairSensorActuator/src/VrpnObject.cpp
r214 r286 18 18 #include "VrpnObject.h" 19 19 #include "VrpnObject_impl.h" 20 #include "VrpnClient.h"21 20 #include <string.h> 22 21 #include <Matrix.h> … … 30 29 31 30 VrpnObject::VrpnObject(string name, 32 const TabWidget *tab )33 : IODevice( GetVrpnClient(), name) {34 pimpl_ = new VrpnObject_impl(this, name, -1, tab );31 const TabWidget *tab,VrpnClient *client) 32 : IODevice(client, name) { 33 pimpl_ = new VrpnObject_impl(this, name, -1, tab,client); 35 34 AddDataToLog(pimpl_->output); 36 35 … … 39 38 40 39 VrpnObject::VrpnObject(string name, uint8_t id, 41 const TabWidget *tab )42 : IODevice( GetVrpnClient(), name) {40 const TabWidget *tab,VrpnClient *client) 41 : IODevice(client, name) { 43 42 Warn("Creation of object %s with id %i\n", name.c_str(), id); 44 pimpl_ = new VrpnObject_impl(this, name, id, tab );43 pimpl_ = new VrpnObject_impl(this, name, id, tab,client); 45 44 AddDataToLog(pimpl_->output); 46 45 -
trunk/lib/FlairSensorActuator/src/VrpnObject.h
r214 r286 16 16 17 17 #include <IODevice.h> 18 #include <VrpnClient.h> 18 19 #include <Vector3D.h> 19 20 #include <stdint.h> … … 32 33 33 34 class VrpnObject_impl; 34 class VrpnClient_impl;35 35 36 36 namespace flair { … … 45 45 class VrpnObject : public core::IODevice { 46 46 friend class ::VrpnObject_impl; 47 friend class ::VrpnClient_impl;48 47 49 48 public: … … 55 54 * \param name VRPN object name, should be the same as defined in the server 56 55 * \param tab Tab for the user interface 56 * \param client VrpnClient of the connection, if unspecified, use the default one 57 57 */ 58 58 VrpnObject(std::string name, 59 const gui::TabWidget *tab );59 const gui::TabWidget *tab,sensor::VrpnClient *client=GetVrpnClient()); 60 60 61 61 /*! 62 62 * \brief Constructor 63 63 * 64 * Construct a VrpnObject. Connection is done by IP.64 * Construct a VrpnObject. Connection is done by xbee. 65 65 * 66 66 * \param name name 67 * \param id VRPN object id, should be the same as defined in the server67 * \param id VRPN object id, should be the same as defined in the xbee bridge 68 68 * \param tab Tab for the user interface 69 * \param client VrpnClient of the connection, if unspecified, use the default one 69 70 */ 70 71 VrpnObject(std::string name, uint8_t id, 71 const gui::TabWidget *tab );72 const gui::TabWidget *tab,sensor::VrpnClient *client=GetVrpnClient()); 72 73 73 74 /*! -
trunk/lib/FlairSensorActuator/src/VrpnObject_impl.cpp
r275 r286 40 40 41 41 VrpnObject_impl::VrpnObject_impl(VrpnObject *self, 42 string name, int id, const TabWidget *tab ) {43 parent = GetVrpnClient();42 string name, int id, const TabWidget *tab,VrpnClient *client) { 43 parent = client; 44 44 this->self = self; 45 45 -
trunk/lib/FlairSensorActuator/src/unexported/VrpnObject_impl.h
r223 r286 47 47 VrpnObject_impl(flair::sensor::VrpnObject *self, 48 48 std::string name, 49 int id, const flair::gui::TabWidget *tab );49 int id, const flair::gui::TabWidget *tab,flair::sensor::VrpnClient *client); 50 50 ~VrpnObject_impl(void); 51 51 -
trunk/lib/FlairSimulator/src/Blade.cpp
r15 r286 64 64 } 65 65 66 Blade::Blade(ISceneNode *parent, const vector3df &position, bool inverted, s32 id) 67 : ISceneNode(parent, getGui()->getSceneManager(), id, 68 position) { 69 ISceneManager *mgr = getGui()->getSceneManager(); 70 71 const IGeometryCreator *geo; 72 geo = mgr->getGeometryCreator(); 73 pale = geo->createCubeMesh(vector3df(63.5, 0.5, 5)); 74 75 float angle; 76 if (inverted == false) { 77 angle = 20; 78 } else { 79 angle = -20; 80 } 81 82 ITexture *texture = getGui()->getTexture("carbone.jpg"); 83 pale_1 = new MeshSceneNode(parent, pale, vector3df(-30, 0, 0), 84 vector3df(-angle + 90, 0, 0), texture); 85 pale_1->setParent(this); 86 pale_2 = new MeshSceneNode(parent, pale, vector3df(30, 0, 0), 87 vector3df(angle + 90, 0, 0), texture); 88 pale_2->setParent(this); 89 90 anim = mgr->createRotationAnimator(vector3df(0.f, 0.f, 0.f)); 91 addAnimator(anim); 92 } 93 66 94 void Blade::OnRegisterSceneNode() { 67 95 if (IsVisible) -
trunk/lib/FlairSimulator/src/Blade.h
r15 r286 36 36 const irr::core::vector3df &position = irr::core::vector3df(0, 0, 0), 37 37 bool inverted = false, irr::s32 id = -1); 38 39 Blade(irr::scene::ISceneNode *parent, 40 const irr::core::vector3df &position = irr::core::vector3df(0, 0, 0), 41 bool inverted = false, irr::s32 id = -1); 42 38 43 virtual void OnRegisterSceneNode(void); 39 44 virtual void render(void); -
trunk/lib/FlairSimulator/src/FixedCamera.cpp
r167 r286 27 27 #include <Euler.h> 28 28 29 29 30 using namespace irr; 30 31 using namespace gui; … … 51 52 void FixedCamera::animateNode(ISceneNode *node, u32 timeMs) { 52 53 ICameraSceneNode *camera = static_cast<ICameraSceneNode *>(node); 53 54 54 55 if (LMouseKey == true) { 55 56 if (!Rotating) { -
trunk/lib/FlairSimulator/src/FollowMeCamera.cpp
r70 r286 63 63 64 64 void FollowMeCamera::animateNode(ISceneNode *node, u32 timeMs) { 65 66 65 float nRotY = RotY; 67 66 float nRotZ = RotZ; -
trunk/lib/FlairSimulator/src/GenericObject.cpp
r158 r286 40 40 { 41 41 meshSceneNode=getGui()->getSceneManager()->addMeshSceneNode(mesh); 42 42 /* 43 43 selector = getGui()->getSceneManager()->createTriangleSelector(mesh, meshSceneNode); 44 44 meshSceneNode->setTriangleSelector(selector); 45 45 */ 46 46 meshSceneNode->setMaterialFlag(EMF_LIGHTING, false); 47 47 … … 53 53 ITriangleSelector *GenericObject::TriangleSelector(void) { return selector; } 54 54 55 void GenericObject::setVisible(bool isVisible) { 56 meshSceneNode->setVisible(isVisible); 57 } 55 58 void GenericObject::setScale(float value) { 56 59 meshSceneNode->setScale(vector3df(value, value, value)); -
trunk/lib/FlairSimulator/src/Gui_impl.cpp
r166 r286 94 94 device->setResizable(false); 95 95 96 // font = device->getGUIEnvironment()->getBuiltInFont();97 96 driver = device->getVideoDriver(); 98 97 smgr = device->getSceneManager(); … … 179 178 int lastFPS = -1; 180 179 int cam_id = 0; 180 ITexture* texture=0; 181 IGUIFont* font =0; 182 183 if (!driver->queryFeature(video::EVDF_RENDER_TO_TARGET)) { 184 self->Warn("rendering to texture is not possible, axis will not be displayed\n"); 185 } else { 186 texture= getGui()->getSceneManager()->getVideoDriver()->addRenderTargetTexture(dimension2d<u32>(128,128)); 187 device->getGUIEnvironment()->addImage(texture,position2d<s32>(0,scene_height-texture->getSize().Height)); 188 font = getGui()->getDevice()->getGUIEnvironment()->getFont((media_path+"/font/simu_axis_font.xml").c_str()); 189 } 181 190 182 191 receiver->SetModel(models.at(0)); … … 242 251 driver->setViewPort(core::rect<s32>(0, 0, scene_width, scene_height)); 243 252 smgr->drawAll(); // commente voir plus bas 244 /* 245 env->drawAll(); 246 if (font) 247 { 248 font->draw(L"This demo shows that Irrlicht is also capable 249 of drawing 2D graphics.", 250 core::rect<s32>(130,10,300,50), 251 video::SColor(255,255,255,255)); 252 } 253 else 254 { 255 printf("err\n"); 256 } 257 device->setWindowCaption(L"toto");*/ 258 253 259 254 if (dbtFile_r == NULL) {// mode normal 260 255 for (size_t i = 0; i < models.size(); i++) { … … 263 258 } 264 259 260 //render to texture for axis if possible 261 if (texture) { 262 cameras.at(cam_id)->renderAxisToTexture(texture); 263 } 264 265 //process update for sensors (cam, us...) 266 //also draws embedded cameras (see SimuCameraGL::UpdateFrom) 265 267 for (size_t i = 0; i < models.size(); i++) { 266 268 models.at(i)->ProcessUpdate(NULL); 267 269 } 268 270 269 271 // on fait ca ici, devrait etre un peu plus haut 270 272 // mais a priori souci avec models.at(i)->pimpl_->CheckCollision(); … … 274 276 driver->setViewPort(core::rect<s32>(0, 0, scene_width, scene_height)); 275 277 smgr->drawAll(); 276 278 279 driver->setViewPort(core::rect<s32>(0, 0, smgr->getVideoDriver()->getScreenSize().Width, smgr->getVideoDriver()->getScreenSize().Height)); 280 if(font) { 281 font->draw(L"VRPN:",rect<s32>(10,scene_height-30,100,50),SColor(128,255,255,255)); 282 font->draw(L"X",rect<s32>(60,scene_height-30,100,50),SColor(255,255,0,0)); 283 font->draw(L"Y",rect<s32>(70,scene_height-30,100,50),SColor(255,0,255,0)); 284 font->draw(L"Z",rect<s32>(80,scene_height-30,100,50),SColor(255,0,0,255)); 285 286 } 287 device->getGUIEnvironment()->drawAll(); 277 288 driver->endScene(); 278 289 279 290 int fps = driver->getFPS(); 280 291 -
trunk/lib/FlairSimulator/src/MeshSceneNode.cpp
r15 r286 49 49 } 50 50 51 MeshSceneNode::MeshSceneNode(ISceneNode *parent, IMesh *mesh, 52 const vector3df &position, 53 const vector3df &rotation, ITexture *texture, 54 s32 id) 55 : IMeshSceneNode(parent, getGui()->getSceneManager(), id, 56 position, rotation) { 57 Material.Wireframe = false; 58 Material.Lighting = false; 59 60 setMesh(mesh); 61 62 if (texture != NULL) { 63 setMaterialTexture(0, texture); 64 } 65 66 //parent->getBoundingBox().addInternalBox(getTransformedBoundingBox()); 67 } 68 51 69 void MeshSceneNode::OnRegisterSceneNode(void) { 52 70 if (IsVisible) -
trunk/lib/FlairSimulator/src/MeshSceneNode.h
r15 r286 31 31 const irr::core::vector3df &rotation = irr::core::vector3df(0, 0, 0), 32 32 irr::video::ITexture *texture = NULL, irr::s32 id = -1); 33 34 MeshSceneNode( 35 irr::scene::ISceneNode *parent, irr::scene::IMesh *mesh, 36 const irr::core::vector3df &position = irr::core::vector3df(0, 0, 0), 37 const irr::core::vector3df &rotation = irr::core::vector3df(0, 0, 0), 38 irr::video::ITexture *texture = NULL, irr::s32 id = -1); 33 39 34 40 virtual void OnRegisterSceneNode(void); -
trunk/lib/FlairSimulator/src/SimuBldc.cpp
r224 r286 73 73 } 74 74 75 } // end namespace sensor75 } // end namespace actuator 76 76 } // end namespace flair -
trunk/lib/FlairSimulator/src/Simulator.cpp
r167 r286 36 36 Simulator *getSimulator(void) { return simu; } 37 37 38 Simulator::Simulator(string name, int optitrack_mstime, float yaw_deg )38 Simulator::Simulator(string name, int optitrack_mstime, float yaw_deg, int port) 39 39 : FrameworkManager(name) { 40 40 if (simu != NULL) 41 41 Err("Simulator should be instanced only one time\n"); 42 42 43 pimpl_ = new Simulator_impl(this, optitrack_mstime, yaw_deg );43 pimpl_ = new Simulator_impl(this, optitrack_mstime, yaw_deg,port); 44 44 simu = this; 45 45 } -
trunk/lib/FlairSimulator/src/Simulator.h
r167 r286 44 44 // yaw_deg: rotation of the vrpn coordinate with respect to the earth 45 45 // coordinate, around z axis 46 Simulator(std::string name, int optitrack_mstime = 10, float yaw_deg = 30 );46 Simulator(std::string name, int optitrack_mstime = 10, float yaw_deg = 30, int port=3883); 47 47 ~Simulator(); 48 48 void RunSimu(void); -
trunk/lib/FlairSimulator/src/Simulator_impl.cpp
r218 r286 31 31 32 32 Simulator_impl::Simulator_impl(Simulator *self, int optitrack_mstime, 33 float yaw_deg )34 : vrpn_Connection_IP( ), Thread(self, "simulator", 1) {33 float yaw_deg,int port) 34 : vrpn_Connection_IP(port), Thread(self, "simulator", 1) { 35 35 this->self = self; 36 36 this->optitrack_mstime = optitrack_mstime; -
trunk/lib/FlairSimulator/src/VisualizationCamera.cpp
r70 r286 31 31 using namespace core; 32 32 using namespace scene; 33 using namespace video; 33 34 34 35 namespace flair { … … 40 41 LMouseKey = false; 41 42 42 // camera43 // camera for visualization 43 44 camera = getGui()->getSceneManager()->addCameraSceneNode(); 44 45 camera->setAspectRatio(getGui()->getAspectRatio()); // on force a cause du view port … … 48 49 49 50 getGui()->pimpl_->AddVisualizationCamera(this); 51 52 // camera to draw axis, in a new dedicated scene manager 53 axis_scenemanager=getGui()->getSceneManager()->createNewSceneManager(); 54 axis_camera = axis_scenemanager->addCameraSceneNode(); 55 axis_camera->setAspectRatio(1); // same as texture ratio, TODO: get it from texture in renderAxisToTexture 56 axis_camera->setUpVector(vector3df(0, 0, 1)); 57 axis_camera->setFOV(PI / 2.5f); 58 axis_scenemanager->setActiveCamera(axis_camera); 59 prendre en compte le yaw monde/optitrack (rotation de axis_scenemanager?) 60 IAnimatedMesh* arrowMeshRed = axis_scenemanager->addArrowMesh( "x_axisArrow",video::SColor(255, 255, 0, 0),video::SColor(255, 255, 0, 0)); 61 nodeX = axis_scenemanager->addMeshSceneNode(arrowMeshRed); 62 nodeX->setMaterialFlag(video::EMF_LIGHTING, false); 63 nodeX->setRotation(vector3df(0,0,-90)); 64 nodeX->setScale(vector3df(1,3,1)); 65 66 IAnimatedMesh* arrowMeshGreen = axis_scenemanager->addArrowMesh( "y_axisArrow",video::SColor(255, 0, 255, 0),video::SColor(255, 0, 255, 0)); 67 nodeY = axis_scenemanager->addMeshSceneNode(arrowMeshGreen); 68 nodeY->setMaterialFlag(video::EMF_LIGHTING, false); 69 nodeY->setScale(vector3df(1,3,1)); 70 71 IAnimatedMesh* arrowMeshBlue = axis_scenemanager->addArrowMesh( "z_axisArrow",video::SColor(255, 0, 0, 255),video::SColor(255, 0, 0, 255)); 72 nodeZ = axis_scenemanager->addMeshSceneNode(arrowMeshBlue); 73 nodeZ->setMaterialFlag(video::EMF_LIGHTING, false); 74 nodeZ->setRotation(vector3df(-90,0,0));//irrlicht is left handed, draw a right handed axis 75 nodeZ->setScale(vector3df(1,3,1)); 50 76 } 51 77 52 78 VisualizationCamera::~VisualizationCamera() {} 79 80 void VisualizationCamera::renderAxisToTexture(ITexture* texture) { 81 //put axis at a "normalized" distance 82 vector3df direction=camera->getTarget()-camera->getPosition(); 83 direction.normalize(); 84 nodeX->setPosition(camera->getPosition()+direction*6); 85 nodeY->setPosition(camera->getPosition()+direction*6); 86 nodeZ->setPosition(camera->getPosition()+direction*6); 87 88 axis_camera->setPosition(camera->getPosition()); 89 axis_camera->setRotation(camera->getRotation()); 90 axis_camera->setTarget(camera->getTarget()); 91 92 axis_scenemanager->getVideoDriver()->setRenderTarget(texture, true, true, SColor(0,0,0,0)); 93 axis_scenemanager->drawAll(); 94 axis_scenemanager->getVideoDriver()->setRenderTarget(0, true, true, 0); 95 } 53 96 54 97 std::string VisualizationCamera::getName(void) { -
trunk/lib/FlairSimulator/src/VisualizationCamera.h
r70 r286 27 27 class ICameraSceneNode; 28 28 } 29 namespace video { 30 class ITexture; 31 } 29 32 } 30 33 … … 42 45 irr::scene::ICameraSceneNode *getCameraSceneNode(void); 43 46 std::string getName(void); 47 void renderAxisToTexture(irr::video::ITexture* texture); 44 48 45 49 private: 46 50 virtual bool isEventReceiverEnabled(void) const { return true; } 47 51 irr::scene::ISceneNode *nodeX,*nodeY,*nodeZ; 52 irr::scene::ISceneManager *axis_scenemanager; 53 48 54 protected: 49 55 bool LMouseKey; 50 56 irr::scene::ICameraSceneNode *camera; 57 irr::scene::ICameraSceneNode *axis_camera; 51 58 irr::core::position2df MousePos; 52 59 float currentZoom; -
trunk/lib/FlairSimulator/src/X4.h
r214 r286 43 43 #ifdef GL 44 44 virtual void Draw(void); 45 virtual void ExtraDraw(void){}; 45 virtual void ExtraDraw(void){}; 46 #endif 46 47 47 protected:48 Blade *fl_blade, *fr_blade, *rl_blade, *rr_blade;49 core::Mutex *motor_speed_mutex;50 #endif51 48 private: 52 49 void CalcModel(void); … … 56 53 void WritedbtBuf(char *dbtbuf); 57 54 void ReaddbtBuf(char *dbtbuf); 55 Blade *fl_blade, *fr_blade, *rl_blade, *rr_blade; 56 core::Mutex *motor_speed_mutex; 58 57 #endif 59 58 -
trunk/lib/FlairSimulator/src/X8.h
r214 r286 45 45 46 46 protected: 47 #ifdef GL 48 Blade *tfl_blade, *tfr_blade, *trl_blade, *trr_blade; 49 Blade *bfl_blade, *bfr_blade, *brl_blade, *brr_blade; 50 #endif 47 51 48 private: 52 49 void CalcModel(void); … … 57 54 void ReaddbtBuf(char *dbtbuf); 58 55 core::Mutex *motor_speed_mutex; 56 Blade *tfl_blade, *tfr_blade, *trl_blade, *trr_blade; 57 Blade *bfl_blade, *bfr_blade, *brl_blade, *brr_blade; 59 58 #endif 60 59 -
trunk/lib/FlairSimulator/src/unexported/GenericObject.h
r158 r286 47 47 void setPosition(const irr::core::vector3df& position); 48 48 void setRotation(const irr::core::vector3df& rotation); 49 void setVisible(bool isVisible);//visible by default at construction 49 50 50 51 private: -
trunk/lib/FlairSimulator/src/unexported/Model_impl.h
r218 r286 72 72 void OnRegisterSceneNode(void); 73 73 void render(void); 74 void Draw(void) {75 printf("CA MARCHE PAS PUNAISE\r\n");76 ExtraDraw();77 };78 void ExtraDraw(void) { printf("nope\r\n"); };79 74 80 75 const irr::core::aabbox3d<irr::f32> &getBoundingBox(void) const { -
trunk/lib/FlairSimulator/src/unexported/Simulator_impl.h
r158 r286 37 37 public: 38 38 Simulator_impl(flair::simulator::Simulator *self, int optitrack_mstime = 10, 39 float yaw_deg = 30 );39 float yaw_deg = 30, int port=3883); 40 40 ~Simulator_impl(); 41 41
Note:
See TracChangeset
for help on using the changeset viewer.