八 Gazebo学习总结之附加抓手到机器人

时间:2021-11-21 03:26:51

开始Gazebo,确定能从先前的教程中载入模型。

1.应该有如下图所示的底座。

八  Gazebo学习总结之附加抓手到机器人

2.根据经验,为了使模型变大,修改~/.gazebo/models/my_robot/model.sdf,让小车能容纳抓手。

gedit ~/.gazebo/models/my_robot/model.sdf
按以下程序更新内容:

<?xml version='1.0'?>
<sdf version='1.4'>
<model name="mobile_base">
<link name='chassis'>
<pose>0 0 .25 0 0 0</pose>

<inertial>
<mass>20.0</mass>
<pose>-0.1 0 -0.1 0 0 0</pose>
<inertia>
<ixx>0.5</ixx>
<iyy>1.0</iyy>
<izz>0.1</izz>
</inertia>
</inertial>

<collision name='collision'>
<geometry>
<box>
<size>2 1 0.3</size>
</box>
</geometry>
</collision>

<visual name='visual'>
<geometry>
<box>
<size>2 1 0.3</size>
</box>
</geometry>
</visual>

<collision name='caster_collision'>
<pose>-0.8 0 -0.125 0 0 0</pose>
<geometry>
<sphere>
<radius>.125</radius>
</sphere>
</geometry>

<surface>
<friction>
<ode>
<mu>0</mu>
<mu2>0</mu2>
</ode>
</friction>
</surface>
</collision>

<visual name='caster_visual'>
<pose>-0.8 0 -0.125 0 0 0</pose>
<geometry>
<sphere>
<radius>.125</radius>
</sphere>
</geometry>
</visual>
</link>
<link name="left_wheel">
<pose>0.8 0.6 0.125 0 1.5707 1.5707</pose>
<collision name="collision">
<geometry>
<cylinder>
<radius>.125</radius>
<length>.05</length>
</cylinder>
</geometry>
</collision>
<visual name="visual">
<geometry>
<cylinder>
<radius>.125</radius>
<length>.05</length>
</cylinder>
</geometry>
</visual>
</link>

<link name="right_wheel">
<pose>0.8 -0.6 0.125 0 1.5707 1.5707</pose>
<collision name="collision">
<geometry>
<cylinder>
<radius>.125</radius>
<length>.05</length>
</cylinder>
</geometry>
</collision>
<visual name="visual">
<geometry>
<cylinder>
<radius>.125</radius>
<length>.05</length>
</cylinder>
</geometry>
</visual>
</link>

<joint type="revolute" name="left_wheel_hinge">
<pose>0 0 -0.03 0 0 0</pose>
<child>left_wheel</child>
<parent>chassis</parent>
<axis>
<xyz>0 1 0</xyz>
</axis>
</joint>

<joint type="revolute" name="right_wheel_hinge">
<pose>0 0 0.03 0 0 0</pose>
<child>right_wheel</child>
<parent>chassis</parent>
<axis>
<xyz>0 1 0</xyz>
</axis>
</joint>

</model>
</sdf>

更新后结果如下:

八  Gazebo学习总结之附加抓手到机器人

组装复合机器人:

1.创建新的模型目录

mkdir ~/.gazebo/models/simple_mobile_manipulator
cd ~/.gazebo/models/simple_mobile_manipulator
编辑模型的配置文件

gedit ~/.gazebo/models/simple_mobile_manipulator/model.config
复制以下程序到配置文件:

<?xml version="1.0"?>
<model>
<name>Simple Mobile Manipulator</name>
<version>1.0</version>
<sdf version='1.4'>model.sdf</sdf>

<author>
<name>My Name</name>
<email>me@my.email</email>
</author>

<description>
My simple mobile manipulator
</description>
</model>

2.创建模型SDF文件。

gedit ~/.gazebo/models/simple_mobile_manipulator/model.sdf
复制以下内容到.sdf文件中:

<?xml version="1.0" ?>
<sdf version="1.3">
<model name="simple_mobile_manipulator">

<include>
<uri>model://my_gripper</uri>
<pose>1.3 0 0.1 0 0 0</pose>
</include>

<include>
<uri>model://my_robot</uri>
<pose>0 0 0 0 0 0</pose>
</include>

<joint name="arm_gripper_joint" type="revolute">
<parent>mobile_base::chassis</parent>
<child>simple_gripper::riser</child>
<axis>
<limit>
<lower>0</lower>
<upper>0</upper>
</limit>
<xyz>0 0 1</xyz>
</axis>
</joint>

<!-- attach sensor to the gripper -->
<include>
<uri>model://hokuyo</uri>
<pose>1.3 0 0.3 0 0 0</pose>
</include>

<joint name="hokuyo_joint" type="revolute">
<child>hokuyo::link</child>
<parent>simple_gripper::palm</parent>
<axis>
<xyz>0 0 1</xyz>
<limit>
<upper>0</upper>
<lower>0</lower>
</limit>
</axis>
</joint>

</model>
</sdf>

3.保存模型的.config和.sdf文件,运行Gazebo。

八  Gazebo学习总结之附加抓手到机器人


本文靠自己理解,翻译而来,错误之处望不吝指教!!!