📄 plot.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd"><html><head> <title>Description of plot</title> <meta name="keywords" content="plot"> <meta name="description" content="PLOT Graphical robot animation"> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <meta name="generator" content="m2html © 2003 Guillaume Flandin"> <meta name="robots" content="index, follow"> <link type="text/css" rel="stylesheet" href="../m2html.css"></head><body><a name="_top"></a><div><a href="../index.html">Home</a> > <a href="#">@robot</a> > plot.m</div><!--<table width="100%"><tr><td align="left"><a href="../index.html"><img alt="<" border="0" src="../left.png"> Master index</a></td><td align="right"><a href="index.html">Index for ./@robot <img alt=">" border="0" src="../right.png"></a></td></tr></table>--><h1>plot</h1><h2><a name="_name"></a>PURPOSE <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2><div class="box"><strong>PLOT Graphical robot animation</strong></div><h2><a name="_synopsis"></a>SYNOPSIS <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2><div class="box"><strong>function rnew = plot(robot, tg, varargin) </strong></div><h2><a name="_description"></a>DESCRIPTION <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2><div class="fragment"><pre class="comment">PLOT Graphical robot animation PLOT(ROBOT, Q) PLOT(ROBOT, Q, options) Displays a graphical animation of a robot based on the kinematic model. A stick figure polyline joins the origins of the link coordinate frames. The robot is displayed at the joint angle Q, or if a matrix it is animated as the robot moves along the trajectory. The graphical robot object holds a copy of the robot object and the graphical element is tagged with the robot's name (.name method). This state also holds the last joint configuration which can be retrieved, see PLOT(robot) below. If no robot of this name is currently displayed then a robot will be drawn in the current figure. If hold is enabled (hold on) then the robot will be added to the current figure. If the robot already exists then that graphical model will be found and moved. MULTIPLE VIEWS OF THE SAME ROBOT If one or more plots of this robot already exist then these will all be moved according to the argument Q. All robots in all windows with the same name will be moved. MULTIPLE ROBOTS Multiple robots can be displayed in the same plot, by using "hold on" before calls to plot(robot). options is a list of any of the following: 'workspace' [xmin, xmax ymin ymax zmin zmax] 'perspective' 'ortho' controls camera view mode 'erase' 'noerase' controls erasure of arm during animation 'loop' 'noloop' controls endless loop mode 'base' 'nobase' controls display of base 'pedestal' 'wrist' 'nowrist' controls display of wrist 'name', 'noname' display the robot's name 'shadow' 'noshadow' controls display of shadow 'xyz' 'noa' wrist axis label 'joints' 'nojoints' controls display of joints 'mag' scale annotation scale factor The options come from 3 sources and are processed in the order: 1. Cell array of options returned by the function PLOTBOTOPT 2. Cell array of options returned by the .plotopt method of the robot object. These are set by the .plotopt method. 3. List of arguments in the command line. GRAPHICAL ANNOTATIONS: The basic stick figure robot can be annotated with shadow on the floor XYZ wrist axes and labels joint cylinders and axes All of these 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 above. GETTING GRAPHICAL ROBOT STATE: q = PLOT(ROBOT) Returns the joint configuration from the state of an existing graphical representation of the specified robot. If multiple instances exist, that of the first one returned by findobj() is given. MOVING JUST ONE INSTANCE oF A ROBOT: r = PLOT(robot, q) Returns a copy of the robot object, with the .handle element set. PLOT(r, q) will animate just this instance, not all robots of the same name. See also: PLOTBOTOPT, DRIVEBOT, FKINE, <a href="robot.html" class="code" title="function r = robot(L, a1, a2, a3)">ROBOT</a>.</pre></div><!-- crossreference --><h2><a name="_cross"></a>CROSS-REFERENCE INFORMATION <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>This function calls:<ul style="list-style-image:url(../matlabicon.gif)"><li><a href="robot.html" class="code" title="function r = robot(L, a1, a2, a3)">robot</a> ROBOT Robot object constructor</li></ul>This function is called by:<ul style="list-style-image:url(../matlabicon.gif)"></ul><!-- crossreference --><h2><a name="_subfunctions"></a>SUBFUNCTIONS <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2><ul style="list-style-image:url(../matlabicon.gif)"><li><a href="#_sub1" class="code">function o = plot_options(robot, optin)</a></li><li><a href="#_sub2" class="code">function h = create_new_robot(robot, opt)</a></li><li><a href="#_sub3" class="code">function animate(robot, q)</a></li></ul><h2><a name="_source"></a>SOURCE CODE <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2><div class="fragment"><pre>0001 <span class="comment">%PLOT Graphical robot animation</span>0002 <span class="comment">%</span>0003 <span class="comment">% PLOT(ROBOT, Q)</span>0004 <span class="comment">% PLOT(ROBOT, Q, options)</span>0005 <span class="comment">%</span>0006 <span class="comment">% Displays a graphical animation of a robot based on the</span>0007 <span class="comment">% kinematic model. A stick figure polyline joins the origins of</span>0008 <span class="comment">% the link coordinate frames.</span>0009 <span class="comment">% The robot is displayed at the joint angle Q, or if a matrix it is</span>0010 <span class="comment">% animated as the robot moves along the trajectory.</span>0011 <span class="comment">%</span>0012 <span class="comment">% The graphical robot object holds a copy of the robot object and</span>0013 <span class="comment">% the graphical element is tagged with the robot's name (.name method).</span>0014 <span class="comment">% This state also holds the last joint configuration which can be retrieved,</span>0015 <span class="comment">% see PLOT(robot) below.</span>0016 <span class="comment">%</span>0017 <span class="comment">% If no robot of this name is currently displayed then a robot will</span>0018 <span class="comment">% be drawn in the current figure. If hold is enabled (hold on) then the</span>0019 <span class="comment">% robot will be added to the current figure.</span>0020 <span class="comment">%</span>0021 <span class="comment">% If the robot already exists then that graphical model will be found</span>0022 <span class="comment">% and moved.</span>0023 <span class="comment">%</span>0024 <span class="comment">% MULTIPLE VIEWS OF THE SAME ROBOT</span>0025 <span class="comment">% If one or more plots of this robot already exist then these will all</span>0026 <span class="comment">% be moved according to the argument Q. All robots in all windows with</span>0027 <span class="comment">% the same name will be moved.</span>0028 <span class="comment">%</span>0029 <span class="comment">% MULTIPLE ROBOTS</span>0030 <span class="comment">% Multiple robots can be displayed in the same plot, by using "hold on"</span>0031 <span class="comment">% before calls to plot(robot).</span>0032 <span class="comment">%</span>0033 <span class="comment">% options is a list of any of the following:</span>0034 <span class="comment">% 'workspace' [xmin, xmax ymin ymax zmin zmax]</span>0035 <span class="comment">% 'perspective' 'ortho' controls camera view mode</span>0036 <span class="comment">% 'erase' 'noerase' controls erasure of arm during animation</span>0037 <span class="comment">% 'loop' 'noloop' controls endless loop mode</span>0038 <span class="comment">% 'base' 'nobase' controls display of base 'pedestal'</span>0039 <span class="comment">% 'wrist' 'nowrist' controls display of wrist</span>0040 <span class="comment">% 'name', 'noname' display the robot's name</span>0041 <span class="comment">% 'shadow' 'noshadow' controls display of shadow</span>0042 <span class="comment">% 'xyz' 'noa' wrist axis label</span>0043 <span class="comment">% 'joints' 'nojoints' controls display of joints</span>0044 <span class="comment">% 'mag' scale annotation scale factor</span>0045 <span class="comment">%</span>0046 <span class="comment">% The options come from 3 sources and are processed in the order:</span>0047 <span class="comment">% 1. Cell array of options returned by the function PLOTBOTOPT</span>0048 <span class="comment">% 2. Cell array of options returned by the .plotopt method of the</span>0049 <span class="comment">% robot object. These are set by the .plotopt method.</span>0050 <span class="comment">% 3. List of arguments in the command line.</span>0051 <span class="comment">%</span>0052 <span class="comment">% GRAPHICAL ANNOTATIONS:</span>0053 <span class="comment">%</span>0054 <span class="comment">% The basic stick figure robot can be annotated with</span>0055 <span class="comment">% shadow on the floor</span>0056 <span class="comment">% XYZ wrist axes and labels</span>0057 <span class="comment">% joint cylinders and axes</span>0058 <span class="comment">%</span>0059 <span class="comment">% All of these require some kind of dimension and this is determined</span>0060 <span class="comment">% using a simple heuristic from the workspace dimensions. This dimension</span>0061 <span class="comment">% can be changed by setting the multiplicative scale factor using the</span>0062 <span class="comment">% 'mag' option above.</span>0063 <span class="comment">%</span>0064 <span class="comment">% GETTING GRAPHICAL ROBOT STATE:</span>0065 <span class="comment">% q = PLOT(ROBOT)</span>0066 <span class="comment">% Returns the joint configuration from the state of an existing</span>0067 <span class="comment">% graphical representation of the specified robot. If multiple</span>0068 <span class="comment">% instances exist, that of the first one returned by findobj() is</span>0069 <span class="comment">% given.</span>0070 <span class="comment">%</span>0071 <span class="comment">% MOVING JUST ONE INSTANCE oF A ROBOT:</span>0072 <span class="comment">%</span>0073 <span class="comment">% r = PLOT(robot, q)</span>0074 <span class="comment">%</span>0075 <span class="comment">% Returns a copy of the robot object, with the .handle element set.</span>0076 <span class="comment">%</span>0077 <span class="comment">% PLOT(r, q)</span>0078 <span class="comment">%</span>0079 <span class="comment">% will animate just this instance, not all robots of the same name.</span>0080 <span class="comment">%</span>0081 <span class="comment">% See also: PLOTBOTOPT, DRIVEBOT, FKINE, ROBOT.</span>0082 0083 0084 <span class="comment">% HANDLES:</span>0085 <span class="comment">%</span>0086 <span class="comment">% A robot comprises a bunch of individual graphical elements and these are</span>0087 <span class="comment">% kept in a structure which can be stored within the .handle element of a</span>0088 <span class="comment">% robot object:</span>0089 <span class="comment">% h.robot the robot stick figure</span>0090 <span class="comment">% h.shadow the robot's shadow</span>0091 <span class="comment">% h.x wrist vectors</span>0092 <span class="comment">% h.y</span>0093 <span class="comment">% h.z</span>0094 <span class="comment">% h.xt wrist vector labels</span>0095 <span class="comment">% h.yt</span>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -