Rotate triaxial vector measurements from one frame to another.


V = rotate_vecs(V,Q)    % Matlab/Octave: p and A are vectors/matrices

V <- rotate_vecs(V, Q)  #R: p and A are vectors/matrices      

Rotate triaxial vector measurements from one frame to another.

Input var Description Units Default value
V is a sensor structure, matrix or vector containing measurements from a triaxial sensor, e.g., an accelerometer, magnetometer or gyroscope. If V is a matrix it should have 3 columns. If V is a single measurement, it will be a 1×3 or 3×1 vector. N/AN/A
Q is a rotation matrix specifying how V is to be rotated. If Q is a single 3×3 matrix, the same rotation is applied to all vectors in V. If Q is a 3x3xn matrix where n is the number of rows of data in V, a different transformation given by Q(:,:,k) is applied to each row of V. Use euler2rotmat to generate a rotation matrix from euler angles. N/AN/A
Output var Description Units
V V is the rotated data with the same size and sampling rate as the input V. If the input was a sensor structure, the output will also be. N/A
  • Frame: This function assumes that the axes of V are consistent with the axes assumed in generating the rotation matrix, i.e., forward-right-up. This function changes the frame of V by rotating it into a new frame. For example if V is in the tag frame and Q is the rotation matrix relating tag and animal frame, then the output will be in the animal frame.

Matlab & Octave

Q = euler2rotmat(pi/180*[25 -60 33]);
V = rotate_vecs([0.77 -0.6 -0.22],Q)
Returns: V=[0.7072,-0.1256,0.6967]

R

x <- (pi / 180) * matrix(c(25, -60, 33), ncol = 3)
Q <- euler2rotmat(x[, 1], x[, 2], x[, 3])
V <- rotate_vecs(c(0.77, -0.6, -0.22), Q)
Returns: V = c(0.7072485, -0.1255922, 0.6966535)

bugs@animaltags.org Last modified: 24 July 2017

  • tagwiki/tools/processing/rotate_vecs.txt
  • Last modified: 2017/08/04 11:33
  • by funkyfinwhale