Changeset 198 in flair-src


Ignore:
Timestamp:
09/14/17 15:52:29 (7 years ago)
Author:
Sanahuja Guillaume
Message:

modifs imu

Location:
trunk/lib
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/FlairFilter/src/AhrsComplementaryFilter.cpp

    r197 r198  
    2020#include <Imu.h>
    2121#include <DoubleSpinBox.h>
     22#include <Vector3DSpinBox.h>
    2223#include <GridLayout.h>
    2324#include <ImuData.h>
     
    3637AhrsComplementaryFilter::AhrsComplementaryFilter(const Imu* parent,string name): isInit(false), Ahrs(parent,name) {
    3738
    38     QHat.q0=1;
    39     QHat.q1=0;
    40     QHat.q2=0;
    41     QHat.q3=0;
    42     BHat.x=0;
    43     BHat.y=0;
    44     BHat.z=0;
     39  QHat.q0=1;
     40  QHat.q1=0;
     41  QHat.q2=0;
     42  QHat.q3=0;
     43  BHat.x=0;
     44  BHat.y=0;
     45  BHat.z=0;
    4546
    46     ka[0]=new DoubleSpinBox(parent->GetLayout()->NewRow(),"ka[0]:",0.,10,0.1,2,0.5);
    47     ka[1]=new DoubleSpinBox(parent->GetLayout()->LastRowLastCol(),"ka[1]:",0.,10,0.1,2,0.5);
    48     ka[2]=new DoubleSpinBox(parent->GetLayout()->LastRowLastCol(),"ka[2]:",0.,10.,0.1,2,0.);
     47  ka[0]=new DoubleSpinBox(parent->GetLayout()->NewRow(),"ka[0]:",0.,10,0.1,2,0.5);
     48  ka[1]=new DoubleSpinBox(parent->GetLayout()->LastRowLastCol(),"ka[1]:",0.,10,0.1,2,0.5);
     49  ka[2]=new DoubleSpinBox(parent->GetLayout()->LastRowLastCol(),"ka[2]:",0.,10.,0.1,2,0.);
    4950
    50     kb[0]=new DoubleSpinBox(parent->GetLayout()->NewRow(),"kb[0]:",0.,10,0.1,2,0.01);
    51     kb[1]=new DoubleSpinBox(parent->GetLayout()->LastRowLastCol(),"kb[1]:",0.,10,0.1,2,0.01);
    52     kb[2]=new DoubleSpinBox(parent->GetLayout()->LastRowLastCol(),"kb[2]:",0.,10,0.1,2,0.01);
    53    
    54     km[0]=new DoubleSpinBox(parent->GetLayout()->NewRow(),"km[0]:",0.,10,0.1,2,0.01);
    55     km[1]=new DoubleSpinBox(parent->GetLayout()->LastRowLastCol(),"km[1]:",0.,10,0.1,2,0.01);
    56     km[2]=new DoubleSpinBox(parent->GetLayout()->LastRowLastCol(),"km[2]:",0.,10,0.1,2,0.01);
     51  kb[0]=new DoubleSpinBox(parent->GetLayout()->NewRow(),"kb[0]:",0.,10,0.1,2,0.01);
     52  kb[1]=new DoubleSpinBox(parent->GetLayout()->LastRowLastCol(),"kb[1]:",0.,10,0.1,2,0.01);
     53  kb[2]=new DoubleSpinBox(parent->GetLayout()->LastRowLastCol(),"kb[2]:",0.,10,0.1,2,0.01);
     54
     55  //put km to [0,0,0] to disable magnetometers
     56  km[0]=new DoubleSpinBox(parent->GetLayout()->NewRow(),"km[0]:",0.,50,0.1,2,0.01);
     57  km[1]=new DoubleSpinBox(parent->GetLayout()->LastRowLastCol(),"km[1]:",0.,50,0.1,2,0.01);
     58  km[2]=new DoubleSpinBox(parent->GetLayout()->LastRowLastCol(),"km[2]:",0.,50,0.1,2,0.01);
    5759 
     60  magRef=new Vector3DSpinBox(parent->GetLayout()->NewRow(),"ref magnetic field (uT)",
     61                                 0, 100, 1,
     62                                 3,Vector3Df(20.5324,.2367,43.6682)); //Compiegne, France
    5863  SetIsReady(true);
    5964}
     
    8287    //float kb[3]={0.01,0.01,0.01};
    8388    //float k_m[3]= {0,0,0};
    84 magRef.x=20.8296;
    85 magRef.y=.2095;
    86 magRef.z=43.3333;
     89    magRef=this->magRef->Value();
    8790
    8891    if(isInit==true) {
  • trunk/lib/FlairFilter/src/AhrsComplementaryFilter.h

    r197 r198  
    2424    namespace gui {
    2525        class DoubleSpinBox;
     26        class Vector3DSpinBox;
    2627    }
    2728}
     
    7071            gui::DoubleSpinBox *kb[3];
    7172            gui::DoubleSpinBox *km[3];
     73            gui::Vector3DSpinBox *magRef;
    7274    };
    7375} // end namespace filter
  • 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.