Scilab Function
Last update : October 2007

robot/rt_plot - create a graphical animation for a robot object[view code]

Calling Sequence

rt_plot(robot, q [, <args>])
Q = rt_plot(robot)

Parameters

Options

Options are specified by a variable length argument list comprising strings and numeric values. The allowed values are:

string required numeric value meaning
"workspace" [xmin, xmax, ymin, ymax, zmin, zmax] (6-element row vector) set the 3D plot bounds or workspace
"mag" scale (scalar) annotation scale factor
"loop" n (scalar) animation is repeated n times
"perspective" show a perspective view
"ortho" show a orthogonal view
"base" or "nobase" control display of base, a line from the floor upto joint 0
"wrist" or "nowrist" control display of wrist axes
"name" or "noname" control display of robot name near joint 0
"shadow" or "noshadow" control display of a 'shadow' on the floor
"joints" or "nojoints" control display of joints, these are cylinders for revolute joints and boxes for prismatic joints
"erase" or "noerase" control erasure of robot after each change

The options came from 3 sources and are processed in the order:

1. Scilab list of options returned by the function rt_plotbotopt if found on the user's current directory;
2. Scilab list of options returned by the .plotopt method of the robot object. These are set by the .plotopt method;
3. comma separated sequence of arguments (<args>) in the command line.

Description

rt_plot is overloaded for robot objects.

The first form displays a graphical representation of the robot given the kinematic information in robot. The robot is represented by a simple stick figure polyline where line segments join the origins of the link coordinate frames. If q is a matrix (p > 1) representing a joint-space trajectory then an animation of the robot motion is shown. The basic stick figure robot can be graphically annotated with

  • shadow on the 'floor';
  • XYZ wrist axes and labels, shown by 3 orthogonal line segments which are colored: red (X or Normal), green (Y or Orientation) and blue (Z or Approach). They can be optionally labelled XYZ or NOA;
  • joints, these are 3D cylinders for revolute joints and boxes for prismatic joints;
  • the robot's name.
  • All of these graphical annotations require some kind of dimension and this is determined using a simple heuristic from the workspace dimensions. This dimension can be changed by setting the multiplicative scale factor using the "mag" option. These various annotations do slow the rate at which animations will be rendered.

    Each graphical robot has a unique tag set equal to the robot's name. When rt_plot is called it looks for all graphical objects with that name and moves them. The graphical robot holds a copy of the robot object as user_data (see polyline_properties). That copy contains the graphical handles of all the graphical sub-elements of the robot and also the current joint angle state. This state is used and adjusted by the rt_drivebot function.

    The second form returns the robot's current joint angle state.

    Examples

       // To animate a Puma robot the following code could be used.
       exec <PATH>/models/rt_puma560.sce;           // load Puma 560 parameters
       h0 = scf(0); a0 = h0.children;               // create a new graphic win.
       a0.tight_limits = "on";
       a0.rotation_angles = [80, -46];              // adjust observation point
       rt_plot(p560, qready);                       // display it at ready pos.
    
       t = [0:0.056:10];
       jt = rt_jtraj(qready, qstretch, t);          // traject. to stretch pose
       rt_plot(p560, jt);                           // animate the robot!
    
       // To show multiple views of the same robot the following code could be
       // used.
       clf(0, "clear");
       h0 = scf(0); a0 = h0.children; a0.tight_limits = "on";
       a0.rotation_angles = [73, 33];               // MULT.VIEWS #1
       rt_plot(p560, qz);                           // add a graphical robot
       h1 = scf(1); a1 = h1.children; a1.tight_limits = "on";
       a1.rotation_angles = [73, -61];              // MULT.VIEWS #1
       rt_plot(p560, qz);                           // add a graphical robot
       rt_plot(p560, qready);                       // both robots should move
    
       // now the two figures can be adjusted to give different viewpoints
       a0.rotation_angles = [73, 33];               // MULT.VIEWS #2
       a1.rotation_angles = [73, 128];
    
       a0.rotation_angles = [90, 0];                // MULT.VIEWS #3 (front)
       a1.rotation_angles = [0, 0];                 //               (top)
    
       // Play with options
       xdel(h1.figure_id);
       clf(0, "clear");
       h0 = scf(0); a0 = h0.children; a0.tight_limits = "on";
       a0.rotation_angles = [74, -30];
       rt_plot(p560, qstretch, "base");             // display robot base
    
       clf(0, "clear");
       h0 = scf(0); a0 = h0.children; a0.tight_limits = "on";
       a0.rotation_angles = [74, -30];
       rt_plot(p560, jt, "base", "loop", 3);        // display robot base
                                                    // and
                                                    // repeat animation 3 times
    
       clf(0, "clear");
       h0 = scf(0); a0 = h0.children; a0.tight_limits = "on";
       a0.rotation_angles = [74, -30];
       tic();..
       rt_plot(p560, qready, "base");..
       elaps_time0 = toc(),
       h1 = scf(1); a1 = h1.children; a1.tight_limits = "on";
       a1.rotation_angles = [74, -30];
       tic();..
       rt_plot(p560, qready, "noname", "nobase", "noshadow", "nojoints", "nowrist");..
       elaps_time1 = toc(),     // time requested to plot: the most detailed
                                // vs
                                // the simplest stick robot figure
    
       p560.lineopt = list("orange", 4);
       p560.shadowopt = list("red", 1);
       xdel(h1.figure_id);
       clf(0, "clear");
       h0 = scf(0); a0 = h0.children; a0.tight_limits = "on";
       a0.rotation_angles = [74, -30];
       rt_plot(p560, jt);       // animate a robot with orange links,
                                // blue joints and red shadow!
    
      

    Cautionary

    Options for plotting are only processed on the first call when the graphical object is established, they are skipped on subsequent calls. Thus if you wish to change options, clear the figure before replotting.

    See Also

    rt_drivebot,  rt_fkine,  rt_robot,  polyline_properties,  

    Authors

    original Matlab version by

    Peter I. Corke CSIRO Manufacturing Science and Technology

    Scilab implementation by

    Matteo Morelli Interdepartmental Research Center "E. Piaggio", University of Pisa

    Bibliography

    Corke, P.I. "A Robotics Toolbox for MATLAB", IEEE Robotics and Automation Magazine, Volume 3(1), March 1996, pp. 24-32

    Get the Robotics Toolbox for Scilab/Scicos at SourceForge.net. Fast, secure and Free Open Source software downloads