URDF机器人模型ROS1&2案例(noetic+galactic)

Posted zhangrelay

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了URDF机器人模型ROS1&2案例(noetic+galactic)相关的知识,希望对你有一定的参考价值。

URDF机器人模型ROS1&2案例_zhangrelay的专栏-CSDN博客

ROS机器人URDF建模_zhangrelay的专栏-CSDN博客


如上两篇博客所涉及案例,如下:

zhangrelay / urdf_tutorial · GitCode

为啥不使用github……

主要是方便学生朋友使用,网络稳定且快速

  1. ros1 :master/noetic
  2. ros2 :   galactic

请注意分支选择,不要搞错了。

  1. ros1编译使用catkin;
  2. ros2编译使用colcon。 

除了官方案例,还加入了三个简单机器人模型:

.
├── CHANGELOG.rst
├── CMakeLists.txt
├── images
│   ├── flexible.png
│   ├── materials.png
│   ├── multipleshapes.png
│   ├── myfirst.png
│   ├── origins.png
│   └── visual.png
├── launch
│   └── display.launch
├── meshes
│   ├── base_link.STL
│   ├── belt.dae
│   ├── body3.dae
│   ├── flw2.dae
│   ├── head_screen.dae
│   ├── left_belt.dae
│   ├── l_finger_color.tif
│   ├── l_finger.dae
│   ├── l_finger_tip_color.tif
│   ├── l_finger_tip.dae
│   ├── lift3.dae
│   ├── link_1.dae
│   ├── link_1.STL
│   ├── link_2.dae
│   ├── link_2.STL
│   ├── link_3.STL
│   ├── link_4.STL
│   ├── link_5.dae
│   ├── link_5.STL
│   ├── link_6.STL
│   ├── link_7.STL
│   ├── right_belt.dae
│   ├── rlw2.dae
│   ├── trackbase_left.dae
│   └── trackbase_right.dae
├── package.xml
├── README.md
├── rviz
│   ├── urdf.rviz
│   └── urdf.vcg
└── urdf
    ├── 01-myfirst.urdf
    ├── 02-multipleshapes.urdf
    ├── 03-origins.urdf
    ├── 04-materials.urdf
    ├── 05-visual.urdf
    ├── 06-flexible.urdf
    ├── 07-physics.urdf
    ├── 08-macroed.urdf.xacro
    ├── cozmo2.urdf
    ├── magician.urdf
    └── robot1_base1.urdf

5 directories, 49 files
  1. cozmo2
  2. magician
  3. robot1_base1

当然,开源模型都可以加入并直接使用。

cozmo2:

 

 magician:

 

其余案例依据官网学习即可。 

robot1_base1如下:

<?xml version="1.0" ?>

