Pose Estimator Library

Input to estimator are loaded and processed by +mocapdb.

grBody

+pelib.@grBody.applyTMatrix(obj, pts)

Apply the transformation matrix of grBody to points

Example 1:

out = obj.applyTMatrix(struct('LTIO': [0 0 1 1], 'RFEO': [1 0 0 1]))
% out = struct('LTIO', n x 3, 'RFEO', n x 3)

out.LTIO will contain \(^{W}_{LS}\mathbf{T}\) * pts.LTIO. The same logic applies for the other values (w/ the corresponding body frame) of input cell array pts.

Parameters
  • obj (+pelib.@grBody) – this object instance

  • pts (cell array) – cell array values indicate which body segment (see keys of +pelib.@grBody.grBody.TMap), struct value = 1 x 4 or n x 4 target point (3D homogenous point) wrt reference body

Returns

out - struct of points (n x 3)

Return type

struct

+pelib.@grBody.calcDOri(obj, ref, targetSeg)

Calculate d_ori of lower body grBody as defined in the Marcard paper

T. von Marcard, B. Rosenhahn, M. J. Black, G. P.-M. (2017). Sparse Inertial Poser: Automatic 3D Human Pose Estimation from Sparse IMUs. Eurographics, 36(2)

Parameters
  • obj – this grBody

  • ref – reference grBody to be compared with

  • targetSeg – segments to be computed (usually occluded)

Returns

out - array of d_ori with respect to time

+pelib.@grBody.calcDOrinobias(obj, ref, targetSeg)

Calculate d_ori of lower body grBody as defined in the Marcard paper

T. von Marcard, B. Rosenhahn, M. J. Black, G. P.-M. (2017). Sparse Inertial Poser: Automatic 3D Human Pose Estimation from Sparse IMUs. Eurographics, 36(2)

Parameters
  • obj – this grBody

  • ref – reference grBody to be compared with

  • targetSeg – segments to be computed (usually occluded)

Returns

out1 - array of d_ori no bias with respect to time

Returns

out2 - array of bias

+pelib.@grBody.calcDPos(obj, ref, includeRoot)

Calculate d_pos of lower body grBody as defined in the Marcard paper

T. von Marcard, B. Rosenhahn, M. J. Black, G. P.-M. (2017). Sparse Inertial Poser: Automatic 3D Human Pose Estimation from Sparse IMUs. Eurographics, 36(2)

Parameters
  • obj – this grBody

  • ref – reference grBody to be compared with

  • includeRoot – [boolean] if root/pelvis is included

Returns

out - array of d_pos with respect to time

+pelib.@grBody.calcDistRotm(prox, angles, seq)

Calculate the distal segment orientation rotation matrix

Parameters
  • prox – quaternion orientation (n x 4) of the proximal segment

  • angles – joint angles in seq order

  • seq – (default: YX’Z’’)

Returns

dist - quaternion orientation (n x 4) of the distal segment

+pelib.@grBody.calcJointAcc(obj, pts)

Calculate the joint acceleration of grBody

Example 1:

out = obj.calcJointAcc({'LTIO', 'RFEO'})
% out = struct('LTIO', n x 3, 'RFEO', n x 3)

Example 2:

RFA_p_RF = randn(n, 4); RFA_p_RF(:,4) = 1;
     out = obj.calcJointVel(struct('LTIO': [0 0 1 1], 'RFT': RFA_p_RF))
     % out = struct('LTIO', n x 3, 'RFT', n x 3)

the values in the struct denote the position of target point with respect the corresponding body frame (i.e., \(^{B}_{TP}p\)). For example, out.LTIO will contain the acceleration at point \(^{W}_{LS}\mathbf{T}\) * pts.LTIO where \(^{W}_{LS}\mathbf{T}\) is the transformation matrix of the left shanks wrt world frame and pts.LTIO is the position of the target point wrt the left shank frame, giving us the position of the target point wrt world frame. The same logic applies for the other keys (w/ the corresponding body frame) and values of input struct pts.

