URDF

检查urdf文件语法:check_urdf smartcar.urdf

indigo版本的ROS中,执行如下命令即可: rosrun urdfdom check_urdf /tmp/pr2.urdf

可视化模型 , gui = true 可以让关节动起来:  roslaunch urdf_tutorial display.launch model:=path/to/your/xxx.urdf gui:=true

图形化显示URDF模型 :urdf_to_graphiz my_robot.urdf

origin:xyzparent link为原点,child link的三维坐标系位置。

origin:rpy child linkz轴旋转的滚动角(roll),绕y轴方向旋转的俯仰(pitch)角,和绕x轴旋转的偏转(yaw).

Things to note:

  • The fixed frame is transform frame where the center of the grid is located. Here, it’s a frame defined by our one link, base_link.
  • The visual element (the cylinder) has its origin at the center of its geometry as a default. Hence, half the cylinder is below the grid.
右手坐标系法则:
<box size="0.6 0.1 0.2"/> 分别对应xyz三个方向的值; 相对于原点<origin>,如果没有赋值的话就是几何形状<geometry>的中心点。 为了方便确定map中的右手坐标系,可以在rviz中勾选 show Axes来显示xyz坐标轴。
关于原点<origin>
Both of the shapes overlap with each other, because they share the same origin. If we want them not to overlap we must define more origins.

<joint> 和<link>中 <origin>元素的意义:

  • Let’s start by examining the joint’s origin. It is defined in terms of theparent’s reference frame.So we are -0.22 meters in the y direction (to our left, but to the right relative to the axes) and 0.25 meters in the z direction (up). This means that the origin for the child link will be up and to the right, regardless of the child link’s visual origin tag. Since we didn’t specify a rpy (roll pitch yaw) attribute, the child frame will be default have the same orientation as the parent frame.This is the transform from the parent link to the child link. The joint is located at the origin of the child link
  • Now, looking at the leg’s visual origin, it has both a xyz and rpy offset. This defines where thecenter of the visual element should be, relative to its origin. Since we want the leg to attach at the top, we offset the origin down by setting the z offset to be -0.3 meters. And since we want the long part of the leg to be parallel to the z axis, we rotate the visual part PI/2 around the Y axis.
<joint type ="continuous">  <axis>    
<joint name="head_swivel" type="continuous">
  <parent link="base_link"/>
     <child link="head"/>
     <axis xyz="0 0 1"/>
     <origin xyz="0 0 0.3"/>
</joint>

The connection between the body and the head is a continuous joint, meaning that it can take on any angle from negative infinity to positive infinity. The wheels are also modeled like this, so that they can roll in both directions forever.

The only additional information we have to add is the axis of rotation,here specified by an xyz triplet, which specifies a vector around which the head will rotate. Since we want it to go around the z axis, we specify the vector "0 0 1".

<joint type = "revolute">

    revolute joints. This means that they rotate inthe same way that the continuous joints do, but they have strict limits.

<joint type="prismatic">

This means thatit moves along an axis, not around it. This translational movement is what allows our robot model to extend and retractits gripper arm

Whereas the prismatic joint can only move along one dimension, a planar joint can move around in a plane, or two dimensions. Furthermore, a floating joint is unconstrained, and can move around in any of the three dimensions


Xacro 

The value of the contents of the ${} construct are then used to replace the ${}. This means you can combine it with other text in the attribute.
<xacro:property name=”robotname” value=”marvin” />
<link name=”${robotname}s_leg” />

This will generate

<linkname=”marvins_leg”/>
the contents in the ${} don’t have to only be a property . You can build up arbitrarily complex expressions in the ${} construct using the four basic operations (+,-,*,/), the unary minus, and parenthesis . In Jade and later distros, you can use more than the basic operations listed above, notably sin and cos

 joint_state_publisher从ROS参数服务器中读取robot_description参数, 找到所有non-fixed joint, 发布他们的JointState消息到/joint_states话题.
robot_state_publisher从/joint_states话题中获取机器人joint角度作为输入, 使用机器人的运动学树模型计算出机器人link的3D姿态, 然后将其发布到话题/tf和 /tf_static.

在rviz中查看各关节的ff关系
roslaunch urdf_tutorial display.launch model:=llb.urdf gui:=true

URDF