a2pr

Pitch and roll estimation from triaxial accelerometer data.


Matlab & Octave

[p,r] = a2pr(A)		% A is a sensor structure or matrix
        or
[p,r] = a2pr(A,fc)	% A is a sensor structure
	or
[p,r] = a2pr(A,fs,fc)	% A is a matrix

R

list <- a2pr(A)	        # A is a sensor list or matrix
        or
list <- a2pr(A,fc)	# A is a sensor list
	or
list <- a2pr(A,fs,fc)   # A is a matrix

Pitch and roll estimation from triaxial accelerometer data. This is non-iterative estimator with |pitch| constrained to ⇐ 90 degrees. The pitch and roll estimates give the least-square-norm error between A and the A-vector that would be measured at the estimated pitch and roll. If A is in the animal frame, the resulting pitch and roll define the orientation of the animal with respect to its navigation frame. If A is in the tag frame, the pitch and roll will define the tag orientation with respect to its navigation frame.

Input var Description Units
A is a nx3 acceleration matrix with columns [ax ay az]. Acceleration can be in any consistent unit, e.g., g or m/s2. g or m/s2
fs is the sampling rate of the sensor data in Hz (samples per second). This is only needed if A is not a sensor structure and filtering is required. Hz
fc (optional) specifies the cut-off frequency of a low-pass filter to apply to A before computing pitch and roll. The filter cut-off frequency is with respect to 1=Nyquist frequency. The filter length is 8/fc. Filtering adds no group delay. If fc is not specified, no filtering is performed.Hz
Output var Description Units
p is the pitch estimate in radians Radians
r is the roll estimate in radians Radians
  1. Output sampling rate is the same as the input sampling rate.
  2. Frame: This function assumes a [north,east,up] navigation frame and a [forward,right,up] local frame. In these frames, a positive pitch angle is an anti-clockwise rotation around the y-axis. A positive roll angle is a clockwise rotation around the x-axis. A descending animal will have a negative pitch angle while an animal rolled with its right side up will have a positive roll angle.

Matlab & Octave

[p,r] = a2pr([0.77 -0.6 -0.22])
p=0.87806 %radians
r=-1.9222 %radians

R

samplematrix <- matrix(c(0.77, -0.6, -0.22, 0.45, -0.32, 0.99, 0.2, -0.56, 0.5), byrow = TRUE, nrow = 3)
list <- a2pr(samplematrix)
list$p = c(0.8780579, 0.4082165, 0.2603593) #radians
list$r = c(-1.9222411, -0.3126323, -0.8419416) #radians

bugs@animaltags.org Last modified: 10 May 2017

  • tagwiki/tools/processing/a2pr.txt
  • Last modified: 2017/07/28 19:16
  • by das39