Jump to content

  • Log In with Google      Sign In   
  • Create Account

#ActualÁlvaro

Posted 04 April 2013 - 12:30 PM

Say, if we were to implement quatornions, what would be the basic steps used to get an angular velocity? Find the angular displacement vector that is the lowest?

You would take the logarithm of the ratio of the target attitude and the current attitude. This is a quaternion whose real part is 0; the other three components give you the angular velocity that, when applied for 1 second, will convert the current attitude into the target attitude.
#include <iostream>
#include <boost/math/quaternion.hpp>

typedef boost::math::quaternion<double> Q;

int main() {
  Q a(0.0, 1.0, 0.0, 0.0);
  Q b(0.0, 0.0, 1.0, 0.0);

  Q ratio = b / a;
  double scale = std::acos(ratio.R_component_1());
  Q log_of_ratio(0.0,
                 scale * ratio.R_component_2(),
                 scale * ratio.R_component_3(),
                 scale * ratio.R_component_4());

  std::cout << log_of_ratio << '\n';
}


#2Álvaro

Posted 04 April 2013 - 12:29 PM

Say, if we were to implement quatornions, what would be the basic steps used to get an angular velocity? Find the angular displacement vector that is the lowest?

You would take the logarithm of the ratio of the target attitude and the current attitude. This is a quaternion whose real part is 0; the other three components give you the angular velocity that, when applied for 1 second, will convert the current attitude into the target attitude.
#include <iostream>
#include <boost/math/quaternion.hpp>

typedef boost::math::quaternion<double> Q;

int main() {
  Q a(0.0, 1.0, 0.0, 0.0);
  Q b(0.0, 0.0, 1.0, 0.0);

  Q ratio = b / a;
  double scale = std::acos(ratio.R_component_1());
  Q log_of_ratio(0.0,
                 scale * ratio.R_component_2(),
                 scale * ratio.R_component_3(),
                 scale * ratio.R_component_4());

  std::cout << log_of_ratio << '\n';
}


#1Álvaro

Posted 04 April 2013 - 12:29 PM

Say, if we were to implement quatornions, what would be the basic steps used to get an angular velocity? Find the angular displacement vector that is the lowest?

You would take the logarithm of the ratio of the target attitude and the current attitude. This is a quaternion whose real part is 0; the other three components give you the angular velocity that, when applied for 1 second, will convert the current attitude into the target attitude.

PARTNERS