Changeset 198 in flair-src for trunk/lib/FlairSensorActuator


Ignore:
Timestamp:
Sep 14, 2017, 3:52:29 PM (7 years ago)
Author:
Sanahuja Guillaume
Message:

modifs imu

Location:
trunk/lib/FlairSensorActuator/src
Files:
3 edited

Legend:

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

    r187 r198  
    3333namespace sensor {
    3434
    35 Imu::Imu(string name) : IODevice(getFrameworkManager(), name) {
     35Imu::Imu(string name,bool needRotation) : IODevice(getFrameworkManager(), name) {
    3636  imuData = new ImuData(this);
    3737
     
    4141  sensorTab = new Tab(tab, "Reglages");
    4242  setupGroupbox = new GroupBox(sensorTab->NewRow(), name);
    43   rotation = new OneAxisRotation(sensorTab->NewRow(), "post rotation",OneAxisRotation::PostRotation);
     43  if(needRotation) {
     44    rotation = new OneAxisRotation(sensorTab->NewRow(), "post rotation",OneAxisRotation::PostRotation);
     45  } else {
     46    rotation=NULL;
     47  }
    4448  AddDataToLog(imuData);
    4549}
     
    6670
    6771OneAxisRotation *Imu::GetOneAxisRotation(void) const {
     72  if (rotation == NULL) {
     73    Err("not applicable\n");
     74  }
    6875  return rotation;
    6976}
     
    7178void Imu::ApplyRotation(Vector3Df& vector) {
    7279  if (rotation == NULL) {
    73     Err("not applicable for simulation part.\n");
     80    Err("not applicable\n");
    7481    return;
    7582  }
     
    7986void Imu::ApplyRotation(Quaternion& quaternion) {
    8087  if (rotation == NULL) {
    81     Err("not applicable for simulation part.\n");
     88    Err("not applicable\n");
    8289    return;
    8390  }
  • trunk/lib/FlairSensorActuator/src/Imu.h

    r179 r198  
    5353  *
    5454  * \param name name
     55  * \param needRotation true will enable post rotation in GCS. Post rotation must be applied manually in reimplemented code
    5556  */
    56   Imu(std::string name);
     57  Imu(std::string name,bool needRotation=true);
    5758
    5859  /*!
  • trunk/lib/FlairSensorActuator/src/SimuImu.cpp

    r186 r198  
    3636SimuImu::SimuImu(string name, uint32_t modelId,uint32_t deviceId,
    3737                 uint8_t priority)
    38     : Imu(name), Thread(getFrameworkManager(), name, priority) {
     38    : Imu(name,false), Thread(getFrameworkManager(), name, priority) {
    3939  dataRate =
    4040      new SpinBox(GetGroupBox()->NewRow(), "data rate", " Hz", 1, 500, 1, 200);
     
    117117    Vector3Df rawMag(state.mx, state.my, state.mz);
    118118    Vector3Df rawGyr(state.wx, state.wy, state.wz);
     119    //we do not need rotation in simulation
     120    /*
    119121    ApplyRotation(angRate);
    120122    ApplyRotation(quaternion);
    121123    ApplyRotation(rawAcc);
    122124    ApplyRotation(rawMag);
    123     ApplyRotation(rawGyr);
     125    ApplyRotation(rawGyr);*/
    124126    ahrsData->SetQuaternionAndAngularRates(quaternion,angRate);
    125127    imuData->SetRawAccMagAndGyr(rawAcc,rawMag,rawGyr);
Note: See TracChangeset for help on using the changeset viewer.