ROS-机器臂——从零构建机器人模型

瑞星  金牌会员 | 2024-7-17 03:50:09 | 显示全部楼层 | 阅读模式
打印 上一主题 下一主题

主题 535|帖子 535|积分 1605

URDF建模


URDF

URDF,全称为 Unified Robot Description Format(统一机器人描述格式),是一种用于描述机器人多少结构和运动学属性的标准文件格式。URDF 文件通常用于机器人模仿、路径规划、控制算法开辟和可视化等范畴,特别是在 ROS(Robot Operating System)环境中非常常见。
URDF 建模主要关注以下方面:
Link(链接):表示机器人中的刚体部门,如机器人的手臂、腿或任何静态部件。每个链接都有自己的惯性属性,如质量和转动惯量,以及多少外形,如碰撞体(colliders)和视觉表示(visuals)。
Joint(关节):描述链接之间的连接方式,包括关节范例(如revolute旋转关节、prismatic直线关节等)、关节轴线、限定条件(如关节限位)和动力学属性(如摩擦力)。
Inertial(惯性):描述链接的质量和转动惯量等物理属性。
Collision(碰撞):用于物理模仿和碰撞检测的多少外形,通常较为简单。
Visual(视觉):用于渲染和可视化的多少外形,可能比碰撞外形更复杂,以提供更真实的外貌。
Material(材质):界说颜色和纹理,用于视觉表示。
Actuator(实行器):描述驱动关节的装备,如电机或液压缸的属性。
Transmissions(传动装置):界说实行器如何影响关节的运动。
Gazebo Plugins(Gazebo 插件):用于在 Gazebo 模仿器中扩展机器人的行为,如传感器模型。
URDF 建模过程涉及创建和配置上述组件,以准确地反映机器人的结构和动力学。URDF 文件通常是 XML 格式的,可以通过文本编辑器手动编写,也可以使用工具辅助生成。
URDF 与 DH 参数(Denavit-Hartenberg 参数)有接洽,DH 参数用于描述关节间的相对位置和方向,而 URDF 可以基于这些参数来构建机器人的结构模型。然而,URDF 提供了更为丰富和详细的描述,包括多少外形、物理属性和传感器信息等。
机器人组成


内部关系


Links 与 Joints


Links


Joint


UDRF建模弊端


xacro模型文件


常量界说与使用


数学计算


宏界说、宏调用


文件包罗


界说排版


launch文件


#三维模型导出URDF
网上找到UR3机器臂的资源,把 “.step” 后缀结尾的文件,在solidwork中打开如图


link和joint的配置


生成模型功能包


测试修改bug


结果展示


solid works

SolidWorks 是一款广泛使用的三维 CAD 软件,主要用于机器筹划。要将 SolidWorks 的模型转换为 URDF(Unified Robot Description Format)格式,用于机器人仿真和控制,你需要一个插件大概工具来辅助这个过程。虽然 SolidWorks 自己并不直接支持 URDF 格式,但有一些第三方插件可以实现这一功能,比如 sw2urdf。
选择哪一款 SolidWorks 版本对于 URDF 转换而言,主要取决于以下几点:
插件兼容性:确保你所选择的 SolidWorks 版本与你打算使用的 URDF 插件兼容。差别的插件可能支持差别版本的 SolidWorks。
功能需求:如果你的模型非常复杂,可能需要使用更高版本的 SolidWorks,由于较新版本每每包罗更多功能和改进的性能,这可以帮助你更高效地创建和管理复杂的装配体。
硬件要求:SolidWorks 的高版本通常需要更强的硬件配置。如果您的计算机硬件不敷强大,可能会影响软件运行的流畅性和稳固性。
允许本钱:SolidWorks 差别版本的代价差别,且功能也有差别。你需要评估本钱效益,选择最适合你预算和需求的版本。
技术支持:较新的 SolidWorks 版本通常会获得更好的技术支持和更新。
用户熟悉度:如果你已经熟悉某个版本的 SolidWorks,除非有特别的功能需求,否则继续使用熟悉的版本可能会更加高效。
对于 URDF 导出而言,关键在于找到一个稳固且功能全面的插件,它能够准确地将你的 SolidWorks 模型转换为 URDF 文件。sw2urdf 插件能够处置惩罚 SolidWorks 的零件和装配体,主动识别关节范例、变动和轴,这对于 URDF 建模是非常重要的。
目录架构


