Ignore:
Timestamp:
Mar 5, 2017, 10:50:56 AM (5 years ago)
Author:
Sanahuja Guillaume
Message:

corrected simu/device id for sensors

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/FlairSensorActuator/src/SimuImu.cpp

    r157 r158  
    3434namespace sensor {
    3535
    36 SimuImu::SimuImu(string name, uint32_t dev_id,
     36SimuImu::SimuImu(string name, uint32_t modelId,uint32_t deviceId,
    3737                 uint8_t priority)
    3838    : Imu(name), Thread(getFrameworkManager(), name, priority) {
     
    4040      new SpinBox(GetGroupBox()->NewRow(), "data rate", " Hz", 1, 500, 1, 200);
    4141  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),
    4644                        sizeof(imu_states_t));
    4745  SetIsReady(true);
    4846}
    4947
    50 SimuImu::SimuImu(const IODevice *parent, string name, uint32_t dev_id)
     48SimuImu::SimuImu(const IODevice *parent, string name, uint32_t modelId,uint32_t deviceId)
    5149    : Imu(parent,name), Thread(parent, name, 0) {
    5250  dataRate = NULL;
    5351
    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),
    5753                        sizeof(imu_states_t));
    5854  SetIsReady(true);
     
    6258  SafeStop();
    6359  Join();
     60}
     61
     62string 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();
    6466}
    6567
Note: See TracChangeset for help on using the changeset viewer.