Changeset 198 in flair-src
- Timestamp:
- Sep 14, 2017, 3:52:29 PM (7 years ago)
- Location:
- trunk/lib
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/FlairFilter/src/AhrsComplementaryFilter.cpp
r197 r198 20 20 #include <Imu.h> 21 21 #include <DoubleSpinBox.h> 22 #include <Vector3DSpinBox.h> 22 23 #include <GridLayout.h> 23 24 #include <ImuData.h> … … 36 37 AhrsComplementaryFilter::AhrsComplementaryFilter(const Imu* parent,string name): isInit(false), Ahrs(parent,name) { 37 38 38 39 40 41 42 43 44 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; 45 46 46 47 48 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.); 49 50 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); 57 59 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 58 63 SetIsReady(true); 59 64 } … … 82 87 //float kb[3]={0.01,0.01,0.01}; 83 88 //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(); 87 90 88 91 if(isInit==true) { -
trunk/lib/FlairFilter/src/AhrsComplementaryFilter.h
r197 r198 24 24 namespace gui { 25 25 class DoubleSpinBox; 26 class Vector3DSpinBox; 26 27 } 27 28 } … … 70 71 gui::DoubleSpinBox *kb[3]; 71 72 gui::DoubleSpinBox *km[3]; 73 gui::Vector3DSpinBox *magRef; 72 74 }; 73 75 } // end namespace filter -
trunk/lib/FlairSensorActuator/src/Imu.cpp
r187 r198 33 33 namespace sensor { 34 34 35 Imu::Imu(string name ) : IODevice(getFrameworkManager(), name) {35 Imu::Imu(string name,bool needRotation) : IODevice(getFrameworkManager(), name) { 36 36 imuData = new ImuData(this); 37 37 … … 41 41 sensorTab = new Tab(tab, "Reglages"); 42 42 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 } 44 48 AddDataToLog(imuData); 45 49 } … … 66 70 67 71 OneAxisRotation *Imu::GetOneAxisRotation(void) const { 72 if (rotation == NULL) { 73 Err("not applicable\n"); 74 } 68 75 return rotation; 69 76 } … … 71 78 void Imu::ApplyRotation(Vector3Df& vector) { 72 79 if (rotation == NULL) { 73 Err("not applicable for simulation part.\n");80 Err("not applicable\n"); 74 81 return; 75 82 } … … 79 86 void Imu::ApplyRotation(Quaternion& quaternion) { 80 87 if (rotation == NULL) { 81 Err("not applicable for simulation part.\n");88 Err("not applicable\n"); 82 89 return; 83 90 } -
trunk/lib/FlairSensorActuator/src/Imu.h
r179 r198 53 53 * 54 54 * \param name name 55 * \param needRotation true will enable post rotation in GCS. Post rotation must be applied manually in reimplemented code 55 56 */ 56 Imu(std::string name );57 Imu(std::string name,bool needRotation=true); 57 58 58 59 /*! -
trunk/lib/FlairSensorActuator/src/SimuImu.cpp
r186 r198 36 36 SimuImu::SimuImu(string name, uint32_t modelId,uint32_t deviceId, 37 37 uint8_t priority) 38 : Imu(name ), Thread(getFrameworkManager(), name, priority) {38 : Imu(name,false), Thread(getFrameworkManager(), name, priority) { 39 39 dataRate = 40 40 new SpinBox(GetGroupBox()->NewRow(), "data rate", " Hz", 1, 500, 1, 200); … … 117 117 Vector3Df rawMag(state.mx, state.my, state.mz); 118 118 Vector3Df rawGyr(state.wx, state.wy, state.wz); 119 //we do not need rotation in simulation 120 /* 119 121 ApplyRotation(angRate); 120 122 ApplyRotation(quaternion); 121 123 ApplyRotation(rawAcc); 122 124 ApplyRotation(rawMag); 123 ApplyRotation(rawGyr); 125 ApplyRotation(rawGyr);*/ 124 126 ahrsData->SetQuaternionAndAngularRates(quaternion,angRate); 125 127 imuData->SetRawAccMagAndGyr(rawAcc,rawMag,rawGyr);
Note:
See TracChangeset
for help on using the changeset viewer.