Changeset 100 in flair-src for trunk/lib


Ignore:
Timestamp:
Oct 5, 2016, 4:11:18 PM (8 years ago)
Author:
Sanahuja Guillaume
Message:

passage quaternoin 3dmgx3

Location:
trunk/lib
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/FlairCore/src/RotationMatrix.cpp

    r15 r100  
    1919#include "Object.h"
    2020#include "Euler.h"
     21#include "Quaternion.h"
    2122#include "math.h"
    2223
     
    5051}
    5152
     53void RotationMatrix::ToQuaternion(Quaternion &quaternion) const {
     54                quaternion.q0 = 0.5f * sqrtf(1.0f + m[0][0] + m[1][1] + m[2][2]);
     55                quaternion.q1 = 0.5f * sqrtf(1.0f + m[0][0] - m[1][1] - m[2][2]);
     56                quaternion.q2 = 0.5f * sqrtf(1.0f - m[0][0] + m[1][1] - m[2][2]);
     57                quaternion.q3 = 0.5f * sqrtf(1.0f - m[0][0] - m[1][1] + m[2][2]);
     58}
     59
     60Quaternion RotationMatrix::ToQuaternion(void) const {
     61  Quaternion quaternion;
     62  ToQuaternion(quaternion);
     63  return quaternion;
     64}
     65
    5266float &RotationMatrix::operator()(size_t row, size_t col) {
    5367  if (row < 3 && col < 3) {
  • trunk/lib/FlairCore/src/RotationMatrix.h

    r15 r100  
    1818namespace core {
    1919class Euler;
     20class Quaternion;
    2021
    2122/*! \class RotationMatrix
     
    5253  */
    5354  Euler ToEuler(void) const;
     55
     56  /*!
     57  * \brief Convert to quaternion
     58  *
     59  * \param quaternion output quaternion
     60  */
     61  void ToQuaternion(Quaternion &quaternion) const;
     62
     63  /*!
     64  * \brief Convert to quaternion
     65  *
     66  * \return quaternion
     67  */
     68  Quaternion ToQuaternion(void) const;
     69
    5470  /*!
    5571  * \brief matrix
  • trunk/lib/FlairMeta/src/HdsX8.cpp

    r22 r100  
    4848  SetUsRangeFinder(new Srf08(parent, "SRF08", i2cport, 0x70, 60));
    4949  SetAhrs(new Gx3_25_ahrs(parent, "imu", imu_port,
    50                           Gx3_25_imu::EulerAnglesAndAngularRates, 70));
     50                          Gx3_25_imu::AccelerationAngularRateAndOrientationMatrix, 70));
    5151  SetBatteryMonitor(((BlCtrlV2 *)GetBldc())->GetBatteryMonitor());
    5252
  • trunk/lib/FlairMeta/src/XAir.cpp

    r15 r100  
    5151  SetUsRangeFinder(new Srf08(parent, "SRF08", i2cport, 0x70, 60));
    5252  SetAhrs(new Gx3_25_ahrs(parent, "imu", imu_port,
    53                           Gx3_25_imu::EulerAnglesAndAngularRates, 70));
     53                          Gx3_25_imu::AccelerationAngularRateAndOrientationMatrix, 70));
    5454  Tab *bat_tab = new Tab(parent->GetTabWidget(), "battery");
    5555  SetBatteryMonitor(new BatteryMonitor(bat_tab->NewRow(), "battery"));
  • trunk/lib/FlairSensorActuator/src/Gx3_25_imu_impl.cpp

    r15 r100  
    165165      matrix(2, 2) = Dequeue(&buf);
    166166
    167       ahrsData->SetQuaternionAndAngularRates(matrix.ToEuler().ToQuaternion(),
     167      ahrsData->SetQuaternionAndAngularRates(matrix.ToQuaternion(),
    168168                                             filteredAngRates);
    169169      imuData->SetRawAcc(rawAcc);
Note: See TracChangeset for help on using the changeset viewer.