完成之前的操作后终于来到最后一步——定义模型,即将之前创建的几何体、关节等元素按层级关系组织成为一个整体。

  将最后一个连杆robot_link_dyn6拖放到相应的关节(robot_joint6)下,成为其子节点。依次进行这样的操作,直到机器人的基座为止,最终UR机器人的层级结构看起来如下图所示:

[Robot model hierarchy]

  由于根节点代表了整个机器人,这里我们将根节点重命名:robot代表机器人的动力学模型,robot_visibleBase代表机器人的可视化模型。接着选中模型根节点(即robot),双击其图标打开Common属性页面,勾选"Object is model base"选项。

  Object is model base: indicates whether the object should act as the base of a model. An object flagged as base of model has special properties (e.g. saving or copying the object will also automatically save/copy all its children and children's children, etc.). Additionally, when such an object is selected, the selection bounding box is displayed as thick stippled lines, encompassing the whole model.

   同时也勾选"Object/model can transfer or accept DNA"选项。

  Object / model can transfer or accept DNA: when this feature is enabled for an object or a model, then it will share a same identifier with all of its copies. An Object or model can then transfer its DNA (i.e. copy an instance of itself) to all of its siblings (i.e. objects/models with the same identifier), via the transfer DNA toolbar button. Imagine having 100 same robots in your scene that you want to modify in a similar way: simply modify one of them, select it, then click the transfer DNA toolbar button. This item should almost always be checked for a model base to facilitate model re-instanciation. 即勾选这一选项后能让我们很方便的将某一个模型的更改应用到其它复制体上。

[DNA transfer toolbar button]

  举个例子:定义好模型并勾选"Object/model can transfer or accept DNA"后将下图左边的二连杆机构复制一份拖到右边。接着将左侧模型连杆L1的颜色改为黄色,然后选中左侧模型的根节点J1,这时工具栏上的Transfer DNA to siblings按钮变得可用。点击这一按钮后右边的模型连杆L1颜色也变为黄色。同样的可以将右边模型连杆L2的颜色改为绿色或其它颜色,再transfer DNA,左侧模型中连杆L2也会发生同样的变化。

  定义好模型后会出现一个包围体将模型整各围起来。不过由于关节、传感器等物体的存在,包围体比实际应有的体积要大。我们可以选择要移出的关节,通过勾选"Don't show as inside model selection"选项将其从包围体中除去。We could do the same procedure for all invisible items in our model. This is also a useful option in order to also exclude large sensors or other items from the model bounding box.

[Robot model bounding box]

  为了防止模型被偶然更改,我们选择模型中每个可见的几何体,然后在Common属性页勾选" Select base of model instead"选项,这样一来通过鼠标在场景中点中机器人的某一连杆时,整个机器人(根节点)就会被选中。This allows us to manipulate the model as if it was a single object. 如下图所示,红色的圆点为鼠标选择的连杆,而作为代替机器人的基座将被选中:

  之后我们将模型放置合适的位置和姿态上。It is considered good practice to position the model (i.e. its base object) at X=0 and Y=0.

  现在我们点击开始仿真按钮,机械臂在重力作用下会塌下来,因为此时6个旋转关节还没有受控制。进入Joint Dynamic Properties对话框,勾选Motor enabled和Control loop enabled并选择Position control(PID),对关节进行简单的PID控制。

  再次进行仿真,可以看到机器人将能保持在当前位置。此外,在仿真过程中我们可以点击工具栏上的动态内容显示按钮,通过不同颜色显示场景中物体所处的状态。

[Dynamic content visualization button]

  Only items that are taken into account by the physics engine will be display, and the display is color-coded. It is very important to always do this, and specially when your dynamic model doesn't behave as expected, in order to quickly debug the model. Similarly, always look at the scene hierarchy during simulation: dynamically enabled objects should display a ball-bounding icon on the right-hand side of their name.

  Dynamic objects will appear in various colors, depending on their function or settings. Refer to following figure:

  根据上面颜色对应的状态我们可以看出:机器人基座为白色表示它是一个静态的respondable物体;连杆为红色表示它们是动态的respondable物体。

  创建好机器人后我们可能要将其安装在移动底盘上或在机器人的末端装一个手爪。有下面两种方式将动态体刚性地连接在一起:

  1. by grouping them: select the shapes, then [Menu bar --> Edit --> Grouping/Merging --> Group selected shapes].
  2. by attaching them via a force/torque sensor: a force torque sensor can also act as a rigid link between two separate dynamically enabled shapes.

  第一种方式很简单,我们来看看第二种:先通过[Menu bar --> Add --> Force sensor]添加力传感器,在场景中将其移动到机器人末端,并在层次结构中将其拖放到最后一个连杆robot_link_dyn6下。更改其外观与尺寸,并且改名为robot_attachment.

[Attachment force/torque sensor]

  在模型浏览器中选择一个手爪并拖入场景中,保持手爪处于选中状态,然后按Control键同时选中robot_attachment力传感器,接着点击工具栏上面的"Assemble / Disassemble"按钮,手抓就会被装配到合适的位置。The gripper knew how to attach itself because it was appropriately configured during its model definition.

[Assemble / Disassemble button]

[Attached gripper]

  手爪模型在定义时就确定了装配时如何确定位置姿态,因此在考虑将UR机器人安装到移动小车上时,我们同样应该定义其装配行为:先选中机器人模型,然后点击Common属性页下的Assembling按钮,弹出Assembling Behaviour对话框。消除"Object can have the 'parent' role"选项,然后点击"Set Matrix"按钮。This will memorize the current base object's local transformation matrix, and use it to position/orient itself relative to the mobile robot's attachment point.

  • Object can have the 'child' role: if checked, then the object can be attached to another object (i.e. become another object's child)
  • Object can have the 'parent' role: if checked, then the object can have another obejct attached to itself (i.e. become another object's parent)
  • Set matrix: when the object is assembled, a specific transformation matrix will be used as its new local transformation matrix. By default that matrix is the identity matrix, but you can specify a specific matrix by clicking the button. This feature is useful in order to automatically position and orient an object correctly in relation to its new parent (e.g. in order to have a gripper automatically placed correctly at a robot's tooltip)

  为了验证上述功能,我们往场景中拖入一个KUKA Omnirob移动机器人。首先选中UR机器人,然后按Control键用鼠标选取移动平台上的attachment points,点击工具栏上"Assemble / Disassemble"按钮,此时我们的UR机器人应该正确的安装在移动平台上面。

[Attached robot]

  如果我们在装配前改变UR机器人的姿态朝向,然后点击"Set Matrix"按钮记住机器人在局部坐标系中的位置姿态信息,那么之后进行装配时UR机器人在移动平台上的朝向也会发生相应的变化(注意如果模型位置不在X=0,Y=0,Z=0处,那么安装到移动平台时将会有一个偏移),如下图所示:

  对于用户自己创建的模型如果以后想直接拖入场景中使用,可以选中模型根节点,然后在菜单栏中选择File --> Save model as... 将其保存。If we saved it in the model folder, then the model will be available in the model brower.

  保存时会出现一些提示,比如会提示选择模型的缩略图:

  将模型命名为user model保存在系统models文件夹下,当新建一个场景时就可以在模型浏览器中找到我们自己创建好的模型:

  至此,一个完整的机器人模型就已经创建好了。后续工作是为机器人添加各类传感器和控制脚本控制机器人的运动以及行为。

参考:

Building a clean model tutorial

V-rep学习笔记:机器人模型创建4—定义模型的更多相关文章

  1. CTR学习笔记&代码实现3-深度ctr模型 FNN->PNN->DeepFM

    这一节我们总结FM三兄弟FNN/PNN/DeepFM,由远及近,从最初把FM得到的隐向量和权重作为神经网络输入的FNN,到把向量内/外积从预训练直接迁移到神经网络中的PNN,再到参考wide& ...

  2. CTR学习笔记&代码实现5-深度ctr模型 DeepCrossing -> DCN

    之前总结了PNN,NFM,AFM这类两两向量乘积的方式,这一节我们换新的思路来看特征交互.DeepCrossing是最早在CTR模型中使用ResNet的前辈,DCN在ResNet上进一步创新,为高阶特 ...

  3. CTR学习笔记&代码实现6-深度ctr模型 后浪 xDeepFM/FiBiNET

    xDeepFM用改良的DCN替代了DeepFM的FM部分来学习组合特征信息,而FiBiNET则是应用SENET加入了特征权重比NFM,AFM更进了一步.在看两个model前建议对DeepFM, Dee ...

  4. GIS案例学习笔记-明暗等高线提取地理模型构建

    GIS案例学习笔记-明暗等高线提取地理模型构建 联系方式:谢老师,135-4855-4328,xiexiaokui#qq.com 目的:针对数字高程模型,通过地形分析,建立明暗等高线提取模型,生成具有 ...

  5. InterSystems Ensemble学习笔记(二) Ensemble创建镜像, 实现自动故障转移

    系列目录 InterSystems Ensemble学习笔记(一) Ensemble介绍及安装InterSystems Ensemble学习笔记(二) Ensemble创建镜像, 实现自动故障转移 一 ...

  6. 【opencv学习笔记八】创建TrackBar轨迹条

    createTrackbar这个函数我们以后会经常用到,它创建一个可以调整数值的轨迹条,并将轨迹条附加到指定的窗口上,使用起来很方便.首先大家要记住,它往往会和一个回调函数配合起来使用.先看下他的函数 ...

  7. CTR学习笔记&代码实现4-深度ctr模型 NFM/AFM

    这一节我们总结FM另外两个远亲NFM,AFM.NFM和AFM都是针对Wide&Deep 中Deep部分的改造.上一章PNN用到了向量内积外积来提取特征交互信息,总共向量乘积就这几种,这不NFM ...

  8. [原创]java WEB学习笔记44:Filter 简介,模型,创建,工作原理,相关API,过滤器的部署及映射的方式,Demo

    本博客为原创:综合 尚硅谷(http://www.atguigu.com)的系统教程(深表感谢)和 网络上的现有资源(博客,文档,图书等),资源的出处我会标明 本博客的目的:①总结自己的学习过程,相当 ...

  9. [C++学习笔记14]动态创建对象(定义静态方法实现在map查找具体类名对应的创建函数,并返回函数指针,map真是一个万能类)good

    [C++学习笔记14]动态创建对象   C#/Java中的反射机制 动态获取类型信息(方法与属性) 动态创建对象 动态调用对象的方法 动态操作对象的属性 前提:需要给每个类添加元数据 动态创建对象 实 ...

随机推荐

  1. C#中的命名空间namespace与Java中的包package之间的区别

    Java 包被用来组织文件或公共类型以避免类型冲突.包结构可以映射到文件系统. System.Security.Cryptography.AsymmetricAlgorithm aa; 可能被替换: ...

  2. BMap:JavaScript API

    ylbtech-Map-Baidu:JavaScript API JavaScript API百度地图JavaScript API是一套由JavaScript语言编写的应用程序接口,可帮助您在网站中构 ...

  3. 远程连接Oracle数据库

    ylbtech-Oracle:远程连接Oracle数据库  所谓远程连接Oracle数据库,是指Oracle数据库服务器和Oracle客户端分别安装在2台电脑上,我们使用Oracle客户端来连接在另一 ...

  4. OpenCV 脸部跟踪(3)

       前面一篇文章我们生成了脸部特征的线性形状模型,本章来学习一下显示线性形状的代码. 线性模型类的结构如下: class shape_model     {                      ...

  5. OpenWRT - WEB界面开发思路和基本方法

    想要对OpenWRT的WEB界面(*下称界面)进行修改.修改的目标是: 1.修改页面的样式,设计为企业的风格(stylesheet) 2.新建自己的功能,实现 访问页面后,用户就可以对配置文件(也就是 ...

  6. 前端Js框架汇总【转】

    概述: 有些日子没有正襟危坐写博客了,互联网飞速发展的时代,技术更新迭代的速度也在加快.看着Java.Js.Swift在各领域心花路放,也是煞是羡慕.寻了寻.net的消息,也是振奋人心,.net co ...

  7. easyui datagrid列使用按钮的一些心得 .

    以前,用easyui的datagrid,有时候会用到一些操作选项,比如代码如下: $('#datagrid').datagrid({ border:false, fitColumns:true, si ...

  8. iOS开发-UIScreenEdgePanGestureRecognizer实战

    UIScreenEdgePanGestureRecognizer名字很长,而且关于其文档也是少的的可怜,苹果官方给的唯一的一个属性是edges,文档中的解释是这样的: A UIScreenEdgePa ...

  9. extern外部方法使用C#简单例子

    外部方法使用C#简单例子 1.增加引用using System.Runtime.InteropServices; 2.声明和实现的连接[DllImport("kernel32", ...

  10. 【应用】R--判断类别型属性之间是否有相关性(相互之间是否独立)

    检验某学区所有在售房源中,小区与楼栋类别(低层:多层;小高层:高层)是否相关 导入数据: > house<- read.table("house_data.txt", ...