matlab机器人工具箱matlabrobotics_toolbox_demo
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
MATLAB ROBOTTOOL
rtdemo演示
目录
一、rtdemo机器人工具箱演示 (2)
二、transfermations坐标转换 (2)
三、Trajectory齐次方程 (8)
四、forward kinematics 运动学正解 (12)
四、Animation 动画 (18)
五、Inverse Kinematics运动学逆解 (23)
六、Jacobians雅可比---矩阵与速度 (32)
七、Inverse Dynamics逆向动力学 (45)
八、Forward Dynamics正向动力学 (52)
一、rtdemo机器人工具箱演示
>> rtdemo
%
二、transfermations坐标转换
% In the field of robotics there are many possible ways of representing
% positions and orientations, but the homogeneous transformation is well
% matched to MATLABs powerful tools for matrix manipulation. %
% Homogeneous transformations describe the relationships between Cartesian
% coordinate frames in terms of translation and orientation.
% A pure translation of 0.5m in the X direction is represented by
transl(0.5, 0.0, 0.0)
ans =
1.0000 0 0 0.5000
0 1.0000 0 0
0 0 1.0000 0
0 0 0 1.0000
%
% a rotation of 90degrees about the Y axis by
roty(pi/2)
ans =
0.0000 0 1.0000 0
0 1.0000 0 0
0 0 0 1.0000
%
% and a rotation of -90degrees about the Z axis by rotz(-pi/2)
ans =
0.0000 1.0000 0 0
-1.0000 0.0000 0 0
0 0 1.0000 0
0 0 0 1.0000
%
% these may be concatenated by multiplication t = transl(0.5, 0.0, 0.0) * roty(pi/2) * rotz(-pi/2)
t =
0.0000 0.0000 1.0000 0.5000
-1.0000 0.0000 0 0
0 0 0 1.0000
%
% If this transformation represented the origin of a new coordinate frame with respect
% to the world frame origin (0, 0, 0), that new origin would be given by
t * [0 0 0 1]'
ans =
0.5000
1.0000
pause % any key to continue
%
% the orientation of the new coordinate frame may be expressed in terms of
% Euler angles
tr2eul(t)
ans =
0 1.5708 -1.5708
%
% or roll/pitch/yaw angles
tr2rpy(t)
ans =
-1.5708 0.0000 -1.5708
pause % any key to continue
%
% It is important to note that tranform multiplication is in general not
% commutative as shown by the following example
rotx(pi/2) * rotz(-pi/8)
ans =
0.9239 0.3827 0 0
-0.0000 0.0000 -1.0000 0
-0.3827 0.9239 0.0000 0
0 0 0 1.0000
rotz(-pi/8) * rotx(pi/2)
ans =
0.9239 0.0000 -0.3827 0
-0.3827 0.0000 -0.9239 0
0 1.0000 0.0000 0
0 0 0 1.0000
%
%
pause % any key to continue
echo off
三、Trajectory齐次方程
% The path will move the robot from its zero angle pose to the upright (or
% READY) pose.
%
% First create a time vector, completing the motion in 2 seconds with a
% sample interval of 56ms.
t = [0:.056:2];
pause % hit any key to continue
%
% A polynomial trajectory between the 2 poses is computed using jtraj()
%
q = jtraj(qz, qr, t);
pause % hit any key to continue
%
% For this particular trajectory most of the motion is done by joints 2 and 3,