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 | Static Protected Member Functions | Protected Attributes | List of all members
Gait2d_osim Class Reference

The class describes the Gait2d_osim model. More...

Inheritance diagram for Gait2d_osim:
Model handle

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 Gait2d_osim (in opensimfile, in scale_factors, in bodymass, in varargin)
 Constructor setting default Gait2d_osim 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 computing implicit differential equation for 3D 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 q, in qdot)
 Function returns position and orientation of body segments, for the system in position q.
 
function getGRF (in obj, in x)
 Function returns 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 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 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 returns muscle forces, 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 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 simuMarker (in obj, in variables, in q, in idxSegment, in plocalAll, in dlocalAll)
 Matlab function to simulates markers placed on 3D model.
 

Static Public Member Functions

function getMexFiles (in osimName, in rebuild_contact, in debugMode)
 Function to make MEX functions.
 
static function plotgrf (in F, in CoP, in color)
 Function used in showStick() to plot GRFs.
 

Public Attributes

Property bodyheight
 
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)
 
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()
 
Property joints
 Table: Joints.
 
Property markers
 Table: Markers (Containing also the CPs. Their names start with 'CP')
 
Property mExtraScaleFactor
 Double: Scale factor for extra torques in Nm (default: 100 since we used this in previous simulations.
 
Property muscles
 Table: Muscles.
 
Property segmentsTable
 Copy of the segments Table from Model.m, to allow easy access for.
 
Property torques
 Table: Torque actuators.
 
Property wind_speed
 Double: Wind speed in direction of +X in m/s (default: 0)
 

Protected Member Functions

function add_listeners (in obj)
 Function to add Listeners to the obj.
 
function computeMomentArms (in obj, in range_muscleMoment, in examine, in name)
 Function to generate muscle length polynomials from Opensim muscle paths.
 
function initMex (in obj)
 Initialize model mex file.
 
function initModel (in obj)
 Function to initialize model with default parameters.
 
virtual initModel (in obj, in vargin)
 Abstract function to initialize with default parameters.
 
function loadMomentArms (in obj)
 Function to load or compute moment arms.
 
function loadOsimFile (in obj, in osimfile)
 Function to load the content from the opensim file.
 
function simplifyFoot (in obj)
 Function to convert OpenSim's complicated foot into a singular bone.
 
function update_constraints (in obj)
 Function defining the table Gait2d_osim.constraints.
 
function update_controls (in obj)
 Function defining the table Gait2d_osim.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_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 Gait2d_osim.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 parameter of the mex and the tables.
 
function update_states (in obj)
 Function defining the table Gait2d_osim.states.
 

Static Protected Member Functions

function readOsim (in osimfile)
 Function to load OpenSim model in Matlab as structure.
 
function scaleOsim (in opensimfile, in scale_factors, in bodymass, in varargin)
 Function to scale OpenSim model.
 

Protected Attributes

Property bodymass
 Double: Bodymass in kg (Is computed by summing up all body mass except talus.
 
Property constraints
 Table: Information on constraints implemented in the mex and here.
 
Property controls
 Table: Information on controls of the model.
 
Property hash
 hash: Hash to link the .tmp osim model
 
Property hdlMEX
 Handle: MEX function of the model for dynamics etc.
 
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 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 nMarkers
 Double: Number of markers (height of Gait2d_osim.markers)
 
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 osim
 Struct: Information (name, file, modified, sha256) on opensim model.
 
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 Gait2d_osim model.

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

Constructor & Destructor Documentation

◆ Gait2d_osim()

function Gait2d_osim ( in  opensimfile,
in  scale_factors,
in  bodymass,
in  varargin 
)

Constructor setting default Gait2d_osim object.

Initializes the model and builds and initializes the mex function. The mex functions can be also build with other options if Gait2d_osim.getMexFiles(osimName) is called before the constructor is called.

Sets a new default for Gait2d_osim.mExtraScaleFactor: 10 Nm

The standard model can be called using:

Gait2d_osim('gait10dof18musc.osim')
The class describes the Gait2d_osim model.
Definition: Gait2d_osim.m:18

The osim file must be in the matlab path.

Parameters
scale_factorsString, List or Float: .trc marker
bodyweightFloat: bodyweight in kg
opensimfileString: Opensim file with path, name and extension
Return values
objGait2d_osim class object

Member Function Documentation

◆ add_listeners()

function add_listeners ( in  obj)
protected

Function to add Listeners to the obj.

  • PostSet event listeners enable reinitialition for mex with new parameters.
Parameters
objGait2d_osim class object

◆ computeMomentArms()

function computeMomentArms ( in  obj,
in  range_muscleMoment,
in  examine,
in  name 
)
protected

Function to generate muscle length polynomials from Opensim muscle paths.

For each muscle, the generalized coordinates are moved through their entire range, in a specified number of steps (currently 6). So for a muscle that spans 4 dofs, we will examine 6^4 = 1296 poses. For each pose, the Opensim API is used to obtain the moment arms of the muscle. Also the API is used to obtain the muscle-tendon length when all generalized coordinates are zero.

Stepwise regression is done on the moment arm data to produce the best set of polynomial terms. The addition of terms stops when one of the following is true:

  1. RMS difference between moment arms from Opensim and polynomial, relative to the largest moment arm, is less than "relerror" (currently 0.05)
  2. Adding another term would decrease the RMS difference by less than "minerrorchange" (currently 0.01)
  3. The maximum number of terms (currently 40) has been reached.

The examine option is intended for model developers to inspect the polynomials and make sure they are good enough. When regenerating polynomials for a model that has already been tested, the examine and name options should not be used.

Saves results at strrep(settings.osimfile, '.osim', '_momentarms.mat')

Parameters
objGait2d_osim class object
range_muscleMomentTable: Ranges of DOFs which were used to fit polynomials
examine(optional, default 0) when 1: plots results for each muscle and pauses for inspection
name(optional) name of the muscle that should be processed (when missing, all are done)
Return values
momentarm_modelStruct: Resulting polynomials which are also saved at strrep(settings.osimfile, '.osim', '_momentarms.mat')

◆ 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)

◆ 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 computing implicit differential equation for 3D musculoskeletal model.

This function calls the mex file of gait2d_osim.c: [f, dfdx, dfdxdot, dfdumus, dfdMextra] = obj.hdlMEX('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
objGait2d_osim class object
xDouble array: State of the model (Gait2d_osim.nStates x 1)
xdotDouble array: State derivatives (Gait2d_osim.nStates x 1)
uDouble array: Controls of the model (Gait2d_osim.nControls x 1)
Return values
fDouble array: Dynamic residuals (Gait2d_osim.nConstraints x 1)
dfdx(optional) Double matrix: Transpose of Jacobian matrix df/dx (Gait2d_osim.nStates x Gait2d_osim.nConstraints)
dfdxdot(optional) Double matrix: Transpose of Jacobian matrix df/dxdot (Gait2d_osim.nStates x Gait2d_osim.nConstraints)
dfdu(optional) Double matrix: Transpose of Jacobian matrix df/du (Gait2d_osim.nControls x Gait2d_osim.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  q,
in  qdot 
)

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

Needed for tracking of marker trajectories, and for 3D visualization of the model. This function calls the mex file of gait2d_osim.c [FK, dFKdq,dFKdotdq] = obj.hdlMEX('Fkin', q, qdot);

The order the following for each segment:

'p1', 'p2', 'p3', 'R11', 'R12', 'R13', 'R21', 'R22', 'R23', 'R31', 'R32', 'R33'

p can be obtained by:

p = FK((idxCurSegment-2)*12 + (1:3));

R can be obtained by:

R = reshape(FK((idxCurSegment-2)*12 + (4:12)), 3, 3)';
Parameters
objGait2d_osim class object
qDouble array: Generalized coordinates (elements of states with type 'q') (Gait2d_osim.nDofs x 1)
qdot(optional) Double array: Generalized velocities (elements of states with type 'qdot') (Gait2d_osim.nDofs x 1)
Return values
FKDouble array: position (2) and orientation (2x2, stored row-wise) of nSegments-1. Segments are the bodies in the .osim model, not including ground. ((Gait2d_osim.nSegments-1) * 6)
dFKdq(optional) Double matrix: Jacobian of FK with respect to q ((Gait2d_osim.nSegments-1) * 6 x Gait2d_osim.nDofs)
dFKdotdq(optional) Double matrix: Jacobian of dFK/dt with respect to q ((Gait2d_osim.nSegments-1) * 6 x Gait2d_osim.nDofs)

◆ getGRF()

function getGRF ( in  obj,
in  x 
)
virtual

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

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

Parameters
objGait2d_osim class object
xDouble array: State of the model (Gait2d_osim.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 (Gait2d_osim.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 (e.g. arms).

Parameters
objGait2d_osim class object
xDouble array: State of the model (Gait2d_osim.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) (Gait2d_osim.nControls x 1)
Return values
MDouble array: Moment/force for each DOF (Gait2d_osim.nDofs x 1)
dMdx(optional) Double matrix: Transpose of Jacobian matrix dM/dx (Gait2d_osim.nStates x Gait2d_osim.nDofs)
dMdu(optional) Double matrix: Transpose of Jacobian matrix dM/du (Gait2d_osim.nControls x Gait2d_osim.nDofs)

Reimplemented from Model.

◆ 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 ( in  osimName,
in  rebuild_contact,
in  debugMode 
)
static

Function to make MEX functions.

Generates Autolev source file for model and builds the MEX function

Parameters
osimNameString: Name of Opensim model. Currently, the following is supported:
  • 'gait10dof18musc' and 'gait2d_osim'
rebuild_contact(optional) Bool: If true, enforce rebuilding contact_raw.c (default: 0)
debugMode(optional) Bool: If true, code will be compiled in debug mode and not optimized. (default: 0)
Return values
name_MEXString: Name of the mex function which has to be called

◆ 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 gait2d_osim.c: [forces] = obj.hdlMEX('MuscleCEforces', x);

Parameters
objGait2d_osim class object
xDouble array: State of the model (Gait2d_osim.nStates x 1)
xdotDouble array: State derivatives (Gait2d_osim.nStates x 1)
Return values
forcesCEDouble array: Muscle forces of CE (in N) (Gait2d_osim.nMus x 1)
dforcesCEdxDouble array: Transpose of Jacobian matrix d force / d x (Gait2d_osim.nStates x Gait2d_osim.nMus)
dforcesCEdxdotDouble array: Transpose of Jacobian matrix d force / d xdot (Gait2d_osim.nStates x Gait2d_osim.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
objGait2d_osim class object
xDouble array: State of the model (Gait2d_osim.nStates x 1)
xdotDouble array: State derivatives (Gait2d_osim.nStates x 1)
Return values
powersDouble array: CE power output (W) of each muscle (Gait2d_osim.nMus x 1)
conDynResDouble array: Contraction dynamics residuals (Gait2d_osim.nMus x 1)

Reimplemented from Model.

◆ getMuscleforces()

function getMuscleforces ( in  obj,
in  x 
)
virtual

Function returns muscle forces, for the system in state x.

This function calls the mex file of gait2d_osim.c: [forces, lengths, momentarms] = obj.hdlMEX('Muscleforces', x);

Parameters
objGait2d_osim class object
xDouble array: State of the model (Gait2d_osim.nStates x 1)
Return values
forcesDouble array: Muscle forces (N) (Gait2d_osim.nMus x 1)
lengths(optional) Double array: Muscle-tendon lengths (m) (Gait2d_osim.nMus x 1)
momentarms(optional) Double matrix: Muscle moment arms (m) (Gait2d_osim.nMus x Gait2d_osim.nDofs)

Reimplemented from Model.

◆ initMex()

function initMex ( in  obj)
protectedvirtual

Initialize model mex file.

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

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

Input: model Struct containing model parameters.

Output: info Struct with information about the size of the model, fields: Nx Number of state variables: 2* Gait2d_osim.nDofs + 2* Gait2d_osim.nMuscles + 9* Gait2d_osim.nCPs Nf Number of functions returned by the Dynamics function fmin,fmax Lower and upper bounds for dynamics residuals f Bodyweight Sum of weights of all segments. This is used to set bodymass

Parameters
objGait2d_osim class object

Reimplemented from Model.

◆ initModel() [1/2]

function initModel ( in  obj)
protected

Function to initialize model with default parameters.

Initialialize contact points, alignment and stiffness of dofs

Parameters
objGait2d_osim class object

◆ initModel() [2/2]

virtual initModel ( in  obj,
in  vargin 
)
protectedvirtualinherited

Abstract function to initialize with default parameters.

Reimplemented in Gait2dc.

◆ loadMomentArms()

function loadMomentArms ( in  obj)
protected

Function to load or compute moment arms.

Loads moment arms save in the file strrep(obj.osim.file,'.osim','_momentarms.mat'). If there is not such a file, the moment arms will be computed and saved.

We define here also the ranges of the dofs used to get the muscle moments and the ones used to get the passive moments:

  • range_muscleMoment: They were manually tune to result in good polynomials.
  • range_passiveMoment: By default, they are equal to the ranges used for the muscle moments. But for the arms, we smaller the range of the osim file by 2 degrees at each boundary (e.g. range_osim = [-90, 90], range_passiveMoment = [-88, 88])
Parameters
objGait2d_osim class object

◆ loadOsimFile()

function loadOsimFile ( in  obj,
in  osimfile 
)
protected

Function to load the content from the opensim file.

Calls readOsim() if there is no .mat file corresponding to the requested osimfile. Therefore it searches for a file called strrep(osimfile, '.osim', '.mat') and checks the sha code to see weather the .mat file is still up to date with the opensim file.

Parameters
objGait2d_osim class object
osimfileString: Filename of opensim file including path and extension

◆ plotgrf()

static function plotgrf ( in  F,
in  CoP,
in  color 
)
static

Function used in showStick() to plot GRFs.

Plots a ground reaction force vector represented by 3D force and CoP.

Parameters
FDouble array: Force (3 x 1)
CoPDouble array: Center of pressure in x, y, z coordinates (3 x 1)
colorString: Color (e.g. color = 'r')

◆ readOsim()

function readOsim ( in  osimfile)
staticprotected

Function to load OpenSim model in Matlab as structure.

Saves the model struct using strrep(osimfile, '.osim', '.mat').

Parameters
osimfileString: Filename of opensim file including path and extension
Return values
modelStruct: Parameters of OpenSim model

◆ scaleOsim()

function scaleOsim ( in  opensimfile,
in  scale_factors,
in  bodymass,
in  varargin 
)
staticprotected

Function to scale OpenSim model.

Saves the model struct using strrep(osimfile, '.osim', '.mat').

Parameters
opensimfileString: Filename of opensim file including path and extension
scale_factorsString, List or Float: .trc marker
bodyweightFloat: bodyweight in kg
Return values
opensimfile_tmpString: Path to the tmp_osim model
hashString: Hash to check whether the model was created before
Todo:
: .trc/xml scaling; load scalefactors from table?

◆ 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
Parameters
objGait2d_osim class object
xDouble matrix: State vector of model for n time points (Gait2d_osim.nStates x n)
markerTableTable: Variables table specifying markers with at least the columns: type, name, segment, position, direction to call Gait2d_osim.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  plotGRF,
in  plotCPs,
in  plotJointCOSYs 
)

Function to show model as stick figure.

Parameters
objGait2d_osim class object
xDouble matrice: State vector of model for n time points (Gait2d_osim.nStates x n)
range(optional) Double matrice: Defining the range of the figure with [xmin, xmax; ymin, ymax, zmin, zmax]. (3 x 2) (default: [pelvisX-1, pelvisX+1; -0.2, 2, pelvisZ-1, pelvisZ+1])
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
objGait2d_osim 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

◆ simplifyFoot()

function simplifyFoot ( in  obj)
protected

Function to convert OpenSim's complicated foot into a singular bone.

Adds the mass, inertial properties of the talus, calcn, toes

Parameters
FDouble array: Force (3 x 1)
CoPDouble array: Center of pressure in x, y, z coordinates (3 x 1)
colorString: Color (e.g. color = 'r')

◆ simuAccGyro()

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

Abstract function to simulate acceleration and gyroscope signals.

◆ simuMarker()

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

Matlab function to simulates markers placed on 3D 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].

Parameters
objGait2d_osim class object
variablesTable: Variable table containing the marker data with at least the columns: type, name, segment, position, direction
qDouble array: Generalized coordinates (Gait2d_osim.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 3) => 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 Gait2d_osim.nDofs)

◆ update_constraints()

function update_constraints ( in  obj)
protectedvirtual

Function defining the table Gait2d_osim.constraints.

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

The constraints are composed of Gait2d_osim.nConstraints = 2* Gait2d_osim.nDofs + 2* Gait2d_osim.nMus + 13* Gait2d_osim.nCPs)

Parameters
objGait2d_osim class object

Reimplemented from Model.

◆ update_controls()

function update_controls ( in  obj)
protectedvirtual

Function defining the table Gait2d_osim.controls.

Table lists type, name, xmin, xmax and xneutral

Parameters
objGait2d_osim 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_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 Gait2d_osim.idxSymmetry.

Parameters
objGait2d_osim 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 parameter of the mex and the tables.

Parameters
objGait2d_osim 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 Gait2d_osim.states.

Table lists type, name, xmin, xmax and xneutral

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

Reimplemented from Model.

Member Data Documentation

◆ bodyheight

Property bodyheight

◆ bodymass

Property bodymass
protected

Double: Bodymass in kg (Is computed by summing up all body mass except talus.

See gait2d_osim.m)

Todo:
Is is not nice that the talus is missing in the computation of the bodyweight.

◆ 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)

◆ 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()

◆ hash

Property hash
protected

hash: Hash to link the .tmp osim model

◆ hdlMEX

Property hdlMEX
protected

Handle: MEX function of the model for dynamics etc.

◆ 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.

◆ 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.

◆ markers

Property markers

Table: Markers (Containing also the CPs. Their names start with 'CP')

◆ 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)

◆ nMarkers

Property nMarkers
protected

Double: Number of markers (height of Gait2d_osim.markers)

◆ 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)

◆ osim

Property osim
protected

Struct: Information (name, file, modified, sha256) on opensim model.

◆ segments

Property segments
protectedinherited

Table: Segments (Segment properties should not be changed)

◆ segmentsTable

Property segmentsTable

Copy of the segments Table from Model.m, to allow easy access for.

◆ 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.

◆ 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: