ROS学习笔记43(给模型添加物理以及碰撞特性)

原文链接: http://wiki.ros.org/urdf/Tutorials/Adding%20Physical%20and%20Collision%20Properties%20to%20a%20URDF%20Model

在本教程中,我们将看看如何一些基本的物理属性添加到您的URDF模型,以及如何指定其碰撞性能。

1 碰撞

So far, we’ve only specified our links with a single sub-element, visual, which defines (not surprisingly) what the robot looks like. 然而,为了使得碰撞检测工作或者在gazebo中模拟机器人,我们还需要定义一个碰撞元素。Here is the new urdf with collision and physical properties.
程序如下:


    
      
        
      
      
        
      
    
    
      
        
      
    
  

碰撞元素是连杆物体的子标签,如同视觉标签一样。
The collision element defines its shape the same way the visual element does, with a geometry tag. The format for the geometry tag is exactly the same here as with the visual.
You can also specify an origin in the same way as a subelement of the collision tag (as with the visual) .
在很多情况下,碰撞的几何形状和origin是同视觉几何形状和起源一致。However, there are two main cases where you wouldn’t.
Quicker Processing:对两个网格进行碰撞检测比两个简单的几何形状需要大量的计算也复杂的多。因此,你可能想用简单的几何形状来代替网格在碰撞检测中。
Safe Zones:当接近敏感设备式,你可能想要限制物体的运动。举例来说,如果我们不希望任何物体与R2D2的头部发生碰撞,那么我们可以定义碰撞的几何形状为圆柱体以包住他的头,以防止任何从越来越接近他的头。

2 物理特性

为了能让你的模型可以正确无误的模拟真实物体,需要定义机器人的若干个物理特性,即,像Gazebo需要的一些属性。
2.1 惯性
每一个连杆都需要一个惯性标签,下面是一个简单的:


    
      
        
      
      
        
      
    

    
      
        
      
    
    
      
      
    

This element is also a subelement of the link object.
质量是以千克定义。
The 3x3 rotational inertia matrix is specified with the inertia element.由于它是对称的,所以,仅6个元素就可以表示,如下:

ixx

ixy

ixz

ixy

iyy

iyz

ixz

iyz

izz

This information can be provided to you by modeling programs such as MeshLab. The inertia of geometric primitives (cylinder, box, sphere) can be computed using Wikipedia's list of moment of inertia tensors (and is used in the above example).

惯性张量取决于两者的质量和物体的质量分布。A good first approximation is to assume equal distribution of mass in the volume of the object and compute the inertia tensor based on the object's shape, as outlined above.

If unsure what to put, a matrix with ixx/iyy/izz=1e-3 or smaller is often a reasonable default for a mid-sized link (it corresponds to a box of 0.1 m side length with a mass of 0.6 kg). Although often chosen, the identity matrix is a particularly bad default, since it is often much too high (it corresponds to a box of 0.1 m side length with a mass of 600 kg!).

您还可以指定一个origin 标签来指定重心和惯性参照系(相对于连杆的坐标系)。

当使用实时控制器,惯性元件零(或接近零)可以使机器人模型来没有警告崩溃, and all links will appear with their origins coinciding with the world origin.

2.2 Contact Coefficients

您也可以定义连杆在相互接触时连杆的行为。这是通过称为contact_coefficients的碰撞标签子元素来完成。有三个属性来指定:

  • mu - Friction coefficient 摩擦系数

  • kp - Stiffness coefficient 刚度系数

  • kd - Dampening coefficient 阻尼系数

2.3 Joint Dynamics

关节的如何运动是由动态标签进行定义的。这里有两个属性:

摩擦 - 物理静摩擦力。对于移动关节,单位是牛顿。对于旋转接头,单位是牛顿米。

阻尼 - 物理阻尼值。对于移动关节,单位是每米的牛顿秒。对于旋转关节,每弧度牛顿米每秒。

如果没有指定,这些系数默认为零。

3 Other Tags

在 URDF文件中 (i.e. excluding Gazebo-specific tags), 还有剩下的两个标签,以帮助确定关节: calibration and safety controller. Check out the spec, as they are not included in this tutorial.

4 Next Steps

通过使用xacro以减少你所要做的代码数量和恼人的数学计算。

 

 

 

 

你可能感兴趣的:(ROS学习笔记)