📄 rtfkdemo.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 rtfkdemo</title> <meta name="keywords" content="rtfkdemo"> <meta name="description" content="RTFKDEMO Forward kinematics demo"> <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="#">demos</a> > rtfkdemo.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 ./demos <img alt=">" border="0" src="../right.png"></a></td></tr></table>--><h1>rtfkdemo</h1><h2><a name="_name"></a>PURPOSE <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2><div class="box"><strong>RTFKDEMO Forward kinematics demo</strong></div><h2><a name="_synopsis"></a>SYNOPSIS <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2><div class="box"><strong>This is a script file. </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">RTFKDEMO Forward kinematics demo</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)"></ul>This function is called by:<ul style="list-style-image:url(../matlabicon.gif)"></ul><!-- crossreference --><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">%RTFKDEMO Forward kinematics demo</span>0002 0003 <span class="comment">% Copyright (C) 1993-2002, by Peter I. Corke</span>0004 0005 <span class="comment">% $Log: not supported by cvs2svn $</span>0006 <span class="comment">% Revision 1.3 2002-04-02 12:26:48 pic</span>0007 <span class="comment">% Handle figures better, control echo at end of each script.</span>0008 <span class="comment">% Fix bug in calling ctraj.</span>0009 <span class="comment">%</span>0010 <span class="comment">% Revision 1.2 2002/04/01 11:47:17 pic</span>0011 <span class="comment">% General cleanup of code: help comments, see also, copyright, remnant dh/dyn</span>0012 <span class="comment">% references, clarification of functions.</span>0013 <span class="comment">%</span>0014 <span class="comment">% $Revision: 1.1 $</span>0015 figure(2)0016 echo on0017 <span class="comment">% Forward kinematics is the problem of solving the Cartesian position and</span>0018 <span class="comment">% orientation of a mechanism given knowledge of the kinematic structure and</span>0019 <span class="comment">% the joint coordinates.</span>0020 <span class="comment">%</span>0021 <span class="comment">% Consider the Puma 560 example again, and the joint coordinates of zero,</span>0022 <span class="comment">% which are defined by qz</span>0023 qz0024 <span class="comment">%</span>0025 <span class="comment">% The forward kinematics may be computed using fkine() with an appropropriate</span>0026 <span class="comment">% kinematic description, in this case, the matrix p560 which defines</span>0027 <span class="comment">% kinematics for the 6-axis Puma 560.</span>0028 fkine(p560, qz)0029 <span class="comment">%</span>0030 <span class="comment">% returns the homogeneous transform corresponding to the last link of the</span>0031 <span class="comment">% manipulator</span>0032 pause <span class="comment">% any key to continue</span>0033 <span class="comment">%</span>0034 <span class="comment">% fkine() can also be used with a time sequence of joint coordinates, or</span>0035 <span class="comment">% trajectory, which is generated by jtraj()</span>0036 <span class="comment">%</span>0037 t = [0:.056:2]; <span class="comment">% generate a time vector</span>0038 q = jtraj(qz, qr, t); <span class="comment">% compute the joint coordinate trajectory</span>0039 <span class="comment">%</span>0040 <span class="comment">% then the homogeneous transform for each set of joint coordinates is given by</span>0041 T = fkine(p560, q);0042 0043 <span class="comment">%</span>0044 <span class="comment">% where T is a 3-dimensional matrix, the first two dimensions are a 4x4</span>0045 <span class="comment">% homogeneous transformation and the third dimension is time.</span>0046 <span class="comment">%</span>0047 <span class="comment">% For example, the first point is</span>0048 T(:,:,1)0049 <span class="comment">%</span>0050 <span class="comment">% and the tenth point is</span>0051 T(:,:,10)0052 pause <span class="comment">% any key to continue</span>0053 <span class="comment">%</span>0054 <span class="comment">% Elements (1:3,4) correspond to the X, Y and Z coordinates respectively, and</span>0055 <span class="comment">% may be plotted against time</span>0056 subplot(3,1,1)0057 plot(t, squeeze(T(1,4,:)))0058 xlabel(<span class="string">'Time (s)'</span>);0059 ylabel(<span class="string">'X (m)'</span>)0060 subplot(3,1,2)0061 plot(t, squeeze(T(2,4,:)))0062 xlabel(<span class="string">'Time (s)'</span>);0063 ylabel(<span class="string">'Y (m)'</span>)0064 subplot(3,1,3)0065 plot(t, squeeze(T(3,4,:)))0066 xlabel(<span class="string">'Time (s)'</span>);0067 ylabel(<span class="string">'Z (m)'</span>)0068 pause <span class="comment">% any key to continue</span>0069 <span class="comment">%</span>0070 <span class="comment">% or we could plot X against Z to get some idea of the Cartesian path followed</span>0071 <span class="comment">% by the manipulator.</span>0072 <span class="comment">%</span>0073 subplot(1,1,1)0074 plot(squeeze(T(1,4,:)), squeeze(T(3,4,:)));0075 xlabel(<span class="string">'X (m)'</span>)0076 ylabel(<span class="string">'Z (m)'</span>)0077 grid0078 pause <span class="comment">% any key to continue</span>0079 echo off</pre></div><hr><address>Generated on Sun 15-Feb-2009 18:09:29 by <strong><a href="http://www.artefact.tk/software/matlab/m2html/">m2html</a></strong> © 2003</address></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -