RTSX Help: Animate robot movement



AnimateRobot( ) shows robot movement corresponding to a sequence of joint variable values. AnimateRobotFrame( ) does the same thing but displays coordinate frames in place of robot joints.


  • AnimateRobot(robot, q, options)
  • AnimateRobotFrame(robot, q, options)

Input Arguments

  • robot –a robot model
  • q –a ns x nq matrix of joint variable values, where ns = number of setpoints (move steps) and nq = number of joint variables

Output Arguments

  • none


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

  • ‘grid’ — show grid
  • ‘noworld’ — do not plot world coordinate frame
  • ‘notool’ — do not plot tool coordinate frame
  • [ ‘figure’, fnum] — command the plot to a particular window indicated by fnum


This pair of functions is designed to animate movement of a robot model, or DH frames, corresponding to a given sequence of joint variable values, or setpoints, which could be created by a simple script file or from a path generation routine.


This example demonstrates how to generate a simple command sequence and animate a 2-link manipulator. The result is shown in the video clip below.

clear L;
a1 = 1.2; a2 = 1;
L(1)=Link([0 0 a1 0]);
L(2)=Link([0 0 a2 0]);
twolink=SerialLink(L);  // a 2-link manipulator
// generate simple setpoints
// both joints move full circle
t = [0:0.01:1]';        // "time" data
qs = [2*pi*t 2*pi*t];  

2-link robot manipulator animation by RTSX

See Also