前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >ROS深入探索(五)——创建简单的机器人模型smartcar

ROS深入探索(五)——创建简单的机器人模型smartcar

作者头像
CreateAMind
发布2018-07-24 16:34:14
4780
发布2018-07-24 16:34:14
举报
文章被收录于专栏:CreateAMind

机器人模型smartcar

前面我们使用的是已有的机器人模型进行仿真,这一节我们将建立一个简单的智能车机器人smartcar,为后面建立复杂机器人打下基础。

一、创建硬件描述包

roscreat-pkg smartcar_description urdf

二、智能车尺寸数据

因为建立的是一个非常简单的机器人,所以我们尽量使用简单的元素:使用长方体代替车模,使用圆柱代替车轮,具体尺寸如下:

三、建立urdf文件

在smartcar_description文件夹下建立urdf文件夹,创建智能车的描述文件smartcar.urdf,描述代码如下:

<?xml version="1.0"?> <robot name="smartcar"> <link name="base_link"> <visual> <geometry> <box size="0.25 .16 .05"/> </geometry> <origin rpy="0 0 1.57075" xyz="0 0 0"/> <material name="blue"> <color rgba="0 0 .8 1"/> </material> </visual> </link> <link name="right_front_wheel"> <visual> <geometry> <cylinder length=".02" radius="0.025"/> </geometry> <material name="black"> <color rgba="0 0 0 1"/> </material> </visual> </link> <joint name="right_front_wheel_joint" type="continuous"> <axis xyz="0 0 1"/> <parent link="base_link"/> <child link="right_front_wheel"/> <origin rpy="0 1.57075 0" xyz="0.08 0.1 -0.03"/> <limit effort="100" velocity="100"/> <joint_properties damping="0.0" friction="0.0"/> </joint> <link name="right_back_wheel"> <visual> <geometry> <cylinder length=".02" radius="0.025"/> </geometry> <material name="black"> <color rgba="0 0 0 1"/> </material> </visual> </link> <joint name="right_back_wheel_joint" type="continuous"> <axis xyz="0 0 1"/> <parent link="base_link"/> <child link="right_back_wheel"/> <origin rpy="0 1.57075 0" xyz="0.08 -0.1 -0.03"/> <limit effort="100" velocity="100"/> <joint_properties damping="0.0" friction="0.0"/> </joint> <link name="left_front_wheel"> <visual> <geometry> <cylinder length=".02" radius="0.025"/> </geometry> <material name="black"> <color rgba="0 0 0 1"/> </material> </visual> </link> <joint name="left_front_wheel_joint" type="continuous"> <axis xyz="0 0 1"/> <parent link="base_link"/> <child link="left_front_wheel"/> <origin rpy="0 1.57075 0" xyz="-0.08 0.1 -0.03"/> <limit effort="100" velocity="100"/> <joint_properties damping="0.0" friction="0.0"/> </joint> <link name="left_back_wheel"> <visual> <geometry> <cylinder length=".02" radius="0.025"/> </geometry> <material name="black"> <color rgba="0 0 0 1"/> </material> </visual> </link> <joint name="left_back_wheel_joint" type="continuous"> <axis xyz="0 0 1"/> <parent link="base_link"/> <child link="left_back_wheel"/> <origin rpy="0 1.57075 0" xyz="-0.08 -0.1 -0.03"/> <limit effort="100" velocity="100"/> <joint_properties damping="0.0" friction="0.0"/> </joint> <link name="head"> <visual> <geometry> <box size=".02 .03 .03"/> </geometry> <material name="white"> <color rgba="1 1 1 1"/> </material> </visual> </link> <joint name="tobox" type="fixed"> <parent link="base_link"/> <child link="head"/> <origin xyz="0 0.08 0.025"/> </joint> </robot>

四、建立launch命令文件

在smartcar_description文件夹下建立launch文件夹,创建智能车的描述文件 base.urdf.rviz.launch,描述代码如下:

<launch> <arg name="model" /> <arg name="gui" default="False" /> <param name="robot_description" textfile="$(find smartcar_description)/urdf/smartcar.urdf" /> <param name="use_gui" value="$(arg gui)"/> <node name="joint_state_publisher" pkg="joint_state_publisher" type="joint_state_publisher" > </node> <node name="robot_state_publisher" pkg="robot_state_publisher" type="state_publisher" /> <node name="rviz" pkg="rviz" type="rviz" args="-d $(find urdf_tutorial)/urdf.vcg" /> </launch>

五、效果演示

在终端中输入显示命令:

roslaunch smartcar_description base.urdf.rviz.launch gui:=true

显示效果如下图所示,使用gui中的控制bar可以控制四个轮子单独旋转。

END

转自古-月

http://blog.csdn.net/hcx25909

本文参与 腾讯云自媒体同步曝光计划,分享自微信公众号。
原始发表:2017-04-25,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 CreateAMind 微信公众号,前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档