From 3152d3d6cf43e0be3e1492f208286280b7cb8ee5 Mon Sep 17 00:00:00 2001 From: Roman Date: Tue, 10 May 2016 10:46:28 +0200 Subject: [PATCH] better function descriptions for rotation classes: - do not talk specifically about body or earth frame, just use frame 1 and frame 2 --- matrix/Dcm.hpp | 23 +++++++++++++++-------- matrix/Euler.hpp | 41 +++++++++++++++++++++++++---------------- matrix/Quaternion.hpp | 28 +++++++++++++++------------- 3 files changed, 55 insertions(+), 37 deletions(-) diff --git a/matrix/Dcm.hpp b/matrix/Dcm.hpp index c5c112d793..0c0e15892c 100644 --- a/matrix/Dcm.hpp +++ b/matrix/Dcm.hpp @@ -3,6 +3,12 @@ * * A direction cosine matrix class. * + * This library uses the convention that premultiplying a three dimensional + * vector represented in coordinate system 1 will apply a rotation from coordinate system + * 1 to coordinate system 2 to the vector. The rotation is performed following the right-hand rule. + * Likewise, a matrix instance of this class also represents a coordinate transformation + * from frame 2 to frame 1. + * * @author James Goppert */ @@ -66,7 +72,7 @@ public: * Constructor from quaternion * * Instance is initialized from quaternion representing - * transformation from inertial frame to body frame. + * coordinate transformation from frame 2 to frame 1. * * @param q quaternion to set dcm to */ @@ -77,10 +83,11 @@ public: /** * Constructor from euler angles * - * Instance is initialized from angle tripplet (3,2,1) representing - * transformation from body frame to inertial frame. + * This sets the transformation matrix from frame 2 to frame 1 where the rotation + * from frame 1 to frame 2 is described by a 3-2-1 intrinsic Tait-Bryan rotation sequence. * - * @param euler euler angles to set dcm to + * + * @param euler euler angle instance */ Dcm(const Euler & euler) { set_from_euler(euler); @@ -91,7 +98,7 @@ public: * Set from quaternion * * Instance is set from quaternion representing - * transformation from inertial frame to body frame. + * transformation from frame 2 to frame 1. * * @param q quaternion to set dcm to */ @@ -119,10 +126,10 @@ public: /** * Set from euler angles * - * Instance is set from angle tripplet (3,2,1) representing - * transformation from body frame to inertial frame. + * This provides the transformation matrix from frame 2 to frame 1 where the rotation + * from frame 1 to frame 2 is described by a 3-2-1 intrinsic Tait-Bryan rotation sequence * - * @param euler euler angles to set dcm to + * @param euler euler angle instannce */ void set_from_euler(const Euler & euler) { Dcm &dcm = *this; diff --git a/matrix/Euler.hpp b/matrix/Euler.hpp index 887749b61e..7ac71aaf9f 100644 --- a/matrix/Euler.hpp +++ b/matrix/Euler.hpp @@ -1,7 +1,12 @@ /** * @file Euler.hpp * - * Euler angle tait-bryan body 3-2-1 + * An instance of this class defines a rotation from coordinate frame 1 to coordinate frame 2. + * It follows the convention of an intrinsic tait-bryan 3-2-1 sequence. + * In order to go from frame 1 to frame 2 we apply the following rotations consecutively. + * 1) We rotate about our initial Z axis by an angle of _psi. + * 2) We rotate about the newly created Y' axis by an angle of _theta. + * 3) We rotate about the newly created X'' axis by an angle of _phi. * * @author James Goppert */ @@ -68,9 +73,9 @@ public: * Instance is initialized from angle tripplet (3,2,1) * representing transformation from body frame to inertial frame. * - * @param phi_ roll - * @param theta_ pitch - * @param psi_ yaw + * @param phi_ rotation angle about X axis + * @param theta_ rotation angle about Y axis + * @param psi_ rotation angle about Z axis */ Euler(Type phi_, Type theta_, Type psi_) : Vector() { @@ -78,26 +83,30 @@ public: } /** - * Constructor from dcm + * Constructor from DCM matrix * - * Instance is initialized from dcm representing transformation - * from body frame to inertial frame. + * Instance is set from Dcm representing + * transformation from frame 2 to frame 1. + * This instance will hold the angles defining the rotation + * from frame 1 to frame 2. * - * @param dcm_ dcm to set angles to - */ + * @param dcm Direction cosine matrix + */ Euler(const Dcm & dcm) : Vector() { set_from_dcm(dcm); } /** - * Constructor from quaternion + * Constructor from quaternion instance. * - * Instance is initialized from quaternion representing - * transformation from body frame to inertial frame. + * Instance is set from a quaternion representing + * transformation from frame 2 to frame 1. + * This instance will hold the angles defining the rotation + * from frame 1 to frame 2. * - * @param q quaternion to set angles to - */ + * @param q quaternion + */ Euler(const Quaternion & q) : Vector() { @@ -108,7 +117,7 @@ public: * Set from euler angles * * Instance is set from angle tripplet (3,2,1) representing - * transformation from body frame to inertial frame. + * rotation from frame 1 to frame 2. * * @param phi_ roll * @param theta_ pitch @@ -125,7 +134,7 @@ public: * Set from dcm * * Instance is set from dcm representing transformation - * from body frame to inertial frame. + * from frame 2 to frame 1. * * @param dcm_ dcm to set angles to */ diff --git a/matrix/Quaternion.hpp b/matrix/Quaternion.hpp index a161b42e22..3f79b1c1f9 100644 --- a/matrix/Quaternion.hpp +++ b/matrix/Quaternion.hpp @@ -71,8 +71,8 @@ public: /** * Constructor from dcm * - * Instance is initialized from a dcm representing transformation - * from inertial frame to body frame. + * Instance is initialized from a dcm representing coordinate transformation + * from frame 2 to frame 1. * * @param dcm dcm to set quaternion to */ @@ -85,10 +85,11 @@ public: /** * Constructor from euler angles * - * Instance is initialized from angle tripplet (3,2,1) representing - * transformation from body frame to inertial frame. + * This sets the instance to a quaternion representing coordinate transformation from + * frame 2 to frame 1 where the rotation from frame 1 to frame 2 is described + * by a 3-2-1 intrinsic Tait-Bryan rotation sequence. * - * @param euler euler angles to set quaternion to + * @param euler euler angle instance */ Quaternion(const Euler & euler) : Vector() @@ -99,8 +100,8 @@ public: /** * Constructor from quaternion values * - * Instance is initialized from quaternion values representing - * transformation from inertial frame to body frame. + * Instance is initialized from quaternion values representing coordinate + * transformation from frame 2 to frame 1. * * @param a set quaternion value 0 * @param b set quaternion value 1 @@ -116,8 +117,8 @@ public: /** * Set from dcm * - * Instance is set from a dcm representing transformation - * from inertial frame to body frame. + * Instance is set from a dcm representing coordinate transformation + * from frame 2 to frame 1. * * @param dcm dcm to set quaternion to */ @@ -137,8 +138,9 @@ public: /** * Set from euler angles * - * Instance is set from angle tripplet (3,2,1) representing - * transformation from body frame to inertial frame. + * This sets the instance to a quaternion representing coordinate transformation from + * frame 2 to frame 1 where the rotation from frame 1 to frame 2 is described + * by a 3-2-1 intrinsic Tait-Bryan rotation sequence. * * @param euler euler angles to set quaternion to */ @@ -164,8 +166,8 @@ public: /** * Set from quaternion values * - * Instance is set from quaternion values representing - * transformation from inertial frame to body frame. + * Instance is set from quaternion values representing coordinate + * transformation from frame 2 to frame 1. * * @param a set quaternion value 0 * @param b set quaternion value 1