Changeset 158 in flair-src for trunk/lib/FlairSensorActuator
- Timestamp:
- Mar 5, 2017, 10:50:56 AM (8 years ago)
- Location:
- trunk/lib/FlairSensorActuator/src
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/FlairSensorActuator/src/SimuBldc.cpp
r157 r158 33 33 34 34 SimuBldc::SimuBldc(const IODevice *parent, Layout *layout, string name, 35 uint8_t motors_count, uint32_t dev_id)35 uint8_t motors_count, uint32_t modelId,uint32_t deviceId) 36 36 : Bldc(parent, layout, name, motors_count) { 37 ostringstream dev_name;38 dev_name << "simu_bldc_" << dev_id;39 37 shmem = 40 new SharedMem(this, dev_name.str().c_str(), motors_count * sizeof(float));38 new SharedMem(this, ShMemName(modelId, deviceId), motors_count * sizeof(float)); 41 39 42 40 GroupBox *groupbox = new GroupBox(layout->NewRow(), "simubldc"); … … 47 45 48 46 SimuBldc::SimuBldc(const Object *parent, string name, uint8_t motors_count, 49 uint32_t dev_id)47 uint32_t modelId,uint32_t deviceId) 50 48 : Bldc(parent, name, motors_count) { 51 ostringstream dev_name;52 dev_name << "simu_bldc_" << dev_id;53 49 shmem = 54 new SharedMem(this, dev_name.str().c_str(), motors_count * sizeof(float));50 new SharedMem(this, ShMemName(modelId, deviceId), motors_count * sizeof(float)); 55 51 56 52 // reset values … … 65 61 66 62 SimuBldc::~SimuBldc() {} 63 64 string SimuBldc::ShMemName(uint32_t modelId,uint32_t deviceId) { 65 ostringstream dev_name; 66 dev_name << "simu" << modelId << "_bldc_" << deviceId; 67 return dev_name.str().c_str(); 68 } 67 69 68 70 void SimuBldc::SetMotors(float *value) { -
trunk/lib/FlairSensorActuator/src/SimuBldc.h
r15 r158 46 46 * \param name name 47 47 * \param motors_count number of motors 48 * \param dev_id device id 48 * \param modelId Model id 49 * \param deviceId Bldc id of the Model 49 50 */ 50 51 SimuBldc(const core::IODevice *parent, gui::Layout *layout, std::string name, 51 uint8_t motors_count, uint32_t dev_id);52 uint8_t motors_count, uint32_t modelId,uint32_t deviceId); 52 53 53 54 /*! … … 59 60 * \param name name 60 61 * \param motors_count number of motors 61 * \param dev_id device id 62 * \param modelId Model id 63 * \param deviceId Bldc id of the Model 62 64 */ 63 65 SimuBldc(const core::Object *parent, std::string name, uint8_t motors_count, 64 uint32_t dev_id);66 uint32_t modelId,uint32_t deviceId); 65 67 66 68 /*! … … 107 109 */ 108 110 void SetMotors(float *value); 109 111 112 std::string ShMemName(uint32_t modelId,uint32_t deviceId); 110 113 core::SharedMem *shmem; 111 114 gui::DoubleSpinBox *k; -
trunk/lib/FlairSensorActuator/src/SimuCamera.cpp
r157 r158 33 33 SimuCamera::SimuCamera(string name, 34 34 uint16_t width, uint16_t height, uint8_t channels, 35 uint32_t dev_id, uint8_t priority)35 uint32_t modelId,uint32_t deviceId, uint8_t priority) 36 36 : Thread(getFrameworkManager(), name, priority), 37 37 Camera(name, width, height, cvimage::Type::Format::BGR) { … … 43 43 44 44 ostringstream dev_name; 45 dev_name << "simu _cam_" << dev_id;46 shmem = new SharedMem((Thread *)this, dev_name.str().c_str(), buf_size, SharedMem::Type::producerConsumer);45 dev_name << "simu" << modelId << "_cam_" << deviceId; 46 shmem = new SharedMem((Thread *)this,ShMemName(modelId, deviceId), buf_size, SharedMem::Type::producerConsumer); 47 47 48 48 SetIsReady(true); … … 51 51 //simulation part 52 52 SimuCamera::SimuCamera(const IODevice *parent, string name, uint16_t width, 53 uint16_t height, uint8_t channels, uint32_t dev_id)53 uint16_t height, uint8_t channels, uint32_t modelId,uint32_t deviceId) 54 54 : Thread(parent, name, 0), Camera(parent,name) { 55 55 56 56 buf_size = width * height * channels+sizeof(Time); 57 57 58 ostringstream dev_name; 59 dev_name << "simu_cam_" << dev_id; 60 shmem = new SharedMem((Thread *)this, dev_name.str().c_str(), 58 shmem = new SharedMem((Thread *)this,ShMemName(modelId, deviceId), 61 59 buf_size, SharedMem::Type::producerConsumer); 62 60 shmemReadBuf=NULL; … … 69 67 Join(); 70 68 if(shmemReadBuf!=NULL) delete shmemReadBuf; 69 } 70 71 string SimuCamera::ShMemName(uint32_t modelId,uint32_t deviceId) { 72 ostringstream dev_name; 73 dev_name << "simu" << modelId << "_cam_" << deviceId; 74 return dev_name.str().c_str(); 71 75 } 72 76 -
trunk/lib/FlairSensorActuator/src/SimuCamera.h
r151 r158 42 42 * \param height height 43 43 * \param channels number of channels 44 * \param dev_id device id 44 * \param modelId Model id 45 * \param deviceId Camera id of the Model 45 46 * \param priority priority of the Thread 46 47 */ 47 48 SimuCamera(std::string name, 48 uint16_t width, uint16_t height, uint8_t channels, uint32_t dev_id,49 uint16_t width, uint16_t height, uint8_t channels, uint32_t modelId,uint32_t deviceId, 49 50 uint8_t priority); 50 51 … … 60 61 * \param height height 61 62 * \param channels number of channels 62 * \param dev_id device id 63 * \param modelId Model id 64 * \param deviceId Camera id of the Model 63 65 */ 64 66 SimuCamera(const core::IODevice *parent, std::string name, uint16_t width, 65 uint16_t height, uint8_t channels, uint32_t dev_id);67 uint16_t height, uint8_t channels, uint32_t modelId,uint32_t deviceId); 66 68 67 69 /*! … … 95 97 */ 96 98 void UpdateFrom(const core::io_data *data){}; 99 100 std::string ShMemName(uint32_t modelId,uint32_t deviceId); 97 101 98 102 size_t buf_size; -
trunk/lib/FlairSensorActuator/src/SimuGps.cpp
r157 r158 39 39 40 40 SimuGps::SimuGps(string name, 41 NmeaGps::NMEAFlags_t NMEAFlags, uint32_t deviceId,uint8_t priority)41 NmeaGps::NMEAFlags_t NMEAFlags, uint32_t modelId,uint32_t deviceId,uint8_t priority) 42 42 : NmeaGps(name, NMEAFlags),Thread(getFrameworkManager(), name, priority) { 43 43 … … 49 49 numberOfSatellites = new SpinBox(GetGroupBox()->NewRow(), "number of satellites", 1, 15, 1, 5); 50 50 51 ostringstream dev_name; 52 dev_name << "simu_gps_" << deviceId; 53 shmem = new SharedMem((Thread *)this, dev_name.str().c_str(), 51 shmem = new SharedMem((Thread *)this, ShMemName(modelId, deviceId), 54 52 sizeof(gps_states_t)); 55 53 … … 58 56 59 57 60 SimuGps::SimuGps(const IODevice *parent, string name, uint32_t deviceId)58 SimuGps::SimuGps(const IODevice *parent, string name, uint32_t modelId,uint32_t deviceId) 61 59 : NmeaGps(parent, name), Thread(parent, name, 0) { 62 60 dataRate = NULL; 63 61 64 ostringstream dev_name; 65 dev_name << "simu_gps_" << deviceId; 66 shmem = new SharedMem((Thread *)this, dev_name.str().c_str(), 62 shmem = new SharedMem((Thread *)this,ShMemName(modelId, deviceId), 67 63 sizeof(gps_states_t)); 68 64 … … 73 69 SafeStop(); 74 70 Join(); 71 } 72 73 string SimuGps::ShMemName(uint32_t modelId,uint32_t deviceId) { 74 ostringstream dev_name; 75 dev_name << "simu" << modelId << "_gps_" << deviceId; 76 return dev_name.str().c_str(); 75 77 } 76 78 -
trunk/lib/FlairSensorActuator/src/SimuGps.h
r137 r158 43 43 * \param name name 44 44 * \param NMEAFlags NMEA sentances to enable 45 * \param deviceId device id 45 * \param modelId Model id 46 * \param deviceId Gps id of the Model 46 47 * \param priority priority of the Thread 47 48 */ 48 49 SimuGps(std::string name, 49 NmeaGps::NMEAFlags_t NMEAFlags, uint32_t deviceId,uint8_t priority);50 NmeaGps::NMEAFlags_t NMEAFlags, uint32_t modelId,uint32_t deviceId,uint8_t priority); 50 51 51 52 /*! … … 57 58 * \param parent parent 58 59 * \param name name 59 * \param deviceId device id 60 * \param modelId Model id 61 * \param deviceId Gps id of the Model 60 62 */ 61 SimuGps(const core::IODevice *parent, std::string name, uint32_t deviceId);63 SimuGps(const core::IODevice *parent, std::string name, uint32_t modelId,uint32_t deviceId); 62 64 63 65 /*! … … 92 94 float vn; 93 95 } gps_states_t; 96 97 std::string ShMemName(uint32_t modelId,uint32_t deviceId); 94 98 95 99 core::SharedMem *shmem; -
trunk/lib/FlairSensorActuator/src/SimuImu.cpp
r157 r158 34 34 namespace sensor { 35 35 36 SimuImu::SimuImu(string name, uint32_t dev_id,36 SimuImu::SimuImu(string name, uint32_t modelId,uint32_t deviceId, 37 37 uint8_t priority) 38 38 : Imu(name), Thread(getFrameworkManager(), name, priority) { … … 40 40 new SpinBox(GetGroupBox()->NewRow(), "data rate", " Hz", 1, 500, 1, 200); 41 41 ahrsData = new AhrsData((Imu *)this); 42 43 ostringstream dev_name; 44 dev_name << "simu_imu_" << dev_id; 45 shmem = new SharedMem((Thread *)this, dev_name.str().c_str(), 42 43 shmem = new SharedMem((Thread *)this, ShMemName(modelId, deviceId), 46 44 sizeof(imu_states_t)); 47 45 SetIsReady(true); 48 46 } 49 47 50 SimuImu::SimuImu(const IODevice *parent, string name, uint32_t dev_id)48 SimuImu::SimuImu(const IODevice *parent, string name, uint32_t modelId,uint32_t deviceId) 51 49 : Imu(parent,name), Thread(parent, name, 0) { 52 50 dataRate = NULL; 53 51 54 ostringstream dev_name; 55 dev_name << "simu_imu_" << dev_id; 56 shmem = new SharedMem((Thread *)this, dev_name.str().c_str(), 52 shmem = new SharedMem((Thread *)this, ShMemName(modelId, deviceId), 57 53 sizeof(imu_states_t)); 58 54 SetIsReady(true); … … 62 58 SafeStop(); 63 59 Join(); 60 } 61 62 string SimuImu::ShMemName(uint32_t modelId,uint32_t deviceId) { 63 ostringstream dev_name; 64 dev_name << "simu" << modelId << "_imu_" << deviceId; 65 return dev_name.str().c_str(); 64 66 } 65 67 -
trunk/lib/FlairSensorActuator/src/SimuImu.h
r137 r158 42 42 * 43 43 * \param name name 44 * \param dev_id device id 44 * \param modelId Model id 45 * \param deviceId Imu id of the Model 45 46 * \param priority priority of the Thread 46 47 */ 47 48 SimuImu(std::string name, 48 uint32_t dev_id, uint8_t priority);49 uint32_t modelId,uint32_t deviceId, uint8_t priority); 49 50 50 51 /*! … … 56 57 * \param parent parent 57 58 * \param name name 58 * \param dev_id device id 59 * \param modelId Model id 60 * \param deviceId Imu id of the Model 59 61 */ 60 SimuImu(const core::IODevice *parent, std::string name, uint32_t dev_id);62 SimuImu(const core::IODevice *parent, std::string name, uint32_t modelId,uint32_t deviceId); 61 63 62 64 /*! … … 93 95 float wz; 94 96 } imu_states_t; 97 98 std::string ShMemName(uint32_t modelId,uint32_t deviceId); 95 99 96 100 gui::SpinBox *dataRate; -
trunk/lib/FlairSensorActuator/src/SimuLaser.cpp
r157 r158 33 33 34 34 SimuLaser::SimuLaser(string name, 35 uint32_t dev_id, uint8_t priority)35 uint32_t modelId,uint32_t deviceId, uint8_t priority) 36 36 : Thread(getFrameworkManager(), name, priority), LaserRangeFinder(name) { 37 37 data_rate = 38 38 new SpinBox(GetGroupBox()->NewRow(), "data rate", " Hz", 1, 500, 1, 50); 39 39 40 ostringstream dev_name; 41 dev_name << "simu_Laser_" << dev_id; 42 shmem = new SharedMem((Thread *)this, dev_name.str().c_str(), 40 shmem = new SharedMem((Thread *)this, ShMemName(modelId, deviceId), 43 41 360 * sizeof(float)); 44 42 SetIsReady(true); 45 43 } 46 44 47 SimuLaser::SimuLaser(const IODevice *parent, string name, uint32_t dev_id)45 SimuLaser::SimuLaser(const IODevice *parent, string name, uint32_t modelId,uint32_t deviceId) 48 46 : Thread(parent, name, 0), LaserRangeFinder(parent, name) { 49 47 data_rate = NULL; 50 48 51 ostringstream dev_name; 52 dev_name << "simu_Laser_" << dev_id; 53 shmem = new SharedMem((Thread *)this, dev_name.str().c_str(), 49 shmem = new SharedMem((Thread *)this, ShMemName(modelId, deviceId), 54 50 360 * sizeof(float)); 55 51 SetIsReady(true); … … 59 55 SafeStop(); 60 56 Join(); 57 } 58 59 string SimuLaser::ShMemName(uint32_t modelId,uint32_t deviceId) { 60 ostringstream dev_name; 61 dev_name << "simu" << modelId << "_laser_" << deviceId; 62 return dev_name.str().c_str(); 61 63 } 62 64 -
trunk/lib/FlairSensorActuator/src/SimuLaser.h
r137 r158 41 41 * 42 42 * \param name name 43 * \param dev_id device id 43 * \param modelId Model id 44 * \param deviceId LaserRangeFinder id of the Model 44 45 * \param priority priority of the Thread 45 46 */ 46 47 SimuLaser(std::string name, 47 uint32_t dev_id, uint8_t priority);48 uint32_t modelId,uint32_t deviceId, uint8_t priority); 48 49 49 50 /*! … … 55 56 * \param parent parent 56 57 * \param name name 57 * \param dev_id device id 58 * \param modelId Model id 59 * \param deviceId LaserRangeFinder id of the Model 58 60 */ 59 SimuLaser(const core::IODevice *parent, std::string name, uint32_t dev_id);61 SimuLaser(const core::IODevice *parent, std::string name, uint32_t modelId,uint32_t deviceId); 60 62 61 63 /*! … … 89 91 */ 90 92 void Run(void); 91 93 94 std::string ShMemName(uint32_t modelId,uint32_t deviceId); 92 95 gui::SpinBox *data_rate; 93 96 }; -
trunk/lib/FlairSensorActuator/src/SimuUs.cpp
r157 r158 32 32 namespace sensor { 33 33 34 SimuUs::SimuUs(string name, uint32_t dev_id,34 SimuUs::SimuUs(string name, uint32_t modelId,uint32_t deviceId, 35 35 uint8_t priority) 36 36 : Thread(getFrameworkManager(), name, priority), UsRangeFinder( name) { … … 38 38 new SpinBox(GetGroupBox()->NewRow(), "data rate", " Hz", 1, 500, 1, 50); 39 39 40 ostringstream dev_name; 41 dev_name << "simu_us_" << dev_id; 42 shmem = new SharedMem((Thread *)this, dev_name.str().c_str(), sizeof(float)); 40 shmem = new SharedMem((Thread *)this, ShMemName(modelId, deviceId), sizeof(float)); 43 41 44 42 SetIsReady(true); 45 43 } 46 44 47 SimuUs::SimuUs(const IODevice *parent, string name, uint32_t dev_id)45 SimuUs::SimuUs(const IODevice *parent, string name,uint32_t modelId,uint32_t deviceId) 48 46 : Thread(parent, name, 0), UsRangeFinder(parent,name) { 49 47 data_rate = NULL; 50 48 51 ostringstream dev_name; 52 dev_name << "simu_us_" << dev_id; 53 shmem = new SharedMem((Thread *)this, dev_name.str().c_str(), sizeof(float)); 49 shmem = new SharedMem((Thread *)this, ShMemName(modelId, deviceId), sizeof(float)); 54 50 55 51 SetIsReady(true); … … 59 55 SafeStop(); 60 56 Join(); 57 } 58 59 string SimuUs::ShMemName(uint32_t modelId,uint32_t deviceId) { 60 ostringstream dev_name; 61 dev_name << "simu" << modelId << "_us_" << deviceId; 62 return dev_name.str().c_str(); 61 63 } 62 64 -
trunk/lib/FlairSensorActuator/src/SimuUs.h
r137 r158 41 41 * 42 42 * \param name name 43 * \param dev_id device id 43 * \param modelId Model id 44 * \param deviceId UsRangeFinder id of the Model 44 45 * \param priority priority of the Thread 45 46 */ 46 47 SimuUs(std::string name, 47 uint32_t dev_id, uint8_t priority);48 uint32_t modelId,uint32_t deviceId, uint8_t priority); 48 49 49 50 /*! … … 55 56 * \param parent parent 56 57 * \param name name 57 * \param dev_id device id 58 * \param modelId Model id 59 * \param deviceId UsRangeFinder id of the Model 58 60 */ 59 SimuUs(const core::IODevice *parent, std::string name, uint32_t dev_id);61 SimuUs(const core::IODevice *parent, std::string name, uint32_t modelId,uint32_t deviceId); 60 62 61 63 /*! … … 89 91 */ 90 92 void Run(void); 91 93 94 std::string ShMemName(uint32_t modelId,uint32_t deviceId); 92 95 gui::SpinBox *data_rate; 93 96 };
Note:
See TracChangeset
for help on using the changeset viewer.