Parameters
  • obj (+pelib.@grBody) – this object instance

  • pts (cell array, struct, optional) – cell array values or struct key indicate which body segment (see keys of +pelib.@grBody.grBody.TMap), struct value = 1 x 4 or n x 4 target point (3D homogenous point) wrt reference body, defaults to cell array with all joints

Returns

out - struct of acceleration

Return type

struct

+pelib.@grBody.calcJointAngles(prox, dist, seq)

Calculate distal segment rotation matric from proximal segment and joint angle

Parameters
  • prox – quaternion orientation (n x 4) of the proximal segment

  • theta – joint angle in X, Y, Z axis

  • seq – (default: YX’Z’’)

Returns

theta [x y z] radians

+pelib.@grBody.calcJointVel(obj, pts)

Calculate the joint velocity of grBody

Example 1:

out = obj.calcJointVel({'LTIO', 'RFEO'})
% out = struct('LTIO', n x 3, 'RFEO', n x 3)

Example 2:

RFA_p_RF = randn(n, 4); RFA_p_RF(:,4) = 1;
     out = obj.calcJointVel(struct('LTIO': [0 0 1 1], 'RFT': RFA_p_RF))
     % out = struct('LTIO', n x 3, 'RFT', n x 3)

the values in the struct denote the position(s) of target point with respect the corresponding body frame (i.e., \(^{B}_{TP}p\)). For example, out.LTIO will contain the velocity at point \(^{W}_{LS}\mathbf{T}\) * pts.LTIO where \(^{W}_{LS}\mathbf{T}\) is the transformation matrix of the left shanks wrt world frame and pts.LTIO is the position of the target point wrt the left shank frame, giving us the position of the target point wrt world frame. The same logic applies for the other keys (w/ the corresponding body frame) and values of input struct pts.

Parameters
  • obj (+pelib.@grBody) – this object instance

  • pts (cell array, struct, optional) – cell array values or struct key indicate which body segment (see keys of +pelib.@grBody.grBody.TMap), struct value = 1 x 4 or n x 4 target point (3D homogenous point) wrt reference body, defaults to cell array with all joints

Returns

out - struct of velocities

Return type

struct

+pelib.@grBody.calcKneeAnglesFromMPLARADist(PELV_CS, LTIB_CS, RTIB_CS, dPelvis, dLFemur, dRFemur, dLTibia, dRTibia, dMPLADist, dMPRADist)

Calculate knee angle from 3P dist

Parameters
  • prox – quaternion orientation (n x 4) of the proximal segment

  • angles – joint angles in seq order

  • seq – (default: YX’Z’’)

Returns

dist quaternion orientation (n x 4) of the distal segment

+pelib.@grBody.calcMPLARAdist(obj)

Calculate the midpelvis, left ankle, and right ankle distances of grBody

Example:

out = obj.calcMPLARAdist(100) out = struct(‘MPLA’, n x 1, ‘MPRA’, n x 1, ‘LARA’, n x 1)

Parameters

obj – this grBody

Returns

out struct of distances

+pelib.@grBody.calcProxRotm(dist, angles, seq)

Calculate the proximal segment orientation rotation matrix

Parameters
  • dist – quaternion orientation (n x 4) of the distal segment

  • angles – joint angles in seq order

  • seq – (default: YX’Z’’)

Returns

dist quaternion orientation (n x 4) of the distal segment

+pelib.@grBody.calcRMSEvsTime(obj1, obj2, includeRoot, targetSeg)

Returns the RMSE difference between grBody1 and grBody2 VS time

Parameters
  • obj1 – grBody 1 (self)

  • obj1 – grBody 2 (other)

  • includeRoot – [boolean] if root/pelvis is included

  • targetSeg – segments to be computed (usually occluded)

Returns

out - struct with the difference of pos and ori parameters

+pelib.@grBody.calcSegAngAcc(obj, segs, frame)

Calculate the segment angular acceleration of grBody

Example:

out = obj.calcSegAngAcc({‘LTIB’, ‘RTIB’}) out = struct(‘LTIB’, n x 3, ‘RTIB’, n x 3)

Parameters
  • obj – this grBody

  • seg – cell array of segments to be calculated (if blank: all joints)

  • frame – out is expressed in this frame. B=body (default) or W=world

