Problem 5:

Here, we generate the workspace of the two-link manipulator numerically, by sweeping the manipulator through all possible angles and plotting the corresponding location of the end-effector.

dh = {{0, 0, 0, θ1, 0}, {0, L1, 0, θ2, 0}, {0, L2, 0, 0, 0}} ; dh // TraditionalForm

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

dh = dh /. {L1 ->2, L2->1}

{{0, 0, 0, θ1, 0}, {0, 2, 0, θ2, 0}, {0, 1, 0, 0, 0}}

P2 = Take[P[dh, 0, 3] // FullSimplify, {1, 2}] ; {#} & /@ P2// TraditionalForm

( 2 cos(θ1) + cos(θ1 + θ2) )            2 sin(θ1) + sin(θ1 + θ2)

tbl = Partition[Flatten[Table[P2 // N, {θ1, 0, π, π/50}, {θ2, -π/2, π, π/50}]], 2] ;

ListPlot[tbl, PlotJoined->False, PlotStyle-> {RGBColor[1, 0, 0]}, FrameTrue] ;

[Graphics:../HTMLFiles/index_52.gif]


Created by Mathematica  (October 21, 2003)