<robot name="robot1_xacro" xmlns:controller="http://playerstage.sourceforge.net/gazebo/xmlschema/#controller" xmlns:interface="http://playerstage.sourceforge.net/gazebo/xmlschema/#interface" xmlns:sensor="http://playerstage.sourceforge.net/gazebo/xmlschema/#sensor">
  <link name="base_footprint">
    <visual>
      <geometry>
        <box size="0.001 0.001 0.001"/>
      </geometry>
      <origin rpy="0 0 0" xyz="0 0 0"/>
    </visual>
    <inertial>
      <mass value="0.0001"/>
      <inertia ixx="1.0" ixy="0.0" ixz="0.0" iyy="1.0" iyz="0.0" izz="1.0"/>
    </inertial>
  </link>
  <gazebo reference="base_footprint">
    <material>Gazebo/Green</material>
    <turnGravityOff>false</turnGravityOff>
  </gazebo>
  <joint name="base_footprint_joint" type="fixed">
    <origin xyz="0 0 0"/>
    <parent link="base_footprint"/>
    <child link="base_link"/>
  </joint>
  <link name="base_link">
    <visual>
      <geometry>
        <box size="0.2 .3 .1"/>
      </geometry>
      <origin rpy="0 0 1.54" xyz="0 0 0.05"/>
      <material name="white">
        <color rgba="1 1 1 1"/>
      </material>
    </visual>
    <collision>
      <geometry>
        <box size="0.2 .3 0.1"/>
      </geometry>
    </collision>
    <inertial>
      <mass value="10"/>
      <inertia ixx="1.0" ixy="0.0" ixz="0.0" iyy="1.0" iyz="0.0" izz="1.0"/>
    </inertial>
  </link>
  <link name="wheel_1">
    <visual>
      <geometry>
        <cylinder length="0.05" radius="0.05"/>
      </geometry>
      <origin rpy="0 0 0" xyz="0 0 0"/>
      <material name="black">
        <color rgba="0 0 0 1"/>
      </material>
    </visual>
    <collision>
      <geometry>
        <cylinder length="0.05" radius="0.05"/>
      </geometry>
    </collision>
    <inertial>
      <mass value="1"/>
      <inertia ixx="1.0" ixy="0.0" ixz="0.0" iyy="1.0" iyz="0.0" izz="1.0"/>
    </inertial>
  </link>
  <link name="wheel_2">
    <visual>
      <geometry>
        <cylinder length="0.05" radius="0.05"/>
      </geometry>
      <origin rpy="0 0 0" xyz="0 0 0"/>
      <material name="black"/>
    </visual>
    <collision>
      <geometry>
        <cylinder length="0.05" radius="0.05"/>
      </geometry>
    </collision>
    <inertial>
      <mass value="1"/>
      <inertia ixx="1.0" ixy="0.0" ixz="0.0" iyy="1.0" iyz="0.0" izz="1.0"/>
    </inertial>
  </link>
  <link name="wheel_3">
    <visual>
      <geometry>
        <cylinder length="0.05" radius="0.05"/>
      </geometry>
      <origin rpy="0 0 0" xyz="0 0 0"/>
      <material name="black"/>
    </visual>
    <collision>
      <geometry>
        <cylinder length="0.05" radius="0.05"/>
      </geometry>
    </collision>
    <inertial>
      <mass value="1"/>
      <inertia ixx="1.0" ixy="0.0" ixz="0.0" iyy="1.0" iyz="0.0" izz="1.0"/>
    </inertial>
  </link>
  <link name="wheel_4">
    <visual>
      <geometry>
        <cylinder length="0.05" radius="0.05"/>
      </geometry>
      <origin rpy="0 0 0" xyz="0 0 0"/>
      <material name="black"/>
    </visual>
    <collision>
      <geometry>
        <cylinder length="0.05" radius="0.05"/>
      </geometry>
    </collision>
    <inertial>
      <mass value="1"/>
      <inertia ixx="1.0" ixy="0.0" ixz="0.0" iyy="1.0" iyz="0.0" izz="1.0"/>
    </inertial>
  </link>
  <joint name="base_to_wheel1" type="continuous">
    <parent link="base_link"/>
    <child link="wheel_1"/>
    <origin rpy="1.5707 0 0" xyz="0.1 0.15 0"/>
    <axis xyz="0 0 1"/>
  </joint>
  <joint name="base_to_wheel2" type="continuous">
    <axis xyz="0 0 1"/>
    <anchor xyz="0 0 0"/>
    <limit effort="100" velocity="100"/>
    <parent link="base_link"/>
    <child link="wheel_2"/>
    <origin rpy="1.5707 0 0" xyz="-0.1 0.15 0"/>
  </joint>
  <joint name="base_to_wheel3" type="continuous">
    <parent link="base_link"/>
    <axis xyz="0 0 1"/>
    <child link="wheel_3"/>
    <origin rpy="1.5707 0 0" xyz="0.1 -0.15 0"/>
  </joint>
  <joint name="base_to_wheel4" type="continuous">
    <parent link="base_link"/>
    <axis xyz="0 0 1"/>
    <child link="wheel_4"/>
    <origin rpy="1.5707 0 0" xyz="-0.1 -0.15 0"/>
  </joint>
</robot>

git记录如下:

  1. git init
  2. git remote add origin https://gitcode.net/ZhangRelay/urdf_tutorial.git
  3. git add .
  4. git commit -m "Initial commit"
  5. git push -u origin master

ros1:

  1. roslaunch urdf_tutorial display.launch model:=urdf/cozmo2.urdf
  2. roslaunch urdf_tutorial display.launch model:=urdf/magician.urdf
  3. roslaunch urdf_tutorial display.launch model:=urdf/robot1_base1.urdf
     

ros2:

  1. ros2 launch urdf_tutorial display.launch.py model:=urdf/robot1_base1.urdf
  2. ros2 launch urdf_tutorial display.launch.py model:=urdf/magician.urdf
  3. ros2 launch urdf_tutorial display.launch.py model:=urdf/cozmo2.urdf

以上是关于URDF机器人模型ROS1&2案例(noetic+galactic)的主要内容,如果未能解决你的问题,请参考以下文章

ROS1云课→16机器人模型从urdf到xacro

ROS1云课→16机器人模型从urdf到xacro

ROS机器人URDF建模

ROS1中Gazebo案例都有哪些机器人呢(Noetic2022)

ROS1云课→17化繁为简stdr和f1tenth

ROS1云课→17化繁为简stdr和f1tenth