Returns

out struct of velocities

+pelib.@grBody.calcSegAngVel(obj, segs, frame)

Calculate the segment angular velocity of grBody

Example:

out = obj.calcSegAngVel({‘LTIB’, ‘RTIB’}) out = struct(‘LTIB’, n x 3, ‘RTIB’, n x 3)

Parameters
  • obj – this grBody

  • seg – cell array of segments to be calculated (if blank: all joints)

  • frame – out is expressed in this frame. B=body (default) or W=world

Returns

out struct of velocities

+pelib.@grBody.calcTTD(obj1, obj2, intervals, baseStruct)

Returns the RMSE and Mean difference between grBody1 and grBody2

Parameters
  • obj1 – grBody 1 (self)

  • obj2 – grBody 2 (other, basis)

  • intervals – interval when total distance is calculated

  • baseStruct – [Optional] append input struct if defined

Returns

out - struct with the difference of pos and ori parameters

+pelib.@grBody.calcTTDandStepParams(obj1, obj2, intervals, baseStruct)

Returns the total travelled distance, stride length, and gait speed

Parameters
  • obj1 – grBody 1 (self)

  • obj2 – grBody 2 (other, basis)

  • intervals – interval when total distance is calculated

  • baseStruct – [Optional] append input struct if defined

Returns

out - struct with the error report

+pelib.@grBody.changePosUnit(obj, newUnit, update)

Change position unit of grBody

Example:

out = obj.getSubset(5:100, segAlias);

Parameters
  • obj – class grBody (self)

  • newUnit – new unit

  • update – If true, update this body, else crease new grBody

Returns

out - grBody class whose data only includes the rows in idx

+pelib.@grBody.changeRefFrame(obj, ref)

Change reference frame of grBody Supported changes are vicon -> MIDPEL

Parameters
  • obj – grBody (self)

  • ref – reference frame

Returns

out - struct with the difference of pos and ori parameters

+pelib.@grBody.diff(obj1, obj2, seq)

Returns the difference between grBody1 and grBody2

Parameters
  • obj1 – grBody 1 (self)

  • obj2 – grBody 2 (other)

  • seq – orientation sequence

Returns

out - struct with the difference of pos and ori parameters

+pelib.@grBody.diffRMSE(obj1, obj2, ref, seq)

Returns the RMSE difference between grBody1 and grBody2

Parameters
  • obj1 – grBody 1 (self)

  • obj1 – grBody 2 (other)

  • ref – reference. default: MIDPEL

  • seq – orientation sequence. default: YXZ

Returns

out - struct with the difference of pos and ori parameters

+pelib.@grBody.diffRMSEandMean(obj1, obj2, includeRoot, targetSeg)

Returns the RMSE and Mean difference between grBody1 and grBody2

Parameters
  • obj1 – grBody 1 (self)

  • obj1 – grBody 2 (other)

  • includeRoot – [boolean] if root/pelvis is included

  • targetSeg – segments to be computed (usually occluded)

Returns

out - struct with the difference of pos and ori parameters

+pelib.@grBody.dumpStepParams(obj1, obj2, intervals, fname)

Dump each individual stride length and gait speed to a file

Parameters
  • obj1 – grBody 1 (self)

  • obj2 – grBody 2 (other, basis)

  • intervals – interval when total distance is calculated

  • fname – output step data to files (fname-<posFieldname>.csv)

+pelib.@grBody.exportc3d(obj, fname, sensors, refBody, lsteps, rsteps, extraMarkers, oriMode, spevents)

Generate c3d file

Example:

fname = ‘test.c3d’; sensors = {‘PELVAccX’: (n x 1), ‘PELVAccY’: (n x 1), … }; refBody = actBody;

out = obj.exportc3d(fname, sensors, refBody);

Parameters
  • obj (+pelib.@grBody) – grBody (self)

  • fname – output file name

  • sensors (Optional, struct.) – {‘label’: (n x 1) values to be saved as analog signals … } (e.g. raw acc, gyro, magnetometer)

  • refBody (Optional, +pelib.@grBody or array of +pelib.@grBody) – reference grBody class

  • lsteps (Optional, logical array) – (n x 1) logical where it is true during left foot step detection

  • rsteps (Optional, logical array) – (n x 1) logical where it is true during right foot step detection

  • extraMarkers – [Optional] extra markers of format struct {‘label’: (n x 3) position values

  • oriMode – 01 - refBody axis on refBody. obj axis on obj. 02 - refBody and obj axis on obj. 03 - refBody and obj axis on refBody.

  • oriMode – Optional, integer. Default to 1.

  • spevents – (n x 1) logical when general event happens

  • spevents – Optional, logical array

Returns

acq - handle pointer to new btk c3d

+pelib.@grBody.generateBodyFromJointAngles(posMP, qOriMP, anglesLT, anglesRT, angleLK, angleRK, dPelvis, dLFemur, dRFemur, dLTibia, dRTibia, seq)

Generate grBody from pelvis pos, ori and joint angles

Parameters
  • posMP – pelvis (root) position

  • qOriMP – pelvis (root) orientation

  • anglesLT – left thigh/femur joint angles (X, Y, Z axis)

  • anglesRT – right thigh/femur joint angles (X, Y, Z axis)

  • angleLK – left knee angle (X, Y, Z axis)

  • angleRK – right knee angle (X, Y, Z axis)

  • dPelvis – pelvis length

  • dLFemur – left femur length

  • dRFemur – right femur length

  • dLTibia – left tibia length

  • dRTibia – right tibia length

  • seq – (default: YX’Z’’)

Returns

out new grBody in world frame

+pelib.@grBody.getSubset(obj, idx)

Get subset of grBody

Example:

out = obj.getSubset(5:100, segAlias);

Parameters
  • obj – class grBody (self)

  • idx – indices of data to be included in out

Returns

out grBody class whose data only includes the rows in idx

+pelib.@grBody.getTMatrix(obj, pts, idx)

Calculate the transformation matrix of grBody

Example 1:

out = obj.getTMatrix({'LTIO', 'RFEO'})
% out = struct('LTIO', 4 x 4 x n, 'RFEO', 4 x 4 x n)

out.LTIO will contain the transformation matrix % \(^{W}_{LS}\mathbf{T}\) which containst that orientation of the left shank centered at pts.LTIO The same logic applies for the other values (w/ the corresponding body frame) of input cell array pts.

Example 2:

out = obj.getTMatrix('LTIO', 1:3)
Parameters
  • obj (+pelib.@grBody) – this object instance

  • pts (integer array) – cell array values or characters indicating which body segment (see keys of +pelib.@grBody.grBody.TMap), defaults to cell array with all joints

  • idx – target indices. defaults to 1:obj.nSamples

Returns

out - struct of transformation matrices (4 x 4 x n) or just the transformation matrix

Return type

struct, matrix

class +pelib.@grBody.grBody(varargin)

Bases: matlab.mixin.Copyable

Body class used to animate body and obtain gait parameters

LFEO = None

Left ankle joint center

LFEP = None

Left knee joint center

LTIO = None

Left toe

LTOE = None

Right hip joint center

MIDPEL = None

Left hip joint center

RFEO = None

Right ankle joint center

RFEP = None

Right knee joint center

RTIO = None

Right toe

RTOE = None

pelvis orientation (n x 4), z = upward, x = forward, y = towards left hip joint center

TMap = "struct('MIDPEL', struct('ori', 'qRPV', 'trans', 'MIDPEL'), 'LFEO', struct('ori', 'qLTH', 'trans', 'LFEO'), 'LTIO', struct('ori', 'qLSK', 'trans', 'LTIO'), 'RFEO', struct('ori', 'qRTH', 'trans', 'RFEO'), 'RTIO', struct('ori', 'qRSK', 'trans', 'RTIO'), 'LFT', struct('ori', 'qLFT', 'trans', 'LTIO'), 'RFT', struct('ori', 'qRFT', 'trans', 'RTIO'), 'qRPV', struct('ori', 'qRPV', 'trans', 'MIDPEL'), 'qLTH', struct('ori', 'qLTH', 'trans', 'LFEO'), 'qLSK', struct('ori', 'qLSK', 'trans', 'LTIO'), 'qRTH', struct('ori', 'qRTH', 'trans', 'RFEO'), 'qRSK', struct('ori', 'qRSK', 'trans', 'RTIO'), 'qLFT', struct('ori', 'qLFT', 'trans', 'LTIO'), 'qRFT', struct('ori', 'qRFT', 'trans', 'RTIO') )"
axisScale = '0.25'
calcJointAnglesLAnkle(idx)

Calculate left ankle joint angles (seq: YXZ)

Parameters
  • obj – this object class

  • idx – [OPTIONAL] index to be calculated (default: all)

Returns

theta - joint angles (n x 3)

calcJointAnglesLHip(idx)

Calculate left hip joint angles (seq: YXZ)

Parameters
  • obj – this object class

  • idx – [OPTIONAL] index to be calculated (default: all)

Returns

theta - joint angles (n x 3)

calcJointAnglesLKnee(idx)

Calculate left knee joint angles (seq: YXZ)

Parameters
  • obj – this object class

  • idx – [OPTIONAL] index to be calculated (default: all)

Returns

theta - joint angles (n x 3)

calcJointAnglesRAnkle(idx)

Calculate right ankle joint angles (seq: YXZ)

Parameters
  • obj – this object class

  • idx – [OPTIONAL] index to be calculated (default: all)

Returns

theta - joint angles (n x 3)

calcJointAnglesRHip(idx)

Calculate right hip joint angles (seq: YXZ)

Parameters
  • obj – this object class

  • idx – [OPTIONAL] index to be calculated (default: all)

Returns

theta - joint angles (n x 3)

calcJointAnglesRKnee(idx)

Calculate right knee joint angles (seq: YXZ)

Parameters
  • obj – this object class

  • idx – [OPTIONAL] index to be calculated (default: all)

Returns

theta - joint angles (n x 3)

calcLFemurLength(idx)

Calculate left femur length

Parameters
  • obj – this object class

  • idx – [OPTIONAL] index to be calculated (default: 1)

Returns

d - body segment length (n x 1)

calcLFootLength(idx)

Calculate left foot length

Parameters
  • obj – this object class

  • idx – [OPTIONAL] index to be calculated (default: 1)

Returns

d - body segment length (n x 1)

calcLShankLength(idx)

Calculate left shank length

Parameters
  • obj – this object class

  • idx – [OPTIONAL] index to be calculated (default: 1)

Returns

d - body segment length (n x 1)

calcPelvisLength(idx)

Calculate pelvis length

Parameters
  • obj – this object class

  • idx – [OPTIONAL] index to be calculated (default: 1)

Returns

d - body segment length (n x 1)

calcRFemurLength(idx)

Calculate right femur length

Parameters
  • obj – this object class

  • idx – [OPTIONAL] index to be calculated (default: 1)

Returns

d - body segment length (n x 1)

calcRFootLength(idx)

Calculate right foot length

Parameters
  • obj – this object class

  • idx – [OPTIONAL] index to be calculated (default: 1)

Returns

d - body segment length (n x 1)

calcRShankLength(idx)

Calculate right shank length

Parameters
  • obj – this object class

  • idx – [OPTIONAL] index to be calculated (default: 1)

Returns

d - body segment length (n x 1)

frame = None

full trial start index

fs = '60'
ftEndIndex = 'inf'
ftStartIndex = '1'
grBody(varargin)

Class constructor

Parameters

varargin – param1 (string), val1, param2 (string), val2, …

Returns

instance of Body class.

groundCoordinates()

xVector = obj.RTIO(1,:) - obj.LTIO(1,:); xVector = xVector / norm(xVector);

lnSymbol = "'-'"
nSamples = None

sampling frequency

name = None

number of samples

obj()
oriList = "{'qRPV', 'qRTH', 'qLTH', 'qRSK', 'qLSK', 'qRFT', 'qLFT'}"
oriUnit = "'deg'"
posList = "{'MIDPEL', 'LFEP', 'LFEO', 'LTIO', 'LTOE', 'RFEP', 'RFEO', 'RTIO', 'RTOE'}"
posUnit = "'mm'"
ptSymbol = "'.'"
qLFT = None
qLSK = None

right foot orientation (n x 4) following Vicon convention, z = toe to ankle joint center, x = downward, y = towards left, tibia y axis

qLTH = None

right tibia orientation (n x 4), z = along tibia, x = forward, y towards left

qRFT = None

left foot orientation (n x 4) following Vicon convention, z = toe to ankle joint center, x = downward, y = towards left, tibia y axis

qRPV = None

right femur orientation (n x 4), z = along thigh, x = forward, y towards left

qRSK = None

left tibia orientation (n x 4), z = along tibia, x = forward, y towards left

qRTH = None

left femur orientation (n x 4), z = along thigh, x = forward, y towards left

rplColor = "{'r', 'g', 'b'}"
xlim()
xyzColor = "{'r', 'g', 'b'}"
ylim()
zlim()
+pelib.@grBody.repelem(obj, n)

Replicate the elements of grBody

Parameters
  • obj – class grBody (self)

  • n – Each element of obj is repeated n (scalar) times. The new length will be length(obj.element)*n.

Returns

out grBody class whose element is repeated n times

+pelib.@grBody.toWorldFrame(obj, pos, ori)

Change reference frame of grBody from MIDPEL frame to world frame Supported changes are vicon -> MIDPEL

Parameters
  • obj – grBody (self)

  • pos – pelvis (root) position

  • ori – pelvis (root) orientation

Returns

out - new grBody in world frame

+pelib.@grBody.translateRoot(obj, pos)

Translate body

Parameters
  • obj – grBody (self)

  • pos – 3d translation

Returns

out - new grBody in world frame

%rtype: +pelib.@grBody

est

+pelib.+est.ckf_3imus(x0, P0, gfrAccMP, bIsStatMP, qMP, gfrAccLA, bIsStatLA, qLA, gfrAccRA, bIsStatRA, qRA, dPelvis, dLFemur, dRFemur, dLTibia, dRTibia, options)

Constrained Kalman Filter for performing sensor fusion on the trajectory of three KMUs presumably worn on the body in the following configuration: mid pelvis, left ankle, right ankle In this state space model, the position and velocity of each kinematic measurement unit (KMU) is estimated in 3D space by combining the information from each KMU in a kalman filter. NOTE: pay special attention to units:; position (meters) velocity (m/s) acceleration (m/2^2)

param x0

the initial state in the GFR

param gfrAccMP

the acceleration of the mid-pelvis in the GFR

param gfrAccLA

the acceleration of the left ankle in the GFR

param gfrAccRA

the acceleration of the right ankle in the GFR

param bIsStatMP

a boolean vector, for whichever timepoints, n(i) are true, i.e., bMoving_MP(i) == 1, a zero velocity update will be performed by using psuedo-zero velocity measurements

param bIsStatLA

a boolean vector, for whichever timepoints, n(i) are true, i.e., bMoving_LA(i) == 1, a zero velocity update will be performed by using psuedo-zero velocity measurements

param bIsStatRA

a boolean vector, for whichever timepoints, n(i) are true, i.e., bMoving_RA(i) == 1, a zero velocity update will be performed by using psuedo-zero velocity measurements

param qMP

mid pelvis orientation in the GFR (quaternion)

param qLA

left ankle orientation in the GFR (quaternion)

param qRA

right ankle orientation in the GFR (quaternion)

param dPelvis

pelvis width

param dRFemur

right femur length

param dLFemur

left femur length

param dRTibia

right tibia length

param dLTibia

left tibia length

viz

+pelib.+viz.UKF_Rel_LPVA_plot(N_MP, fs, actBody, estBody, pIntS, plotRes)

close all

+pelib.+viz.UKF_plotAccel(pIntS, tru_Acc_GFR, est_Acc_GFR, N_MP, fs)
+pelib.+viz.animViconMarkersV2(varargin)

Quickly visualise the vicon markers @author

Source: https://github.com/mikedelr/Vicon-2-MATLAB-tools/blob/master/animViconMarkersV2.m

Example usage:

animViconMarkers(‘markerData’,markerData,’markerSet’,markerSet)

Parameters
  • bodys – Body instance(s) to be plotted

  • parts – String(s) of body point(s) to be plotted.

  • markerData – struct with fields

+pelib.+viz.plotChainSegments(Ts, p)

Suppose Ts = [T_1, T_2, T_3, ….] where T_i is a 4 x 4 homogenous matrix

This function draws line between the translation components of T_1, T_1*T_2, T_1*T_2*T_3, …

Parameters
  • Ts – 4 x 4 x n array of homogenenous matrices

  • p – [Optional] plot object, if available, will only update the line instead of creating a new one

Returns

p - plot object

+pelib.+viz.plotComparison(data1, data2, fs)

Plot comparison between data1 and data2

Parameters
  • data1 – array of n x m to be plotted

  • data2 – array of n x m to be plotted

  • fs – [Optional] sampling frequency. default=1

+pelib.+viz.plotJointAngles(bodys, parts)

Plot joint angles

Parameters
  • bodys – Body instance(s) to be plotted

  • parts – String(s) of body point(s) to be plotted (LHip, RHip, LKnee, RKnee).

+pelib.+viz.plotLowerBody(body, t, showOrientation, showGround)

Plot the lower body using the joint positions

Parameters
  • body – Body instance to be plotted

  • t – time point to be plotted

  • showOrientation – [Optional] show coordinate system of each body segment

  • showGround – [Optional] show ground

Returns

p - plot object

+pelib.+viz.plotLowerBody2(body, t)

Plot the lower body using the orientations (checking purposing)

Parameters
  • body – Body instance to be plotted

  • t – time point to be plotted

  • showGround – show ground

Returns

p - plot object

+pelib.+viz.plotLowerBodySegmentLengthError(body, hips, lfemur, rfemur, ltibia, rtibia)

Plot lower body segment length error

Parameters
  • body – Body instance to be plotted

  • hips – left and right hip distance

  • lfemur – left femur length

  • rfemer – right femur length

  • ltibia – left tibia length

  • rtibia – right tibia length

Returns

p - plot object

+pelib.+viz.plotMeanCovSamples(MU, SIGMA, N, setup)

Plot dots based on mean MU and covariance SIGMA

Parameters
  • MU – mean

  • SIGMA – convariance matrix

  • N – number of dots to represent the covariance cloud

  • setup – plot setup

Returns

p plot object

+pelib.+viz.plotOrientation(bodys, parts)

Plot body orientation

Parameters
  • bodys – Body instance(s) to be plotted

  • parts – String(s) of body point(s) to be plotted.

+pelib.+viz.plotOrientationDiff(body1, body2, parts)

Plot body orientation (body2 - body1)

Parameters
  • body1 – Base Body instance

  • body2 – Body instance(s) to be compared to

  • parts – String(s) of body point(s) to be plotted.

+pelib.+viz.plotPosOri(pos, ori)

Plot point with axis

Parameters
  • pos – position of point

  • ori – orientation of segment

+pelib.+viz.plotPosition(bodys, parts)

Plot body position

Parameters
  • bodys – Body instance(s) to be plotted

  • parts – String(s) of body point(s) to be plotted.

+pelib.+viz.plotPositionDiff(body1, body2, parts)

Plot body position difference (body2 - body1)

Parameters
  • body1 – Base Body instance

  • body2 – Body instance(s) to be compared to

  • parts – String(s) of body point(s) to be plotted.

+pelib.+viz.plotQuaternion(varargin)

Plot s0 s1 s2 s3 of quaternion

Parameters

inputs – array of n x 4’s to be plotted

+pelib.+viz.plotR(R, origin, color)

Plot rotation matrix column basis

Parameters

R – rotation matrix

+pelib.+viz.plotStateComparison(estStateData, actStateData, stateIdx, fs)

Compare the state across time

Parameters
  • estStateData – estimated state data (n_samples x n_state)

  • actStateData – actual (basis) state data (n_samples x n_state)

  • stateIdx – compare state number stateIdx: stateIdx+2

+pelib.+viz.plotXYZ(fs, varargin)

Plot x y z of inputs

Parameters
  • fs – sampling frequency

  • inputs – array of n x 3’s to be plotted