本教程介绍了怎样从现有的机器人零件,如移动基体,简单手臂和手抓等,来生成一个复杂的机器人。
启动gazebo,并且确保你可以从以前的教程中导入模型
在教程Mobile Robot tutorial中,你将有你自己的移动机器人。
1.在本教程中,修改~/.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>
mkdir ~/.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'>manipulator.sdf</sdf> <author> <name>My Name</name> <email>[email protected]</email> </author> <description> My simple mobile manipulator </description> </model>
gedit ~/.gazebo/models/simple_mobile_manipulator/manipulator.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>