RTSX Help: Construct a robot model from link structure


SerialLink( ) is a function that “assembles” a robot model from a link structure created by Link( ) .


  • robot = SerialLink(L,options)

Input Arguments

  • L –a link data strucure created by Link( )consisting of link and joint parameters ordered from bottom to top.

Output Arguments

  • robot — a robot data structure containing the following fields
    • name — robot name
    • manuf — robot manufacturer
    • nj — number of joints (or links). This field is created automatically by counting links in L.
    • Link(1:nj) — link data with the same parameters inherited from link structure L
    • gravity — direction of gravity [gx gy gz]
    • base — base frame of robot (4 x 4 homogeneous transformation matrix)
    • tool — tool frame of robot (4 x 4 homogeneous transformation matrix)
    • conf — robot configuration string corresponding to joint types from bottom to top. Ex. ‘RRR’, ‘RPR’. This field is created automatically from link data structure L.
    • viewangle — suggested view angle in spherical coordinate [alpha, theta], in degrees
    • comment — general comment string for this robot


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

  • [ ‘name’, ‘robot name’] — give the robot model some name for reference.
  • [ ‘manuf’, ‘robot manufacturer’] — robot manufacturer company name.
  • [ ‘comment’, ‘comment string’] — a comment for this robot.
  • [ ‘viewangle’, [alpha,theta]] — suggested view angle (in degrees) in spherical coordinate. This is used to set up rotation_angle property of a graphic window when the robot is plotted or animated.
  • [ ‘base’, Tb] — specify a base frame for the robot, Tb must be a 4 x 4 homogeneous transformation matrix
  • [ ‘tool’, Tt] — specify a tool frame for the robot, Tt must be a 4 x 4 homogeneous transformation matrix
  • [ ‘gravity’, value] — direction of gravity [gx gy gz]


After a link data structure L is created with Link( ), a robot model can be formed by passing L to SerialLink( ) . In addition to link data already in L, SerialLink( ) adds some global parameters such as robot name and manufacturer, base and tool frames, gravity information (if provided). It also creates and fills in useful information such as number of joints and joint configuration.

While assembling a robot model, SerialLink( ) can perform some sanity check for link data. For example, if one inputs mixed DH types into L that will result in an error when executing the function. Validity of data types are also checked. Whenever you modify a link data structure, you must pass it to SerialLink( ) again so that the robot model is updated properly. Never write to a field manually to avoid data inconsistency. Instead, use a function designed for that purpose.


This example demonstrates how to make an RRR robot.

clear L;
d1 = 1; a2 = 1; a3 = 1;
L(1)= Link([0 d1 0 pi/2]);
L(2)=Link([0 0 a2 0]);    
L(3)=Link([0 0 a3 0]);
RRR_robot=SerialLink(L,'name','An RRR robot arm');

See Also