Global evaluations

Kinematic parameters

Extraction of variable list

vars = ExtractVariables[DH] ;

Dynamic parameters

If not present, add zero mass for link 0

If[Length[mass] < Length[DH], mass = {0} ~ Join ~ mass] ;

If not present, add zero inertia tensor for link 0

If[Length[inertia] <Length[DH], inertia = {Table[0, {3}, {3}]} ~ Join ~ inertia] ;

If not present, add zero Pc vector for link 0

If[Length[Pc] <Length[DH], Pc = {Table[0, {3}]} ~ Join ~ Pc] ;

Group parameters

dyn = {DH, inertia, mass, Pc} ;

Assignment of gravity vector

a[dh_, 0, 0] := gravityVector ;

Numerical parameters

Numerical value for gravity

RowBox[{RowBox[{ng, =, RowBox[{{, RowBox[{g, , 9.81}], }}]}],  , ;}]

Conversion of model parameters to rules list

modelParameters = ConvertTableToRules[modelParameterTable] // N ;

Conversion of actual robot parameters to rules list

robotParameters = ConvertTableToRules[robotParameterTable] // N ;

Numerical values for DH parameters

nDH = DH /. robotParameters ;

Nice display of global user definitions

Display of DH parameters

DH //TraditionalForm

( 0         0         0         θ1   0       )            0         L1        0         θ2   0            0         L2        0         0         0

Display of mass parameters

mass // DisplayMatrixOrVector

( 0  )            m1            m2

Display of inertia tensors

DisplayManipulatorInertiaTensor[inertia, 1] DisplayManipulatorInertiaTensor[inertia, 2]

^C_1 I_1  ( 0   0   0 )                              0   0   0                              0   0   0

^C_2 I_2  ( 0   0   0 )                              0   0   0                              0   0   0

Display of center-of-mass vectors

Pc // TraditionalForm

( 0    0    0  )            L1   0    0            L2   0    0

Display of model parameters

modelParameterTable // TraditionalForm

modelParameterTable

Display of actual robot parameters

robotParameterTable // TraditionalForm

(         )            L1   1                 1                -           L2   2              m1   1                 1                -           m2   2

Robot dynamics (potentially computationally intensive)

Compute robot dynamics in form: τ = M(Θ) + V(Θ, Overscript[Θ, .]) + G(Θ)

robot = τAll[dyn] /. robotParameters /. ng ;

Remove semicolons below to view dynamic equations

DisplayManipulatorDynamicModel[robot, 1] DisplayManipulatorDynamicModel[robot, 2]

FormBox[RowBox[{τ1, , RowBox[{RowBox[{RowBox[{-, 0.25}],  , sin(θ2),  , ( ... 2θ2/t^2}], +, RowBox[{0.125,  , ^2θ2/t^2}]}]}], TraditionalForm]

FormBox[RowBox[{τ2, , RowBox[{RowBox[{0.25,  , sin(θ2),  , (θ1/ ... 2θ1/t^2}], +, RowBox[{0.125,  , ^2θ2/t^2}]}]}], TraditionalForm]

Compute robot dynamics in form: Overscript[Θ, ̈] = M(Θ)^(-1)[τ - V(Θ, Overscript[Θ, .]) - G(Θ)]

diffeqs = ManipulatorDiffEqsFromModel[robot, vars] ;

Remove semicolons below to view dynamic equations

DisplayManipulatorDifferentialEquation[diffeqs, DH, 1] DisplayManipulatorDifferentialEquation[diffeqs, DH, 2]

FormBox[RowBox[{^2θ1/t^2, , RowBox[{RowBox[{RowBox[{(, RowBox[{Ro ... {RowBox[{0.1875, }], -, RowBox[{0.0625,  , cos^2(θ2)}]}], )}]}]}]}], TraditionalForm]

FormBox[RowBox[{^2θ2/t^2, , RowBox[{RowBox[{RowBox[{(, RowBox[{Ro ... {RowBox[{0.1875, }], -, RowBox[{0.0625,  , cos^2(θ2)}]}], )}]}]}]}], TraditionalForm]


Created by Mathematica  (November 12, 2003)