1、前记:可能用Robotics Toolbox建立的机器人模型与实际机器人在外观上存在天壤之别吧,直接将CAD软件(UG、SolidWorks、CATIA、Proe等)做好的3D模型导入MATLAB中是一个很好的选择。
下面记录MATLAB官网上的如何显示具有可视几何图形的机器人建模。
1)导入具有.stl文件的机器人与统一的机器人描述格式 (URDF) 文件相关联, 以描述机器人的视觉几何。每个刚体都有一个单独的视觉几何特征。importrobot函数对 URDF 文件进行解析, 得到机器人模型和视觉几何。使用show功能可视化的机器人模型显示在一个figure图框中。然后, 您可以通过单击组件来检查它们并右键单击以切换可见性来与模型进行交互。
将机器人模型作为 URDF 文件导入。此 URDF 中必须正确指定.stl文件位置。要将其他.stl文件添加到单个刚性体, 请参见 addVisual .如:iiwa的URDF描述文件中的部分。
在命令窗输入代码:
robot = importrobot('iiwa14.urdf');
用相关的视觉模型可视化机器人。单击 "正文" 或 "框架" 进行检查。右键单击 "正文" 可切换每个可视几何图形的可见性。
代码:show(robot);%机器人显示如下
2)如此,在具有机器人的URDF文件和对应的stl文件条件下运行以上两行代码即可显示具有几何特征的可视化机器人模型。
如下:ABB机器人的IRB120
和ABB机器人的YUMI
2、仿真
机器人可视化到MATLAB环境下后,就可以做仿真了。在MATLAB的实例中可以直接学习到一些思路,代码和结果如下:
具有多个约束的轨迹规划---->
%% Plan a Reaching Trajectory With Multiple Kinematic Constraints
%% Introduction
% This example shows how to use generalized inverse kinematics to plan a
% joint-space trajectory for a robotic manipulator. It combines multiple
% constraints to generate a trajectory that guides the gripper to a cup
% resting on a table. These constraints ensure that the gripper approaches
% the cup in a straight line and that the gripper remains at a safe
% distance from the table, without requiring the poses of the gripper to be
% determined in advance.
% Copyright 2016 The MathWorks, Inc.
%% Set Up the Robot Model
% This example uses a model of the KUKA LBR iiwa, a 7 degree-of-freedom
% robot manipulator. || generates
% a || m