Biomech-Sim-Toolbox 1
Toolbox for movement simulation and analysis
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | List of all members
Gait2dc Class Reference

The class describes the Gait2dc model. More...

Inheritance diagram for Gait2dc:
Model handle Gait2dc_Exo

Public Member Functions

function extractControl (in obj, in type, in controlname)
 Function to obtain index of contol with a specific type (and name)
 
function extractState (in obj, in type, in statename)
 Function to obtain index of state with a specific type (and name)
 
function Gait2dc (in varargin)
 Default constructor setting default Gait2dc object.
 
function getCoP (in obj, in grf)
 Function to calculate the center of pressure.
 
function getDynamics (in obj, in x, in xdot, in u)
 Function to compute implicit differential equation for 2D musculoskeletal model.
 
function getErate_bhargava (in obj, in F_ce, in stim, in act, in l_ce, in v_ce, in t_stim)
 Model function to calculate the energy rate of a single time step using Bhargava et al.
 
function getErate_Houdijk (in obj, in F_ce, in act, in l_ce, in v_ce)
 Model function to calculate the energy rate of a single time.
 
function getErate_Lichtwark (in obj, in F_ce, in act, in l_ce, in v_ce, in t_stim)
 Model function to calculate the energy rate of a single time step using a continuous version of Lichtwark & Wilson's model.
 
function getErate_margaria (in obj, in F_ce, in v_ce)
 Model function to calculate the energy rate of a single time step using Margaria's model.
 
function getErate_Minetti (in obj, in act, in v_ce)
 Model function to calculate the energy rate of a single time.
 
function getErate_uchida (in obj, in F_ce, in stim, in act, in l_ce, in v_ce)
 Model function to calculate the energy rate of a single time.
 
function getErate_Umberger (in obj, in F_ce, in stim, in act, in l_ce, in v_ce)
 Model function to calculate the energy rate of a single time step with Umberger et al.
 
function getEratec_bhargava (in obj, in F_ce, in stim, in act, in l_ce, in v_ce, in dFdx, in dFdxdot, in epsilon)
 Model function to calculate the energy rate of a single time step using a continuous version of Bhargava et al.
 
function getEratec_Houdijk (in obj, in F_ce, in act, in l_ce, in v_ce, in dFdx, in dFdxdot, in epsilon)
 Model function to calculate the energy rate of a single time step using a continuous version of Houdijk et al.
 
function getEratec_Lichtwark (in obj, in F_ce, in act, in l_ce, in v_ce, in dFdx, in dFdxdot, in epsilon)
 Model function to calculate the energy rate of a single time step using a continuous version of Lichtwark & Wilson's model.
 
function getEratec_margaria (in obj, in F_ce, in v_ce, in dFdx, in dFdxdot, in epsilon)
 Model function to calculate the energy rate of a single time step using a continuous version of Margaria's model.
 
function getEratec_Minetti (in obj, in act, in v_ce)
 Model function to calculate the energy rate of a single time step using Minetti's model.
 
function getEratec_umberger (in obj, in F_ce, in stim, in act, in l_ce, in v_ce, in dFdx, in dFdxdot, in epsilon)
 Model function to calculate the energy rate of a single time step with the continuous version of Umberger et al.
 
function getFkin (in obj, in x)
 Function returns position and orientation of all segments, for the system in position q.
 
function getGRF (in obj, in x)
 Function returning the ground reaction forces for the system in state x.
 
function getJointmoments (in obj, in x, in u)
 Function returns joint moments, for the system in state x.
 
function getLCE (in obj, in x)
 Function returns length of contractile element, for the system in state x.
 
function getLdotCE (in obj, in xdot)
 Function returns length change of contractile element, for the system in state x.
 
function getLdotMTU (in obj, in x)
 Function returns length change of entire muscle-tendon-unit, for the system in state x.
 
function getLdotSEE (in obj, in x, in xdot)
 Function returns length change of serial elastic element, for the system in state x.
 
function getLMTU (in obj, in x)
 Function returns length of entire muscle-tendon-unit, for the system in state x.
 
function getLSEE (in obj, in x)
 Function returns length of serial elastic element, for the system in state x.
 
function getMetabolicRate_pernode (in obj, in x, in xdot, in u, in t_stim, in name, in getCont, in epsilon, in exponent)
 Model function to calculate metabolic cost of a movement.
 
function getMomentArms (in obj)
 Function to extract moment arms matrix from muscle table.
 
function getMuscleCEforces (in obj, in x, in xdot)
 Function returning muscle forces of CE for the system in state x.
 
function getMuscleCEpower (in obj, in x, in xdot)
 Function returns power generated by muscle contractile elements, for the system in state x.
 
function getMuscleforces (in obj, in x)
 Function returning muscle forces for the system in state x.
 
function getMusclePower (in obj, in x)
 Function returns power generated by entire muscle-tendon-unit, for the system in state x.
 
function getMuscleSEEpower (in obj, in x, in xdot)
 Function returns power generated by muscle serial elastic elements, for the system in state x.
 
function setbodymass (in obj, in bodymass)
 Function to set body mass, does not influence the.
 
function setMuscles (in obj, in muscles)
 Function to set the muscles table.
 
function setSegmentMass (in obj, in segmentName, in segmentMass)
 Function to set segment mass.
 
function setSegments (in obj, in segmentTable)
 Function to set segment Table.
 
function setTreadmillSpeed (in obj, in speed)
 Function to set the speed of the ground, to model a treadmill.
 
function showMarker (in obj, in x, in markerTable, in measuredMean)
 Function to plot marker positions.
 
virtual showStick (in obj, in x)
 Abstract function to show model as stick figure.
 
function showStick (in obj, in x, in range, in plotFeet, in plotGRF, in plotCPs, in plotJointCOSYs)
 Function to show model as stick figure.
 
function showTreadmill (in obj, in x_points, in y_points, in xrange, in yrange, in durTrial, in nFrames)
 Function to visualize treadmill as moving scatter plot.
 
virtual simuAccGyro (in obj, in data, in q, in qd, in qdd)
 Abstract function to simulate acceleration and gyroscope signals.
 
function simuAccGyro (in obj, in variables, in q, in qd, in qdd, in idxSegment, in idxAcc, in idxGyro, in dlocalAll, in plocalAll)
 Function to simulate acceleration and gyroscope signals.
 
function simuMarker (in obj, in variables, in q, in idxSegment, in plocalAll, in dlocalAll)
 Matlab function to simulates markers placed on 2D model.
 

Static Public Member Functions

function getMexFiles ()
 Function to make MEX functions.
 

Public Attributes

Property CPs
 Table: Contact points.
 