相关文件

CMakeLists.txt

  1. cmake_minimum_required(VERSION 2.8.3)
  2. project(UR3)
  3. find_package(catkin REQUIRED)
  4. catkin_package()
  5. find_package(roslaunch)
  6. foreach(dir config launch meshes urdf)
  7.         install(DIRECTORY ${dir}/
  8.                 DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}/${dir})
  9. endforeach(dir)
复制代码
package.xml

  1. <package format="2">
  2.   <name>UR3</name>
  3.   <version>1.0.0</version>
  4.   <description>
  5.     <p>URDF Description package for UR3</p>
  6.     <p>This package contains configuration data, 3D models and launch files
  7. for UR3 robot</p>
  8.   </description>
  9.   <author>TODO</author>
  10.   <maintainer email="TODO@email.com" />
  11.   <license>BSD</license>
  12.   <buildtool_depend>catkin</buildtool_depend>
  13.   <depend>roslaunch</depend>
  14.   <depend>robot_state_publisher</depend>
  15.   <depend>rviz</depend>
  16.   <depend>joint_state_publisher_gui</depend>
  17.   <depend>gazebo</depend>
  18.   <export>
  19.     <architecture_independent />
  20.   </export>
  21. </package>
复制代码
display.launch

  1. <launch>
  2.   <arg
  3.     name="model" />
  4.   <param
  5.     name="robot_description"
  6.     textfile="$(find UR3)/urdf/UR3.urdf" />
  7.   
  8.   <node
  9.     name="joint_state_publisher_gui"
  10.     pkg="joint_state_publisher_gui"
  11.     type="joint_state_publisher_gui" />
  12.   
  13.   <node
  14.     name="robot_state_publisher"
  15.     pkg="robot_state_publisher"
  16.     type="robot_state_publisher" />
  17.   
  18.   <node
  19.     name="rviz"
  20.     pkg="rviz"
  21.     type="rviz"
  22.     args="-d $(find UR3)/urdf.rviz" />
  23. </launch>
复制代码
gazebo.launch

  1. <launch>
  2.   <include
  3.     file="$(find gazebo_ros)/launch/empty_world.launch" />
  4.   <node
  5.     name="tf_footprint_base"
  6.     pkg="tf"
  7.     type="static_transform_publisher"
  8.     args="0 0 0 0 0 0 base_link base_footprint 40" />
  9.   <node
  10.     name="spawn_model"
  11.     pkg="gazebo_ros"
  12.     type="spawn_model"
  13.     args="-file $(find UR3)/urdf/UR3.urdf -urdf -model UR3"
  14.     output="screen" />
  15.   <node
  16.     name="fake_joint_calibration"
  17.     pkg="rostopic"
  18.     type="rostopic"
  19.     args="pub /calibrated std_msgs/Bool true" />
  20. </launch>
复制代码
ur3.urdf

  1. <?xml version="1.0" encoding="utf-8"?>
  2. <!-- This URDF was automatically created by SolidWorks to URDF Exporter! Originally created by Stephen Brawner (brawner@gmail.com)
  3.      Commit Version: 1.6.0-4-g7f85cfe  Build Version: 1.6.7995.38578
  4.      For more information, please see http://wiki.ros.org/sw_urdf_exporter -->
  5. <robot
  6.   name="UR3">
  7.   <link
  8.     name="base_link">
  9.     <inertial>
  10.       <origin
  11.         xyz="2.105E-05 0.098059 -0.0036545"
  12.         rpy="0 0 0" />
  13.       <mass
  14.         value="1.371" />
  15.       <inertia
  16.         ixx="0.0018288"
  17.         ixy="4.4582E-07"
  18.         ixz="-2.0556E-07"
  19.         iyy="0.0019082"
  20.         iyz="0.00013405"
  21.         izz="0.0017646" />
  22.     </inertial>
  23.     <visual>
  24.       <origin
  25.         xyz="0 0 0"
  26.         rpy="0 0 0" />
  27.       <geometry>
  28.         <mesh
  29.           filename="package://UR3/meshes/base_link.STL" />   
  30.       </geometry>
  31.       <material
  32.         name="">
  33.         <color
  34.           rgba="0.89804 0.91765 0.92941 1" />
  35.       </material>
  36.     </visual>
  37.     <collision>
  38.       <origin
  39.         xyz="0 0 0"
  40.         rpy="0 0 0" />
  41.       <geometry>
  42.         <mesh
  43.           filename="package://UR3/meshes/base_link.STL" />
  44.       </geometry>
  45.     </collision>
  46.   </link>
  47.   <link
  48.     name="link1">
  49.     <inertial>
  50.       <origin
  51.         xyz="-6.5885E-06 0.055927 0.0072937"
  52.         rpy="0 0 0" />
  53.       <mass
  54.         value="0.75521" />
  55.       <inertia
  56.         ixx="0.0010675"
  57.         ixy="-9.4953E-08"
  58.         ixz="1.0255E-07"
  59.         iyy="0.00090525"
  60.         iyz="-0.00013058"
  61.         izz="0.00099003" />
  62.     </inertial>
  63.     <visual>
  64.       <origin
  65.         xyz="0 0 0"
  66.         rpy="0 0 0" />
  67.       <geometry>
  68.         <mesh
  69.           filename="package://UR3/meshes/link1.STL" />
  70.       </geometry>
  71.       <material
  72.         name="">
  73.         <color
  74.           rgba="0.79216 0.81961 0.93333 1" />
  75.       </material>
  76.     </visual>
  77.     <collision>
  78.       <origin
  79.         xyz="0 0 0"
  80.         rpy="0 0 0" />
  81.       <geometry>
  82.         <mesh
  83.           filename="package://UR3/meshes/link1.STL" />
  84.       </geometry>
  85.     </collision>
  86.   </link>
  87.   <joint
  88.     name="joint1"
  89.     type="revolute">
  90.     <origin
  91.       xyz="0 0 0.0844"
  92.       rpy="1.5708 0 -3.1416" />
  93.     <parent
  94.       link="base_link" />
  95.     <child
  96.       link="link1" />
  97.     <axis
  98.       xyz="1 0 0" />
  99.     <limit
  100.       lower="-3.14"
  101.       upper="3.14"
  102.       effort="100"
  103.       velocity="1" />
  104.   </joint>
  105.   <link
  106.     name="link2">
  107.     <inertial>
  108.       <origin
  109.         xyz="-2.6778E-06 0.060634 0.09327"
  110.         rpy="0 0 0" />
  111.       <mass
  112.         value="1.6559" />
  113.       <inertia
  114.         ixx="0.0025822"
  115.         ixy="-8.909E-08"
  116.         ixz="1.019E-07"
  117.         iyy="0.002419"
  118.         iyz="-9.301E-05"
  119.         izz="0.0016021" />
  120.     </inertial>
  121.     <visual>
  122.       <origin
  123.         xyz="0 0 0"
  124.         rpy="0 0 0" />
  125.       <geometry>
  126.         <mesh
  127.           filename="package://UR3/meshes/link2.STL" />
  128.       </geometry>
  129.       <material
  130.         name="">
  131.         <color
  132.           rgba="0.79216 0.81961 0.93333 1" />
  133.       </material>
  134.     </visual>
  135.     <collision>
  136.       <origin
  137.         xyz="0 0 0"
  138.         rpy="0 0 0" />
  139.       <geometry>
  140.         <mesh
  141.           filename="package://UR3/meshes/link2.STL" />
  142.       </geometry>
  143.     </collision>
  144.   </link>
  145.   <joint
  146.     name="joint2"
  147.     type="revolute">
  148.     <origin
  149.       xyz="0 0.0675 0.05235"
  150.       rpy="1.5708 0 -3.1416" />
  151.     <parent
  152.       link="link1" />
  153.     <child
  154.       link="link2" />
  155.     <axis
  156.       xyz="1 0 0" />
  157.     <limit
  158.       lower="-3.14"
  159.       upper="3.14"
  160.       effort="100"
  161.       velocity="1" />
  162.   </joint>
  163.   <link
  164.     name="link3">
  165.     <inertial>
  166.       <origin
  167.         xyz="-0.0050453 -0.11121 3.4154E-06"
  168.         rpy="0 0 0" />
  169.       <mass
  170.         value="0.96204" />
  171.       <inertia
  172.         ixx="0.0010146"
  173.         ixy="4.5981E-05"
  174.         ixz="6.2628E-08"
  175.         iyy="0.00054242"
  176.         iyz="-4.3697E-08"
  177.         izz="0.0010724" />
  178.     </inertial>
  179.     <visual>
  180.       <origin
  181.         xyz="0 0 0"
  182.         rpy="0 0 0" />
  183.       <geometry>
  184.         <mesh
  185.           filename="package://UR3/meshes/link3.STL" />
  186.       </geometry>
  187.       <material
  188.         name="">
  189.         <color
  190.           rgba="1 1 1 1" />
  191.       </material>
  192.     </visual>
  193.     <collision>
  194.       <origin
  195.         xyz="0 0 0"
  196.         rpy="0 0 0" />
  197.       <geometry>
  198.         <mesh
  199.           filename="package://UR3/meshes/link3.STL" />
  200.       </geometry>
  201.     </collision>
  202.   </link>
  203.   <joint
  204.     name="joint3"
  205.     type="revolute">
  206.     <origin
  207.       xyz="0 -0.02535 0.24365"
  208.       rpy="-1.5708 0 -1.5708" />
  209.     <parent
  210.       link="link2" />
  211.     <child
  212.       link="link3" />
  213.     <axis
  214.       xyz="1 0 0" />
  215.     <limit
  216.       lower="-3.14"
  217.       upper="3.14"
  218.       effort="100"
  219.       velocity="1" />
  220.   </joint>
  221.   <link
  222.     name="link4">
  223.     <inertial>
  224.       <origin
  225.         xyz="0.0059208 -0.0007977 2.6694E-07"
  226.         rpy="0 0 0" />
  227.       <mass
  228.         value="0.32519" />
  229.       <inertia
  230.         ixx="0.00019459"
  231.         ixy="1.8337E-05"
  232.         ixz="1.3898E-10"
  233.         iyy="0.00019909"
  234.         iyz="1.2329E-09"
  235.         izz="0.00022621" />
  236.     </inertial>
  237.     <visual>
  238.       <origin
  239.         xyz="0 0 0"
  240.         rpy="0 0 0" />
  241.       <geometry>
  242.         <mesh
  243.           filename="package://UR3/meshes/link4.STL" />
  244.       </geometry>
  245.       <material
  246.         name="">
  247.         <color
  248.           rgba="1 1 1 1" />
  249.       </material>
  250.     </visual>
  251.     <collision>
  252.       <origin
  253.         xyz="0 0 0"
  254.         rpy="0 0 0" />
  255.       <geometry>
  256.         <mesh
  257.           filename="package://UR3/meshes/link4.STL" />
  258.       </geometry>
  259.     </collision>
  260.   </link>
  261.   <joint
  262.     name="joint4"
  263.     type="revolute">
  264.     <origin
  265.       xyz="-0.0834 -0.213 0"
  266.       rpy="-3.1416 0 0" />
  267.     <parent
  268.       link="link3" />
  269.     <child
  270.       link="link4" />
  271.     <axis
  272.       xyz="1 0 0" />
  273.     <limit
  274.       lower="-3.14"
  275.       upper="3.14"
  276.       effort="100"
  277.       velocity="1" />
  278.   </joint>
  279.   <link
  280.     name="link5">
  281.     <inertial>
  282.       <origin
  283.         xyz="0.0059208 0.00079771 -2.3761E-07"
  284.         rpy="0 0 0" />
  285.       <mass
  286.         value="0.32519" />
  287.       <inertia
  288.         ixx="0.00019459"
  289.         ixy="-1.8338E-05"
  290.         ixz="-2.0382E-10"
  291.         iyy="0.00019909"
  292.         iyz="1.211E-09"
  293.         izz="0.00022621" />
  294.     </inertial>
  295.     <visual>
  296.       <origin
  297.         xyz="0 0 0"
  298.         rpy="0 0 0" />
  299.       <geometry>
  300.         <mesh
  301.           filename="package://UR3/meshes/link5.STL" />
  302.       </geometry>
  303.       <material
  304.         name="">
  305.         <color
  306.           rgba="1 1 1 1" />
  307.       </material>
  308.     </visual>
  309.     <collision>
  310.       <origin
  311.         xyz="0 0 0"
  312.         rpy="0 0 0" />
  313.       <geometry>
  314.         <mesh
  315.           filename="package://UR3/meshes/link5.STL" />
  316.       </geometry>
  317.     </collision>
  318.   </link>
  319.   <joint
  320.     name="joint5"
  321.     type="revolute">
  322.     <origin
  323.       xyz="0 0.0834 0"
  324.       rpy="0 0 -1.5708" />
  325.     <parent
  326.       link="link4" />
  327.     <child
  328.       link="link5" />
  329.     <axis
  330.       xyz="1 0 0" />
  331.     <limit
  332.       lower="-3.14"
  333.       upper="3.14"
  334.       effort="100"
  335.       velocity="1" />
  336.   </joint>
  337.   <link
  338.     name="link6">
  339.     <inertial>
  340.       <origin
  341.         xyz="4.7334E-10 0.00010334 -0.021073"
  342.         rpy="0 0 0" />
  343.       <mass
  344.         value="0.11536" />
  345.       <inertia
  346.         ixx="4.2469E-05"
  347.         ixy="1.5688E-12"
  348.         ixz="1.7329E-12"
  349.         iyy="4.2681E-05"
  350.         iyz="1.0324E-07"
  351.         izz="5.9067E-05" />
  352.     </inertial>
  353.     <visual>
  354.       <origin
  355.         xyz="0 0 0"
  356.         rpy="0 0 0" />
  357.       <geometry>
  358.         <mesh
  359.           filename="package://UR3/meshes/link6.STL" />
  360.       </geometry>
  361.       <material
  362.         name="">
  363.         <color
  364.           rgba="1 1 1 1" />
  365.       </material>
  366.     </visual>
  367.     <collision>
  368.       <origin
  369.         xyz="0 0 0"
  370.         rpy="0 0 0" />
  371.       <geometry>
  372.         <mesh
  373.           filename="package://UR3/meshes/link6.STL" />
  374.       </geometry>
  375.     </collision>
  376.   </link>
  377.   <joint
  378.     name="joint6"
  379.     type="revolute">
  380.     <origin
  381.       xyz="0 -0.0409 0"
  382.       rpy="1.5708 0.2207 3.1416" />
  383.     <parent
  384.       link="link5" />
  385.     <child
  386.       link="link6" />
  387.     <axis
  388.       xyz="1 0 0" />
  389.     <limit
  390.       lower="-3.14"
  391.       upper="3.14"
  392.       effort="100"
  393.       velocity="1" />
  394.   </joint>
  395. </robot>
复制代码
免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!更多信息从访问主页:qidao123.com:ToB企服之家,中国第一个企服评测及商务社交产业平台。

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?立即注册

x
回复

使用道具 举报

0 个回复

倒序浏览

快速回复

您需要登录后才可以回帖 登录 or 立即注册

本版积分规则

瑞星

金牌会员
这个人很懒什么都没写!

标签云

快速回复 返回顶部 返回列表