M-File Help: trchain2 | View code for trchain2

# trchain2

Chain 2D transforms from string

T = trchain2(s, q) is a homogeneous transform (3x3) that results from compounding a number of elementary transformations defined by the string s. The string s comprises a number of tokens of the form X(ARG) where X is one of Tx, Ty or R. ARG is the name of a variable in MATLAB workspace or qJ where J is an integer in the range 1 to N that selects the variable from the Jth column of the vector q (1xN).

For example:

    trchain('R(q1)Tx(a1)R(q2)Ty(a3)R(q3)', [1 2 3])

is equivalent to computing:

    trot2(1) * transl2(a1,0) * trot2(2) * transl2(0,a3) * trot2(3)

## Notes

- The string can contain spaces between elements or on either side of ARG.
- Works for symbolic variables in the workspace and/or passed in via the vector Q.
- For symbolic operations that involve use of the value pi, make sure you define it first in the workspace: pi = sym('pi');

## See also

trchain, trot2, transl2

© 1990-2014 Peter Corke.