Property dofs
 Table: Degrees of freedom (Range of Dofs should not be changed here.
 
Property drag_coefficient
 Double: Air drag coefficient in N/(m/s)^2 (default: 0.2128)
 
Constant Property FOOTSOLEOFFSET = 0.0702
 Double: Distance between foot sole and ankle joint in m.
 
Property gravity
 Double array: Gravity vector in m/(s^2)
 
Constant Property GRFNAMES = {'rightFx', 'rightFy', 'rightFz', 'rightMx', 'rightMy', 'rightMz', 'leftFx', 'leftFy', 'leftFz', 'leftMx', 'leftMy', 'leftMz' }
 Cell array with string: Gives the names for the GRF vector returned by getGRF()
 
Constant Property HEELDEFAULTOFFSET = 0.06
 Double: Distance between heel and ankle joint for default body height in m.
 
Property joints
 Table: Joints.
 
Property lambda
 Double array: Lambda values (default: [0.01 0.1]) (1x2)
 
Property mExtraScaleFactor
 Double: Scale factor for extra torques in Nm (default: 100 since we used this in previous simulations.
 
Property muscles
 Table: Muscles.
 
Property slope
 Double: Slope of ground in deg (positive is uphill)
 
Constant Property TOEOFFSET = 0.05
 Double: Distance between toe and CP toe in m.
 
Property torques
 Table: Torque actuators.
 
Property wind_speed
 Double: Wind speed in direction of +X in m/s (default: 0)
 

Protected Member Functions

function getCoM (in obj, in x)
 Function to calculate the center of mass.
 
function getFootAngle (in obj, in x)
 Function to calculate the angle between foot and ground.
 
function getRandomParticipant (in obj, in SDmusParam)
 Function to generate a participant with random muscle parameters.
 
function getSameRandomParticipant (in obj, in SDmusParamVector)
 Function to generate a participant with random muscle parameters.
 
function initMex (in obj)
 Initialize model mex file.
 
function initModel (in obj, in varargin)
 Function to initialize model with default parameters.
 
function readParameter (in obj)
 Function to read parameter matrix into tables.
 
function scaleParameters (in obj)
 Function to scale the parameters defined in the excelfile.
 
function update_constraints (in obj)
 Function defining the table Gait2dc.constraints.
 
function update_controls (in obj)
 Function defining the table Gait2dc.controls.
 
function update_idxControls (in obj)
 Function defining Model.hidxControls.
 
function update_idxcxCP (in obj)
 Function defining Gait2dc.idxcxCPleft and Gait2dc.idxcxCPright.
 
function update_idxForward (in obj)
 Function defining Model.idxForward.
 
function update_idxForwardAll (in obj)
 Function defining Model.idxForwardAll.
 
function update_idxParamSections (in obj, in src, in evnt)
 Function performed to update start indices of sections in Gait2dc.parameter.
 
function update_idxSideward (in obj)
 Function defining Model.idxSideward.
 
function update_idxSidewardAll (in obj)
 Function defining Model.idxSidewardAll.
 
function update_idxStates (in obj)
 Function defining Model.hidxStates.
 
function update_idxSymmetry (in obj)
 Function defining Gait2dc.idxSymmetry.
 
function update_idxTorqueDof (in obj)
 Function defining Model.idxTorqueDof.
 
function update_idxUpward (in obj)
 Function defining Model.idxUpward.
 
function update_mexParameter (in obj, in src, in evnt)
 Function performed to update the Gait2dc.parameter, the mex and the tables.
 
function update_states (in obj)
 Function defining the table Gait2dc.states.
 

Protected Attributes

Property bodyheight
 Double: Bodyheight in m (default: 1.80)
 
Property bodymass
 Double: Bodymass in kg (default: 75)
 
Property constraints
 Table: Information on constraints implemented in the mex and here.
 
Property controls
 Table: Information on controls of the model.
 
Property excelfile
 String: Filename of parameter file including path and extension.
 
Property foot
 Table: Defining size of feet for visualization.
 
Property idxcxCPleft
 Double array: Indices for x position of left contact points.
 
Property idxcxCPright
 Double array: Indices for x position of right contact points.
 
Property idxForward
 Double array: Indices for forward translation.
 
Property idxForwardAll
 Double array: Indices for forward translation, speed, position of contact points and force at contact points.
 
Property idxParamSections
 Double array: Start indices of sections in Gait2dc.parameter.
 
Property idxSideward
 Double array: Indices for sideward translation.
 
Property idxSidewardAll
 Double array: Indices for sideward translation, speed, position of contact points and force at contact points.
 
Property idxSymmetry
 Struct: Double arrays with indices for symmetry to map right to left.
 
Property idxTorqueDof
 Double array: Indices of dofs of torque actuators.
 
Property idxUpward
 Double array: Indices for upward translation.
 
Property init
 Double: Showing if the mex model is initialized.
 
Property nConstraints
 Double: Number of constraints (height of Model.constraints)
 
Property nControls
 Double: Number of controls (height of Model.controls)
 
Property nCPs
 Double: Number of contact points (height of Model.CPs)
 
Property nDofs
 Double: Number of degree of freedoms (height of Model.dofs)
 
Property nJoints
 Double: Number of joints (height of Model.joints)
 
Property nMus
 Double: Number of muscles (height of Model.muscles)
 
Property nSegments
 Double: Number of segments (height of Model.segments)
 
Property nStates
 Double: Number of states (height of Model.states)
 
Property nTor
 Double: Number of torque actuators (height of Model.torques)
 
Property parameter
 Double matrix: Entries of parameter excel file.
 
Property segments
 Table: Segments (Segment properties should not be changed)
 
Property speed_left
 Double: Speed of simulated additional Treadmill.
 
Property speed_right
 
Property states
 Table: Information on states of the model.
 

Detailed Description

The class describes the Gait2dc model.

Examples
/home/runner/work/BioMAC-Sim-Toolbox/BioMAC-Sim-Toolbox/ExampleScripts/+IntroductionExamples/script2D.m, and /home/runner/work/BioMAC-Sim-Toolbox/BioMAC-Sim-Toolbox/ExampleScripts/+Treadmill/script2D.m.

Constructor & Destructor Documentation

◆ Gait2dc()

function Gait2dc ( in  varargin)

Default constructor setting default Gait2dc object.

Initializes the model and builds and initializes the mex function.

The standard model can be called using:

Gait2dc('gait2dc_par.xls')
The class describes the Gait2dc model.
Definition: Gait2dc.m:20

The excelfile must be in the matlab path.

Parameters
vararginVariable length input with:
  • excelfile String: Excel file with path, name and extension. If the excel is given, Gait2dc.scaleParameters will be called. OR
  • parameter Matrix: Model parameters like they would be loaded from the excel (see Gait2dc.parameter). If the matrix is given and not an excel file, Gait2dc.scaleParameters will not be called. AND
  • bodyheight (optional) Double: Bodyheight in m (If not given, default will be used and not the entry from excel or parameter matrix. Use empty to skip.)
  • bodymass (optional) Double: Bodymass in kg (If not given, default will be used and not the entry from excel or parameter matrix. Use empty to skip.)
Return values
objGait2dc class object

Member Function Documentation

◆ extractControl()

function extractControl ( in  obj,
in  type,
in  controlname 
)
inherited

Function to obtain index of contol with a specific type (and name)

Parameters
objModel class object
typeString: Type of the control
controlname(optional) String or cell array of strings: Name of the control
Return values
iControlDouble array: Indices in Model.controls matching type (and name)

◆ extractState()

function extractState ( in  obj,
in  type,
in  statename 
)
inherited

Function to obtain index of state with a specific type (and name)

Parameters
objModel class object
typeString: Type of the state
statename(optional) String or cell array of strings: Name of the state
Return values
iStateDouble array: Indices in Model.states matching type (and name)

◆ getCoM()

function getCoM ( in  obj,
in  x 
)
protected

Function to calculate the center of mass.

It solves the center of mass (CoM) coordinates from the locations of the individual centers of mass

Parameters
objModel class object
xDouble vector: joint angles (1xnStates or nStatesx1)
Return values
CoMDouble vector: x, y location of center of mass

◆ getCoP()

function getCoP ( in  obj,
in  grf 
)
inherited

Function to calculate the center of pressure.

It solves the center of pressure (COP) coordinates from: COP x F + Ty = M, where COP is a point in the XZ plane and Ty is the "free moment" on the Y axis. expand the equation:

  1. COPy * Fz - COPz * Fy + 0 = Mx
  2. COPz * Fx - COPx * Fz + Ty = My
  3. COPx * Fy - COPy * Fx + 0 = Mz

Use COPy = 0, to get COPx = Mz / Fy and COPz = -Mx / Fy

For 2D, COPz will be 0.

Parameters
objModel class object
grfDouble vector: Ground contact vector containing Fx, Fy, Fz, Mx, My, Mz (right), and Fx, Fy, Fz, Mx, My, Mz (left) (12)
Return values
CoP_rDouble vector: Center of pressure in x, y and z direction for right foot (3)
CoP_lDouble vector: Center of pressure in x, y and z direction for left foot (3)

◆ getDynamics()

function getDynamics ( in  obj,
in  x,
in  xdot,
in  u 
)
virtual

Function to compute implicit differential equation for 2D musculoskeletal model.

This function calls the mex file of gait2dc.c: [f, dfdx, dfdxdot, dfdumus, dfdMextra] = gait2dc('Dynamics',x,xdot,umus,Mextra);

with the neural excitation umus and the extra torques Mextra.

The dynamic residuals will be between fmin and fmax when inputs satisfy system dynamics: fmin <= f(x,dx/dt,umus,Mextra) <= fmax

The last four outputs are optional and some computation time is saved if you do not request all of them.

Parameters
objGait2dc class object
xDouble array: State of the model (Gait2dc.nStates x 1)
xdotDouble array: State derivatives (Gait2dc.nStates x 1)
uDouble array: Controls of the model (Gait2dc.nControls x 1)
Return values
fDouble array: Dynamic residuals (Gait2dc.nConstraints x 1)
dfdx(optional) Double matrix: Transpose of Jacobian matrix df/dx (Gait2dc.nStates x Gait2dc.nConstraints)
dfdxdot(optional) Double matrix: Transpose of Jacobian matrix df/dxdot (Gait2dc.nStates x Gait2dc.nConstraints)
dfdu(optional) Double matrix: Transpose of Jacobian matrix df/du (Gait2dc.nControls x Gait3d.nConstraints)

Reimplemented from Model.

◆ getErate_bhargava()

function getErate_bhargava ( in  obj,
in  F_ce,
in  stim,
in  act,
in  l_ce,
in  v_ce,
in  t_stim 
)
inherited

Model function to calculate the energy rate of a single time step using Bhargava et al.

's model

Function to calculate the energy rate at a single time step using a continuous version of Bhargava et al.'s model. Model paper: Bhargava et al., J Biomech, 2004

Inputs are muscle states of the specific muscle that is considered.

Parameters
objModel object
F_ceForce in the contractile element
stimStimulation of the muscle (between 0 and 1)
actActivation level of the muscle (between 0 and 1)
l_ceNormalized length of the contractile element
v_ceNormalized velocity of the contractile element
t_stimDuration of stimulation of muscle

The output of getEratec_bhargava.m is a double which is equal to the energy rate of the time step in W/kg

Return values
EdotThe energy expenditure during the current time step

◆ getErate_Houdijk()

function getErate_Houdijk ( in  obj,
in  F_ce,
in  act,
in  l_ce,
in  v_ce 
)
inherited

Model function to calculate the energy rate of a single time.

Function to calculate the energy rate at a single time step using Houdijk et al.'s model. Houdijk et al., J Biomech, 2006. The paper desription is not optimal, see comments

Inputs are muscle parameters of the specific muscle that is considered. Inputs are muscle states of the specific muscle that is considered.

Parameters
objModel object
F_ceForce in the contractile element
actActivation level of the muscle (between 0 and 1)
l_ceNormalized length of the contractile element
v_ceNormalized velocity of the contractile element

The output of getErate_Houdijk.m is a double which is equal to the energy rate of the time step in W/kg

Return values
EdotThe energy expenditure during the current time step
wMuscle work during the current time step

◆ getErate_Lichtwark()

function getErate_Lichtwark ( in  obj,
in  F_ce,
in  act,
in  l_ce,
in  v_ce,
in  t_stim 
)
inherited

Model function to calculate the energy rate of a single time step using a continuous version of Lichtwark & Wilson's model.

Function to calculate the energy rate at a single time step using Lichtwark & Wilson's model, described in the supplement of Lichtwark & Wilson, J Biomech, 2007. The exception in gamma (line 68), which is according to Lichtwark & Wilson, J Exp Biol, 2005, because results were better in the 2019 comparison paper

Inputs are muscle parameters of the specific muscle that is considered.

Parameters
objModel object
F_ceForce in the contractile element
actActivation level of the muscle (between 0 and 1)
l_ceNormalized length of the contractile element
v_ceNormalized velocity of the contractile element
t_stimDuration of stimulation of muscle

The output of getErate_Lichtwark.m is a double which is equal to the energy rate of the time step in W/kg

Return values
EdotThe energy expenditure during the current time step

◆ getErate_margaria()

function getErate_margaria ( in  obj,
in  F_ce,
in  v_ce 
)
inherited

Model function to calculate the energy rate of a single time step using Margaria's model.

Function to calculate the energy rate at a single time step using Margaria's model: 25 % efficient during shortening, 120% during lengthening. Margaria, Int Z Angew Physiol Einschl Arbeitsphysiol, 1968

Inputs are muscle parameters of the specific muscle that is considered.

Parameters
objModel object
F_ceForce in the contractile element
v_ceNormalized velocity of the contractile element

The output of getErate_margaria.m is a double which is equal to the energy rate of the time step in W/kg

Return values
Edotis the energy expenditure during the current time step

◆ getErate_Minetti()

function getErate_Minetti ( in  obj,
in  act,
in  v_ce 
)
inherited

Model function to calculate the energy rate of a single time.

Function to calculate the energy rate at a single time step using Minetti's model. Based on: Minetti & Alexander, J Theor Biol, 1997. Uses muscle-level work instead of torque-level

Inputs are muscle parameters of the specific muscle that is considered.

Parameters
objModel object
actactivation level of the muscle (between 0 and 1)
v_cecurrent velocity of the contractile element

The output of getErate_Minetti is a double which is equal to the energy rate

Return values
Edotis the energy expenditure during the current time step

◆ getErate_uchida()

function getErate_uchida ( in  obj,
in  F_ce,
in  stim,
in  act,
in  l_ce,
in  v_ce 
)
inherited

Model function to calculate the energy rate of a single time.

Function to calculate the energy rate at a single time step using Uchida's model: Uchida et al., PLOS ONE, 2016

Inputs are muscle states of the specific muscle that is considered

Parameters
objModel class object
F_ceDouble vector: Muscle force of CE returned by obj.getMuscleCEforces(x) (Model.nMus x 1)
stimDouble vector: Stimulation of muscles = neural excitation u (Model.nMus x 1)
actDouble vector: Activation of muscles a (Model.nMus x 1)
l_ceDouble vector: Length of contractile element of muscles s (Model.nMus x 1)
v_ceDouble vector: Velocity of contractile element of muscles (Model.nMus x 1)

The output of getErate_uchida.m is a double which is equal to the energy rate of the time step in W/kg

Return values
EdotDouble vector: Energy expenditure during one time step (energy rate) in W (Model.nMus x 1)
w_ceDouble vector: Mechanical work rate of contractile element in W/kg (normalized to muscle mass) (Model.nMus x 1)
h_slDouble vector: Heat rate due to shortening and lengthening of muscles in W/kg (normalized to muscle mass) (Model.nMus x 1)
h_amDouble vector: Heat rate from the activation of muscles and its maintenance in W/kg (normalized to muscle mass) (Model.nMus x 1)

◆ getErate_Umberger()

function getErate_Umberger ( in  obj,
in  F_ce,
in  stim,
in  act,
in  l_ce,
in  v_ce 
)
inherited

Model function to calculate the energy rate of a single time step with Umberger et al.

's model. Ross Miller's code was also used as a reference.

Function to calculate the energy rate at a single time step using Umberger's model. It uses the 2010 version (no negative work): Umberger, J R Soc Interface, 2010 2003 (original) Version: Umberger et al., "A model of human muscle energy expenditure," Computer methods in biomechanics and biomedical engineering, vol. 6, no. 2, pp. 99–111, 2003.

Inputs are muscle states of the specific muscle that is considered

Parameters
objGait2dc class object
F_ceDouble vector: Muscle force of CE returned by Model.getMuscleCEforces(x) (Model.nMus x 1)
stimDouble vector: Stimulation of muscles = neural excitation u (Model.nMus x 1)
actDouble vector: Activation of muscles a (Model.nMus x 1)
l_ceDouble vector: Length of contractile element of muscles s (Model.nMus x 1)
v_ceDouble vector: Velocity of contractile element of muscles (Model.nMus x 1)

The output of getErate_Umberger.m is a double which is equal to the energy rate of the time step in W/kg

Return values
EdotDouble vector: Energy expenditure during one time step (energy rate) in W (Model.nMus x 1)
w_ceDouble vector: Mechanical work rate of contractile element in W/kg (normalized to muscle mass) (Model.nMus x 1)
h_slDouble vector: Heat rate due to shortening and lengthening of muscles in W/kg (normalized to muscle mass) (Model.nMus x 1)
h_amDouble vector: Heat rate from the activation of muscles and its maintenance in W/kg (normalized to muscle mass) (Model.nMus x 1)

◆ getEratec_bhargava()

function getEratec_bhargava ( in  obj,
in  F_ce,
in  stim,
in  act,
in  l_ce,
in  v_ce,
in  dFdx,
in  dFdxdot,
in  epsilon 
)
inherited

Model function to calculate the energy rate of a single time step using a continuous version of Bhargava et al.

's model

Function to calculate the energy rate at a single time step using a continuous version of Bhargava et al.'s model. Line 60, phi, was chosen based on graphs of phi as a function of t_stim, since t_stim cannot be differentiated. Model paper: bhargava et al., J Biomech, 2004

Inputs are muscle states of the specific muscle that is considered.

Parameters
objModel object
F_ceForce in the contractile element
stimStimulation of the muscle (between 0 and 1)
actActivation level of the muscle (between 0 and 1)
l_ceNormalized length of the contractile element
v_ceNormalized velocity of the contractile element
dFdxDerivative of CE forces with respect to the state
dFdxdotDerivative of CE forces with respect to the state derivative
epsilonMeasure of the nonlinearity of the continuous functions

The output of getEratec_bhargava.m is a double which is equal to the energy rate of the time step in W/kg

Return values
EdotThe energy expenditure during the current time step
dEdotThe gradient of Edot with respect to all states and inputs

◆ getEratec_Houdijk()

function getEratec_Houdijk ( in  obj,
in  F_ce,
in  act,
in  l_ce,
in  v_ce,
in  dFdx,
in  dFdxdot,
in  epsilon 
)
inherited

Model function to calculate the energy rate of a single time step using a continuous version of Houdijk et al.

's model

Function to calculate the energy rate at a single time step using a continuous version of Houdijk et al.'s model. Houdijk et al., J Biomech, 2006.

Inputs are muscle parameters of the specific muscle that is considered. Inputs are muscle states of the specific muscle that is considered.

Parameters
objModel object
F_ceForce in the contractile element
actActivation level of the muscle (between 0 and 1)
l_ceNormalized length of the contractile element
v_ceNormalized velocity of the contractile element
dFdxDerivative of CE forces with respect to the state
dFdxdotDerivative of CE forces with respect to the state derivative
epsilonMeasure of the nonlinearity of the continuous functions

The output of getEratec_Houdijk.m is a double which is equal to the energy rate of the time step in W/kg

Return values
EdotThe energy expenditure during the current time step
dEdotThe gradient of Edot with respect to all states and inputs%

◆ getEratec_Lichtwark()

function getEratec_Lichtwark ( in  obj,
in  F_ce,
in  act,
in  l_ce,
in  v_ce,
in  dFdx,
in  dFdxdot,
in  epsilon 
)
inherited

Model function to calculate the energy rate of a single time step using a continuous version of Lichtwark & Wilson's model.

Function to calculate the energy rate at a single time step using a continuous version of Lichtwark & Wilson's model, described in the supplement of Lichtwark & Wilson, J Biomech, 2007.

Inputs are muscle parameters of the specific muscle that is considered.

Parameters
objModel object
F_ceForce in the contractile element
actActivation level of the muscle (between 0 and 1)
l_ceNormalized length of the contractile element
v_ceNormalized velocity of the contractile element
dFdxDerivative of CE forces with respect to the state
dFdxdotDerivative of CE forces with respect to the state derivative
epsilonMeasure of the nonlinearity of the continuous functions

The output of getEratec_Lichtwark.m is a double which is equal to the energy rate of the time step in W/kg

Return values
EdotThe energy expenditure during the current time step
dEdotThe gradien

◆ getEratec_margaria()

function getEratec_margaria ( in  obj,
in  F_ce,
in  v_ce,
in  dFdx,
in  dFdxdot,
in  epsilon 
)
inherited

Model function to calculate the energy rate of a single time step using a continuous version of Margaria's model.

Function to calculate the energy rate at a single time step using a continuous version of Margaria's model: 25 % efficient during shortening, 120% during lengthening. Margaria, Int Z Angew Physiol Einschl Arbeitsphysiol, 1968

Inputs are muscle parameters of the specific muscle that is considered.

Parameters
objModel object
F_ceForce in the contractile element
v_ceNormalized velocity of the contractile element
dFdxDerivative of CE forces with respect to the state
dFdxdotDerivative of CE forces with respect to the state derivative
epsilonMeasure of the nonlinearity of the continuous functions

The output of getEratec_margaria.m is a double which is equal to the energy rate of the time step in W/kg

Return values
Edotis the energy expenditure during the current time step
dEdotis the gradient of Edot with respect to all states and inputs

◆ getEratec_Minetti()

function getEratec_Minetti ( in  obj,
in  act,
in  v_ce 
)
inherited

Model function to calculate the energy rate of a single time step using Minetti's model.

No discsontinuities here, so it is the same as the original model.

Function to calculate the energy rate at a single time step using Minetti's model. Based on: Minetti & Alexander, J Theor Biol, 1997. Uses muscle-level work instead of torque-level

Inputs are muscle parameters of the specific muscle that is considered.

Parameters
objModel object
actactivation level of the muscle (between 0 and 1)
v_cecurrent velocity of the contractile element

The output of getEratec_Minetti.m is a double which is equal to the energy rate of the time step in W/kg

Return values
Edotis the energy expenditure during the current time step
dEdotis the gradient of Edot with respect to all states and inputs

◆ getEratec_umberger()

function getEratec_umberger ( in  obj,
in  F_ce,
in  stim,
in  act,
in  l_ce,
in  v_ce,
in  dFdx,
in  dFdxdot,
in  epsilon 
)
inherited

Model function to calculate the energy rate of a single time step with the continuous version of Umberger et al.

's model

Function to calculate the energy rate at a single time step using a continuous version of Umberger's model. This one is published in Koelewijn, Dorscky et al., Comp Meth Biomed Biomech Eng, 2016, and uses the 2010 version (no negative work): Umberger, J R Soc Interface, 2010

Inputs are muscle states of the specific muscle that is considered.

Parameters
objModel object
F_ceForce in the contractile element
stimStimulation of the muscle (between 0 and 1)
actActivation level of the muscle (between 0 and 1)
l_ceNormalized length of the contractile element
v_ceNormalized velocity of the contractile element
dFdxDerivative of CE forces with respect to the state
dFdxdotDerivative of CE forces with respect to the state derivative
epsilonMeasure of the nonlinearity of the continuous functions

The output of getEratec_umberger.m is a double which is equal to the energy rate of the time step in W/kg

Return values
EdotThe energy expenditure during the current time step
dEdotThe gradient of Edot with respect to all states and inputs

◆ getFkin()

function getFkin ( in  obj,
in  x 
)

Function returns position and orientation of all segments, for the system in position q.

This function can be used to plot the segments or for marker tracking. It calls the mex file of gait2d.c: FK = gait2dc('Fkin', x);

The order is the following for each segment:

px', 'py', 'R11', 'R12', 'R21', 'R22'

p can be obtained by:

idxSegment = 1; % see Gait2dc.segments for the order
p = FK((1:2) + (idxSegment-1)*6);
Property segments
Table: Segments (Segment properties should not be changed)
Definition: Model.m:37

R can be obtained by:

R = reshape(FK((3:6) + (idxSegment-1)*6), 2, 2)';
Parameters
objGait2dc class object
xDouble array: State of the model (Gait2dc.nStates x 1)
Return values
FKDouble array: position and orientation of all segments. Details see above. (Gait2dc.nSegments * 6)
dFKdq(optional) Double matrix: Jacobian of FK with respect to q (Gait2dc.nSegments * 6 x Gait2dc.nDofs)
dFKdotdq(optional) Double matrix: Jacobian of dFK/dt with respect to q (Gait2dc.nSegments * 6 x Gait2dc.nDofs)

◆ getFootAngle()

function getFootAngle ( in  obj,
in  x 
)
protected

Function to calculate the angle between foot and ground.

Function uses gait2dc('Stick', x(:, iTime)) to get the position of the foot segment.

This implementation is only suited for our 2D model containing two contact points per foot (heel and toe)!

Parameters
objGait2dc class object
xDouble matrice: State vector of model for n time points (Gait2dc.nStates x n)
Return values
angle_rDouble vector: Angle between right foot and ground in degree. Angles ranges from -180 to 180 deg. (n x 1)
angle_lDouble vector: Angle between left foot and ground in degree. Angles ranges from -180 to 180 deg. (n x 1)

◆ getGRF()

function getGRF ( in  obj,
in  x 
)
virtual

Function returning the ground reaction forces for the system in state x.

This function calls the mex file of gait2dc.c: [grf, dgrfdx] = gait2dc('GRF', x);

Parameters
objGait2dc class object
xDouble array: State of the model (Gait2dc.nStates x 1)
Return values
grfDouble array (12x1) containing:
  • right Fx, Fy, Fz (in bodyweight)
  • right Mx, My, Mz (in bodyweight*m)
  • left Fx, Fy, Fz (in bodyweight)
  • left Mx, My, Mz (in bodyweight*m)
dgrfdx(optional) Double matrix: Transpose of Jacobian matrix dgrf/dx (Gait2dc.nStates x 12)

Reimplemented from Model.

◆ getJointmoments()

function getJointmoments ( in  obj,
in  x,
in  u 
)
virtual

Function returns joint moments, for the system in state x.

This includes passive joint moments and muscle moments and extra moments.

Parameters
objGait2dc class object
xDouble array: State of the model (Gait2dc.nStates x 1)
u(optional) Double array: Controls of the model which are only needed if you want to apply extra moments (i.e. arm torques) (Gait2dc.nControls x 1)
Return values
MDouble array: Moment for each DOF (Gait2dc.nDofs x 1)
dMdx(optional) Double matrix: Transpose of Jacobian matrix dM/dx (Gait2dc.nStates x Gait2dc.nDofs)
dMdu(optional) Double matrix: Transpose of Jacobian matrix dM/du (Gait2dc.nControls x Gait2dc.nDofs)

Reimplemented from Model.

◆ getLCE()

function getLCE ( in  obj,
in  x 
)

Function returns length of contractile element, for the system in state x.

This function simply scales s using lceopt.

Parameters
objGait2dc class object
xDouble array: State of the model (Gait2dc.nStates x 1)
Return values
L_CEDouble array: CE length (m) of each muscle (Gait2dc.nMus x 1)

◆ getLdotCE()

function getLdotCE ( in  obj,
in  xdot 
)

Function returns length change of contractile element, for the system in state x.

This function simply scales sdot using lceopt.

Parameters
objGait2dc class object
xdotDouble array: State derivatives (Gait2dc.nStates x 1)
Return values
Ldot_CEDouble array: CE length change (m/s) of each muscle (Gait2dc.nMus x 1)

◆ getLdotMTU()

function getLdotMTU ( in  obj,
in  x 
)

Function returns length change of entire muscle-tendon-unit, for the system in state x.

This function does not ensure that the order of muscle moment arms fit to the order of DoFs in qdot in the states. This must be ensured by the user. The order of muscle moment arms is defined in the excel file defining the model.

The same length is also computed in MusclePath() in gait2dc.c.

Parameters
objGait2dc class object
xDouble array: State of the model (Gait2dc.nStates x 1)
Return values
Ldot_MTUDouble array: MTU length change (m/s) of each muscle (Gait2dc.nMus x 1)

◆ getLdotSEE()

function getLdotSEE ( in  obj,
in  x,
in  xdot 
)

Function returns length change of serial elastic element, for the system in state x.

This function computes the length change of the SEE as Ldot_MTU-Ldot_CE.

Parameters
objGait2dc class object
xDouble array: State of the model (Gait2dc.nStates x 1)
xdotDouble array: State derivatives (Gait2dc.nStates x 1)
Return values
Ldot_SEEDouble array: SEE length change (m/s) of each muscle (Gait2dc.nMus x 1)

◆ getLMTU()

function getLMTU ( in  obj,
in  x 
)

Function returns length of entire muscle-tendon-unit, for the system in state x.

This function replicated the computation done in gait2dc.c.

Parameters
objGait2dc class object
xDouble array: State of the model (Gait2dc.nStates x 1)
Return values
L_MTUDouble array: MTU length (m) of each muscle (Gait2dc.nMus x 1)

◆ getLSEE()

function getLSEE ( in  obj,
in  x 
)

Function returns length of serial elastic element, for the system in state x.

This function uses the difference of the length of the entire muscle-tendon-unit and of the contracile element.

Parameters
objGait2dc class object
xDouble array: State of the model (Gait2dc.nStates x 1)
Return values
L_SEEDouble array: SEE length (m) of each muscle (Gait2dc.nMus x 1)

◆ getMetabolicRate_pernode()

function getMetabolicRate_pernode ( in  obj,
in  x,
in  xdot,
in  u,
in  t_stim,
in  name,
in  getCont,
in  epsilon,
in  exponent 
)
inherited

Model function to calculate metabolic cost of a movement.

Function to calculate the metabolic cost of a movement. Seven different models are currently implemented

Parameters
objModel object
xDouble vector: States of the current node
xdotDouble vector: Derivatives of states
uDouble vector: Controls of the current node
t_stimDouble vector: how long each muscle was already stimulated
name(optional) String: name of the model that is being used. Options are umberger, lichtwark, bhargava, margaria, minetti, houdijk, and uchida
getCont(optional) Boolean: If true, get the continuous version which is needed if we use the output for simulation. (default: 0)
epsilon(optional) double parameter: Measure of nonlinearity of model, which is only used in the continuous model version. Default 0.
exponent(optional) integer: if metabolic cost is the objective, this number allows to minimize the square, cube, or nth-power of metabolic cost. Default is 1
Return values
EdotDouble vector: Energy expenditure during one time step (energy rate) in W (Model.nMus x 1)
dEdotdxDouble vector: Derivative of Edot w.r.t to x (Model.nStates x 1)
dEdotduDouble vector: Derivative of Edot w.r.t to u (Model.nControls x 1)
dEdotdTDouble: Derivative of Edot w.r.t to T

◆ getMexFiles()

function getMexFiles ( )
static

Function to make MEX functions.

Builds the MEX function from Autolev source code, and from gait2dc.c MEX wrapper.

◆ getMomentArms()

function getMomentArms ( in  obj)

Function to extract moment arms matrix from muscle table.

It extract the moment arm matrix which is defined by the model file (excel file) and saved in model.muscles. It is equal to the variable "MA" in gait2dc.c.

It is not ensured whether the order in obj.muscles fit to to the order of the joints.

Parameters
objGait2dc class object
Return values
momentarmsDouble matrix: Muscle moment arms in m (Gait2dc.nMus x Gait2dc.nJoints)

◆ getMuscleCEforces()

function getMuscleCEforces ( in  obj,
in  x,
in  xdot 
)
virtual

Function returning muscle forces of CE for the system in state x.

This function calls the mex file of gait2dc.c: [forces] = gait2dc('MuscleCEforces', x);

Parameters
objGait2dc class object
xDouble array: State of the model (Gait2dc.nStates x 1)
xdotDouble array: State derivatives (Gait2dc.nStates x 1)
Return values
forcesCEDouble array: Muscle forces of CE (in N) (Gait2dc.nMus x 1)
dforcesCEdxDouble array: Transpose of Jacobian matrix d force / d x (Gait2dc.nStates x Gait2dc.nMus)
dforcesCEdxdotDouble array: Transpose of Jacobian matrix d force / d xdot (Gait2dc.nStates x Gait2dc.nMus)

Reimplemented from Model.

◆ getMuscleCEpower()

function getMuscleCEpower ( in  obj,
in  x,
in  xdot 
)
virtual

Function returns power generated by muscle contractile elements, for the system in state x.

xdot must be the state derivatives, such that the muscle balance equations are satisfied. It is up to the user to ensure that the muscle contraction balance f(x,xdot)=0 when this function is used.

Parameters
objGait2dc class object
xDouble array: State of the model (Gait2dc.nStates x 1)
xdotDouble array: State derivatives (Gait2dc.nStates x 1)
Return values
powersDouble array: CE power output (W) of each muscle (Gait2dc.nMus x 1)
conDynResDouble array: Contraction dynamics residuals (Gait2dc.nMus x 1)

Reimplemented from Model.

◆ getMuscleforces()

function getMuscleforces ( in  obj,
in  x 
)
virtual

Function returning muscle forces for the system in state x.

This function calls the mex file of gait2dc.c: [forces] = gait2dc('Muscleforces', x);

Parameters
objGait2dc class object
xDouble array: State of the model (Gait2dc.nStates x 1)
Return values
forcesDouble array: Muscle forces (in N) (Gait2dc.nMus x 1)
dforcesdxDouble array: Transpose of Jacobian matrix d force / d x (Gait2dc.nStates x Gait2dc.nMus)

Reimplemented from Model.

◆ getMusclePower()

function getMusclePower ( in  obj,
in  x 
)

Function returns power generated by entire muscle-tendon-unit, for the system in state x.

This function calls Gait2dc:getLdotMTU() which does not ensure that the order of muscle moment arms fit to the order of DoFs in qdot in the states. This must be ensured by the user. The order of muscle moment arms is defined in the excel file defining the model.

Parameters
objGait2dc class object
xDouble array: State of the model (Gait2dc.nStates x 1)
Return values
powersDouble array: MTU power output (W) of each muscle (Gait2dc.nMus x 1)

◆ getMuscleSEEpower()

function getMuscleSEEpower ( in  obj,
in  x,
in  xdot 
)

Function returns power generated by muscle serial elastic elements, for the system in state x.

xdot must be the state derivatives, such that the muscle balance equations are satisfied. It is up to the user to ensure that the muscle contraction balance f(x,xdot)=0 when this function is used.

Parameters
objGait2dc class object
xDouble array: State of the model (Gait2dc.nStates x 1)
xdotDouble array: State derivatives (Gait2dc.nStates x 1)
Return values
powersSEEDouble array: SEE power output (W) of each muscle (Gait2dc.nMus x 1)

◆ getRandomParticipant()

function getRandomParticipant ( in  obj,
in  SDmusParam 
)
protected

Function to generate a participant with random muscle parameters.

This function generates a new model object where muscle parameters were independenlty normally distributed around the muscle parameters of obj using the standard deviation SDmusParam. In Dorschky et al., "Optimal control simulation predicts effects of midsole materials on energy cost of running" (2019), we change fmax, lceopt, width, L0, kPEE, umax, vmax, tact, tdeact, gmax, arel, and the moment arms at each joint.

We use the same muscle parameters for right and left muscles (symmetric model). Otherwise it does not make sense to use the symmetry option in the simulation.

To generate this new model, we use the excelfile, bodyheight, and bodymass of obj. Other parameters which were changed in obj will not be copied since we have to create a new model object. If we would not create a new model object, but make a deep copy by inheriting from matlab.mixin.Copyable, this would cause problems with the listener callbacks (They would not be called after changes of the muscle parameters.). => If you find a better solution, please adapt this function.

This function does not shuffle or reset the random number generator (see https://de.mathworks.com/help/matlab/ref/rng.html).

Parameters
objGait2dc model object
SDmusParamDouble: Standard deviation (SD) for distribution around default value in % of the default value.
Return values
randModelGait2dc model object: New model generated using excelfile, bodyheight and bodymass of obj. Afterwards muscle parameters were changed randomly following a normal distribution.

◆ getSameRandomParticipant()

function getSameRandomParticipant ( in  obj,
in  SDmusParamVector 
)
protected

Function to generate a participant with random muscle parameters.

This function generates a new model object where muscle parameters were independenlty normally distributed around the muscle parameters of obj using the standard deviation SDmusParam. In Dorschky et al., "Optimal control simulation predicts effects of midsole materials on energy cost of running" (2019), we change fmax, lceopt, width, L0, kPEE, umax, vmax, tact, tdeact, gmax, arel, and the moment arms at each joint.

We use the same muscle parameters for right and left muscles (symmetric model). Otherwise it does not make sense to use the symmetry option in the simulation.

To generate this new model, we use the excelfile, bodyheight, and bodymass of obj. Other parameters which were changed in obj will not be copied since we have to create a new model object. If we would not create a new model object, but make a deep copy by inheriting from matlab.mixin.Copyable, this would cause problems with the listener callbacks (They would not be called after changes of the muscle parameters.). => If you find a better solution, please adapt this function.

This function does not shuffle or reset the random number generator (see https://de.mathworks.com/help/matlab/ref/rng.html).

Parameters
objGait2dc model object
SDmusParamVectorDouble vector: nParams (or larger) xnMus vector of normalized deviations from the mean.
randModelGait2dc model object: New model generated using excelfile, bodyheight and bodymass of obj. Afterwards muscle parameters were changed randomly following a normal distribution.

◆ initMex()

function initMex ( in  obj)
protectedvirtual

Initialize model mex file.

This function calls the mex file of gait2dc.c [info] = gait2dc('Initialize', model)

This initializes the model. This is required before anything is done with the model.

Input: param Matric containing model parameters loaded from the excel file after scaling.

Output: xneutral Model state vector (Gait2dc.nStates x 1) for a neutral state where the model is in free fall with feet not quite touching the ground, but otherwise close to static equilibrium.

Parameters
objGait2dc class object

Reimplemented from Model.

◆ initModel()

function initModel ( in  obj,
in  varargin 
)
protectedvirtual

Function to initialize model with default parameters.

Sets bodyheight and mass and creates default foot table.

Parameters
objGait2dc class object
vararginCell: Can contain
  • bodyheight Double: Bodyheight in m
  • bodymass Double: Bodymass in kg

Reimplemented from Model.

◆ readParameter()

function readParameter ( in  obj)
protected

Function to read parameter matrix into tables.

Function reads the parameters from the matrix Gait2dc.parameter and sets Gait2dc.segments, Gait2dc.joints, Gait2dc.dofs, Gait2dc.muscles and Gait2dc.CPs. If you change sth here, scaleParameters() should be also checked!!! Sets also the default range of Gait2dc.CPs. Gait2dc.bodymass and Gait2dc.bodyheight are set according to the input of the constructor (value in excelfile is ignored).

Parameters
objGait2dc class object

◆ scaleParameters()

function scaleParameters ( in  obj)
protected

Function to scale the parameters defined in the excelfile.

Uses bodymass and height according to Winter 2005. Bodymass and heigt have to be set during object initialization. Changes later changes are not possible. Please create a new object in this case.

Parameters
objGait2dc class object

◆ setbodymass()

function setbodymass ( in  obj,
in  bodymass 
)
inherited

Function to set body mass, does not influence the.

Parameters
objModel class object
segmentTableDouble: bodymass

◆ setMuscles()

function setMuscles ( in  obj,
in  muscles 
)
inherited

Function to set the muscles table.

Parameters
objModel class object
segmentTableTable: muscles

◆ setSegmentMass()

function setSegmentMass ( in  obj,
in  segmentName,
in  segmentMass 
)
inherited

Function to set segment mass.

Parameters
objModel class object
segmentNameString: Name of the segment
segmentMassDouble: Mass of the segment in kg

◆ setSegments()

function setSegments ( in  obj,
in  segmentTable 
)
inherited

Function to set segment Table.

Parameters
objModel class object
segmentTableTable: segmentTable

◆ setTreadmillSpeed()

function setTreadmillSpeed ( in  obj,
in  speed 
)

Function to set the speed of the ground, to model a treadmill.

This function allows you to model a treadmill. It can handle two types of inputs. If it is a double, the value will be set as the treadmill speed. If it is a struct, a split-belt treadmill can be modelled

Parameters
objGait2d_osim class object
speedDouble or Struct: Treadmill speed in m/s. If it is a double, the value is used for the left and right belt. If is is a struct, speed.left and speed.right are used for the left and right belt, respectively.

◆ showMarker()

function showMarker ( in  obj,
in  x,
in  markerTable,
in  measuredMean 
)

Function to plot marker positions.

The motion in x and the matrix measured have to fit to each other. If you want to plot for example only a single node, markerTable.mean must be only the data of this single node.

You can use the function like this:

figure();
x = result.X(result.problem.idx.states(:, 1:result.problem.nNodes)); % get states
result.problem.model.showStick(x, [], 1, 0, 1); % plot stick figure
markerTable = result.problem.objectiveTerms(1).varargin{1}.variables; % assuming trackMarker is your first objective
markerMean = cell2mat(markerTable.mean')/1000; % extract and convert from mm to meter
result.problem.model.showMarker(x, markerTable, markerMean); % plot marker data
Property states
Table: Information on states of the model.
Definition: Model.m:94
Todo:
The function is not yet supporting Gait2dc.slope ~= 0.
Parameters
objGait2dc class object
xDouble matrix: State vector of model for n time points (Gait2dc.nStates x n)
markerTableTable: Variables table specifying markers with at least the columns: type, name, segment, position, direction to call Gait2dc.simuMarker.
measuredMean(optional) Double matrix: Measured marker data in meter(!) which will be plotted as reference. The matrix must have the same number of time points as the state vector x. Further, the matrix columns must correspond to the rows of the markerTable in the same order to be able to match coordinates of the markers. (n x height(markerTable)) (default: empty)

◆ showStick() [1/2]

virtual showStick ( in  obj,
in  x 
)
virtualinherited

Abstract function to show model as stick figure.

◆ showStick() [2/2]

function showStick ( in  obj,
in  x,
in  range,
in  plotFeet,
in  plotGRF,
in  plotCPs,
in  plotJointCOSYs 
)

Function to show model as stick figure.

Todo:
If the slope ~= 0, the ranges are not perfect yet. If ranges are given, they will not be kept constant. If no ranges are given, the stick figures are not perfectly centered.
Parameters
objGait2dc class object
xDouble matrice: State vector of model for n time points (Gait2dc.nStates x n)
range(optional) Double matrice: Defining the range of the figure with [xmin, xmax; ymin, ymax]. (2 x 2) (default: [pelvisX-1, pelvisX+1; -0.2, 2])
plotFeet(optional) Bool: If true, the undeformed feet are plotted independently from the CPs (default: 0)
plotGRF(optional) Bool: If true, it plots arrows for the GRFs (default: 0)
plotCPs(optional) Bool: If true, it plots spheres for the CPs (default: 0)
plotJointCOSYs(optional) Bool: If true, it plots the coordinate systems of the joints (default: 0)

◆ showTreadmill()

function showTreadmill ( in  obj,
in  x_points,
in  y_points,
in  xrange,
in  yrange,
in  durTrial,
in  nFrames 
)

Function to visualize treadmill as moving scatter plot.

Parameters
objGait2dc class object
xpointsDouble matrix: Defining the x - positions of scatter plot in current frame representing the treadmill
ypointsDouble matrix: Defining the y - positions of scatter plot in current frame representing the treadmill
xrangeDouble matrix: Defining the range of the figure with [xmin, xmax]. (2 x 1)
yrangeDouble matrix: Defining the range of the figure with [ymin, ymax]. (2 x 1)
durTrialDouble: duration of gait cycle
nFramesInteger: number of Nodes
Return values
x_pointsDouble matrix: Updated x_points accrording to treadmill speed
y_pointsDouble matrix: Updated y_points accrording to treadmill speed

◆ simuAccGyro() [1/2]

virtual simuAccGyro ( in  obj,
in  data,
in  q,
in  qd,
in  qdd 
)
virtualinherited

Abstract function to simulate acceleration and gyroscope signals.

◆ simuAccGyro() [2/2]

function simuAccGyro ( in  obj,
in  variables,
in  q,
in  qd,
in  qdd,
in  idxSegment,
in  idxAcc,
in  idxGyro,
in  dlocalAll,
in  plocalAll 
)

Function to simulate acceleration and gyroscope signals.

Do not change "obj" or "variables" in this function! This will allow Matlab to "pass by reference" and avoid function call overhead.

Position has to given as X and Y position of sensor in segment coordinate system in m.

Direction has to be given in axis definition, e.g [1, 0, 0].

Parameters
objGait2dc class object
variablesTable: Variable table containing the accelerometer and gyroscope data with at least the columns: type, name, segment, position, direction
qGeneralized coordinates (Gait2dc.nDofs x 1)
qdFirst derivatives of generalized coordinates (Gait2dc.nDofs x 1)
qddSecond derivatives of generalized coordinates (Gait2dc.nDofs x 1) (use NaN to skip)
idxSegment(optional) Double array: Indices of segments fitting to respective IMU (variables.nVars.all x 1) => It is faster to pass them than to recalculate each time.
idxAcc(optional) Double array: Indices in variables that have type 'acc' (nAcc x 1) => It is faster to pass them than to recalculate each time.
idxGyro(optional) Double array: Indices in variables that have type 'gyro' (nGyro x 1) => It is faster to pass them than to recalculate each time.
dlocalAll(optional) Double matrix: Local direction of the IMU saved in variables (variables.nVars.all x 3) => It is faster to pass them than to extract them each time.
plocalAll(optional) Double matrix: Local position of the IMU saved in variables (variables.nVars.all x 3) => It is faster to pass them than to extract them each time.
Return values
sSimulated sensor signals (data.nVars.all x 1)
ds_dqSparse Jacobian ds/dq (data.nVars.all x Gait2dc.nDofs)
ds_dqdSparse Jacobian ds/dqd (data.nVars.all x Gait2dc.nDofs)
ds_dqddSparse Jacobian ds/dqdd (data.nVars.all x Gait2dc.nDofs)

◆ simuMarker()

function simuMarker ( in  obj,
in  variables,
in  q,
in  idxSegment,
in  plocalAll,
in  dlocalAll 
)

Matlab function to simulates markers placed on 2D model.

Do not change "obj" or "variables" in this function! This will allow Matlab to "pass by reference" and avoid function call overhead.

Position has to given as X, Y (and Z) position of marker in segment coordinate system in m. Direction has to be given in axis definition, e.g [1, 0, 0]. For position and direction, we will use only the first two entries for the 2D model.

Parameters
objGait2dc class object
variablesTable: Variable table containing the marker data with at least the columns: type, name, segment, position, direction
qDouble array: Generalized coordinates (Gait2dc.nDofs x 1)
idxSegment(optional) Double array: Indices of segments fitting to respective markers (variables.nVars.all x 1) => It is faster to pass them than to recalculate each time.
plocalAll(optional) Double matrix: Local position of the markers saved in variables (variables.nVars.all x 2(or3)) => It is faster to pass them than to extract them each time.
dlocalAll(optional) Double matrix: Local direction of the markers saved in variables (variables.nVars.all x 2(or3)) => It is faster to pass them than to extract them each time.
Return values
mSimulated marker signals in meter (variables.nVars.all x 1)
dm_dqSparse Jacobian dm/dq (variables.nVars.all x Gait2dc.nDofs)

◆ update_constraints()

function update_constraints ( in  obj)
protectedvirtual

Function defining the table Gait2dc.constraints.

Table lists type, name, equation (string), fmin and fmax

The constraints are composed of Gait2dc.nConstraints = 2* Gait2dc.nDofs + 2* Gait2dc.nMus + 4* Gait2dc.nCPs

Parameters
objGait2dc class object

Reimplemented from Model.

◆ update_controls()

function update_controls ( in  obj)
protectedvirtual

Function defining the table Gait2dc.controls.

Table lists type, name, xmin, xmax and xneutral

Parameters
objGait2dc class object

Reimplemented from Model.

◆ update_idxControls()

function update_idxControls ( in  obj)
protectedinherited

Function defining Model.hidxControls.

Parameters
objModel class object

◆ update_idxcxCP()

function update_idxcxCP ( in  obj)
protected

Function defining Gait2dc.idxcxCPleft and Gait2dc.idxcxCPright.

Parameters
objGait2dc class object

◆ update_idxForward()

function update_idxForward ( in  obj)
protectedinherited

Function defining Model.idxForward.

Provides the indices of state variables that have forward translation. States have to be updated before!

Parameters
objModel class object

◆ update_idxForwardAll()

function update_idxForwardAll ( in  obj)
protectedinherited

Function defining Model.idxForwardAll.

Provides the indices of state variables that have forward translation, speed, position of contact points and force at contact points. States and idxForward have to be updated before!

Parameters
objModel class object

◆ update_idxParamSections()

function update_idxParamSections ( in  obj,
in  src,
in  evnt 
)
protected

Function performed to update start indices of sections in Gait2dc.parameter.

Parameters
objGait2dc class object
src(optional) meta.property: Object describing the source of the event
evnt(optional) event.Propertyevent: Object describing the event

◆ update_idxSideward()

function update_idxSideward ( in  obj)
protectedinherited

Function defining Model.idxSideward.

Provides the indices of state variables that have sideward translation. States have to be updated before!

Parameters
objModel class object

◆ update_idxSidewardAll()

function update_idxSidewardAll ( in  obj)
protectedinherited

Function defining Model.idxSidewardAll.

Provides the indices of state variables that have sideward translation, speed, position of contact points and force at contact points. States and idxSideward have to be updated before!

Parameters
objModel class object

◆ update_idxStates()

function update_idxStates ( in  obj)
protectedinherited

Function defining Model.hidxStates.

Parameters
objModel class object

◆ update_idxSymmetry()

function update_idxSymmetry ( in  obj)
protectedvirtual

Function defining Gait2dc.idxSymmetry.

Parameters
objGait2dc class object

Reimplemented from Model.

◆ update_idxTorqueDof()

function update_idxTorqueDof ( in  obj)
protectedinherited

Function defining Model.idxTorqueDof.

Searches for indices of dof which have torque actuators in Model.torques.

Parameters
objModel class object

◆ update_idxUpward()

function update_idxUpward ( in  obj)
protectedinherited

Function defining Model.idxUpward.

Provides the indices of state variables that have upward translation. States have to be updated before!

Parameters
objModel class object

◆ update_mexParameter()

function update_mexParameter ( in  obj,
in  src,
in  evnt 
)
protectedvirtual

Function performed to update the Gait2dc.parameter, the mex and the tables.

  • Called with a PostSet event after set lambda, bodyheight, bodymass, gravity, drag_coefficient, wind_speed, slope, joints, muscles, CPs, dofs, segments.
  • Reinitializes mex with new parameter matrixs.
  • This function calls all the other update functions. If we would also add a listener for them, we could not ensure that they are called in the correct order!
Parameters
objGait2dc class object
srcmeta.property: Object describing the source of the event
evnt(optional) event.Propertyevent: Object describing the event

Reimplemented from Model.

◆ update_states()

function update_states ( in  obj)
protectedvirtual

Function defining the table Gait2dc.states.

Table lists type, name, xmin, xmax and xneutral

Todo:
Variables of contact points of neutral position shouldn't be zero.
Parameters
objGait2dc class object

Reimplemented from Model.

Member Data Documentation

◆ bodyheight

Property bodyheight
protected

Double: Bodyheight in m (default: 1.80)

◆ bodymass

Property bodymass
protected

Double: Bodymass in kg (default: 75)

◆ constraints

Property constraints
protectedinherited

Table: Information on constraints implemented in the mex and here.

◆ controls

Property controls
protectedinherited

Table: Information on controls of the model.

◆ CPs

Property CPs
inherited

Table: Contact points.

◆ dofs

Property dofs
inherited

Table: Degrees of freedom (Range of Dofs should not be changed here.

Set the bounds of the Problem instead.)

◆ drag_coefficient

Property drag_coefficient
inherited

Double: Air drag coefficient in N/(m/s)^2 (default: 0.2128)

◆ excelfile

Property excelfile
protected

String: Filename of parameter file including path and extension.

◆ foot

Property foot
protected

Table: Defining size of feet for visualization.

The x and y coordinates are defined relative to the ankle joint in m. The length of the foot is equal to the length of the foot segment defined in the table Gait2dc.segments. The size of the foot does not influence the ground contact.

◆ FOOTSOLEOFFSET

Constant Property FOOTSOLEOFFSET = 0.0702

Double: Distance between foot sole and ankle joint in m.

◆ gravity

Property gravity
inherited

Double array: Gravity vector in m/(s^2)

◆ GRFNAMES

Constant Property GRFNAMES = {'rightFx', 'rightFy', 'rightFz', 'rightMx', 'rightMy', 'rightMz', 'leftFx', 'leftFy', 'leftFz', 'leftMx', 'leftMy', 'leftMz' }
inherited

Cell array with string: Gives the names for the GRF vector returned by getGRF()

◆ HEELDEFAULTOFFSET

Constant Property HEELDEFAULTOFFSET = 0.06

Double: Distance between heel and ankle joint for default body height in m.

◆ idxcxCPleft

Property idxcxCPleft
protected

Double array: Indices for x position of left contact points.

◆ idxcxCPright

Property idxcxCPright
protected

Double array: Indices for x position of right contact points.

◆ idxForward

Property idxForward
protectedinherited

Double array: Indices for forward translation.

◆ idxForwardAll

Property idxForwardAll
protectedinherited

Double array: Indices for forward translation, speed, position of contact points and force at contact points.

◆ idxParamSections

Property idxParamSections
protected

Double array: Start indices of sections in Gait2dc.parameter.

◆ idxSideward

Property idxSideward
protectedinherited

Double array: Indices for sideward translation.

◆ idxSidewardAll

Property idxSidewardAll
protectedinherited

Double array: Indices for sideward translation, speed, position of contact points and force at contact points.

◆ idxSymmetry

Property idxSymmetry
protectedinherited

Struct: Double arrays with indices for symmetry to map right to left.

◆ idxTorqueDof

Property idxTorqueDof
protectedinherited

Double array: Indices of dofs of torque actuators.

◆ idxUpward

Property idxUpward
protectedinherited

Double array: Indices for upward translation.

◆ init

Property init
protectedinherited

Double: Showing if the mex model is initialized.

◆ joints

Property joints
inherited

Table: Joints.

◆ lambda

Property lambda

Double array: Lambda values (default: [0.01 0.1]) (1x2)

◆ mExtraScaleFactor

Property mExtraScaleFactor
inherited

Double: Scale factor for extra torques in Nm (default: 100 since we used this in previous simulations.

However, it's probably overwritten in the construction (see Gait3d.m)!)

◆ muscles

Property muscles
inherited

Table: Muscles.

◆ nConstraints

Property nConstraints
protectedinherited

Double: Number of constraints (height of Model.constraints)

◆ nControls

Property nControls
protectedinherited

Double: Number of controls (height of Model.controls)

◆ nCPs

Property nCPs
protectedinherited

Double: Number of contact points (height of Model.CPs)

◆ nDofs

Property nDofs
protectedinherited

Double: Number of degree of freedoms (height of Model.dofs)

◆ nJoints

Property nJoints
protectedinherited

Double: Number of joints (height of Model.joints)

◆ nMus

Property nMus
protectedinherited

Double: Number of muscles (height of Model.muscles)

◆ nSegments

Property nSegments
protectedinherited

Double: Number of segments (height of Model.segments)

◆ nStates

Property nStates
protectedinherited

Double: Number of states (height of Model.states)

◆ nTor

Property nTor
protectedinherited

Double: Number of torque actuators (height of Model.torques)

◆ parameter

Property parameter
protected

◆ segments

Property segments
protectedinherited

Table: Segments (Segment properties should not be changed)

◆ slope

Property slope

Double: Slope of ground in deg (positive is uphill)

◆ speed_left

Property speed_left
protected

Double: Speed of simulated additional Treadmill.

◆ speed_right

Property speed_right
protected

◆ states

Property states
protectedinherited

Table: Information on states of the model.

◆ TOEOFFSET

Constant Property TOEOFFSET = 0.05

Double: Distance between toe and CP toe in m.

◆ torques

Property torques
inherited

Table: Torque actuators.

◆ wind_speed

Property wind_speed
inherited

Double: Wind speed in direction of +X in m/s (default: 0)


The documentation for this class was generated from the following file: