### RTSX Help: Create a robot link

A Link data structure holds all information related to a robot link, such as DH parameters, rigid-body inertial parameters, motor and transmission parameters.

### Input Arguments

• lparam  — a   1 x 4 or 1 x 5 vector consisting of DH parmeters and offset in this order [ theta d a alpha (offset)], where link offset is optional.
• jtype — joint type ‘R’ = revolute (default), ‘P’ = prismatic

### Output Arguments

• L — link data structure containing the following fields
• sigma, (RP) — joint type: 0 (‘R’) = revolute, 1 (‘P’) = prismatic
• theta — kinematic: joint angle
• d — kinematic: link offset
• a — kinematic: link length
• alpha — kinematic: link twist angle
• offset — kinematic: joint variable offset
• mdh — kinematic: 0 = standard DH, 1 = modified DH
• qlim — kinematic: joint variable limits [min max]
• m — dynamic: link mass
• r — dynamic: link center of gravity w.r.t link coordinate frame ,1 x 3 vector
• B — dynamic: link viscous friction
• Tc — dynamic: link Coulomb friction
• G — actuator: gear ratio
• Jm — actuator: motor inertia

### Options

Note : options in [ ] must be passed to the function in pairs.

• [ ‘dhtype’, (choice)] — type of DH parameters. Pass 0 (or ‘sdh’) for standard DH, and 1 (or ‘mdh’) for modified DH.
• [ ‘qlim’, [qmin qmax]] — joint variable limits. Pass minimum and maximum values in a 1×2 vector as shown.
• [ ‘dynparm’, [1 x 15 dynamic parameters]] — complete dynamic parameter assignment with a 1 x 15 vector in this order

[r(1×3), I(1×6), m, Jm, G, B, Tc(1×2)] .
• [ ‘r’, [values]] — link center of gravity, 1 x 3 vector.
• [ ‘i’, [values]] — link inertia matrix, 1 x 6 vector.
• [ ‘m’, value] — link mass
• [ ‘jm’, value] — motor inertia
• [ ‘g’, value] — motor gear ratio
• [ ‘b’, [values]] — link coulomb friction, 1 x 2 vector

### Description

A physical robot can be thought of as a mechanical structure built from links and joints connected in series. This concept can be brought into software model by creating a data structure containing link and joint information. Link( ) is the first step in such modeling process. We use the function to construct a link data structure with kinematic, dynamic, and some other essential parameters, then pass the link structure to SerialLink( ) to form a robot model.

The only required arguments for Link( ) are the 4 DH parameters. A link with revolute joint is returned by default, unless prismatic joint type ‘P’ is specified. Other parameters can be passed at creation or filled in later by UpdateRobotLink( ).

### Examples

```L = Link([0 1 1 pi/2]); // create a single revolute link, d=1, a=1, alpha=pi/2 // and theta is joint variable   // create a structure of links L(1) = Link([0 0 1 0]); L(2) = Link([pi/2 1 0 0],'P'); // link 2 is prismatic d=variable with initial value 1 // Note: if one wants to assign other options such as dynamic parameters, joint type // must be specified for both R and P types. Cannot leave as default. L(3) = Link([0 0 2 pi],'R','m',0.43,'r',[0, 0.018, 0],'qlim',[-pi/2 pi/2]);```