Robot Operating System (ROS)学习笔记---创建简单的机器人模型smartcar

Robot Operating System (ROS)学习笔记---创建简单的机器人模型smartcar

搭建环境:XMWare  Ubuntu14.04  ROS(indigo)

转载自古月居  转载连接:http://www.guyuehome.com/243

一、创建硬件描述包

    1. 已创建catkin_ws
    2. 打开终端(Ctrl + Alt + T)输入:cd ~/catkin_ws/src
    3. 输入:catkin_create_pkg smartcar_description urdf (indigo版)

 

二、智能车尺寸数据

 

三、建立urdf文件

  1. 在smartcar_description文件夹下创建urdf文件:先定位到smartcar_description(cd ~/catkin_ws/src/smartcar_description),然后输入:mkdir urdf //创建urdf文件夹
  2. 定位到urdf(cd urdf)文件夹,创建smartcar.urdf(touch smartcar.urdf),在smartcar.urdf中插入下列代码
  1 xml version="1.0"?>  
  2 <robot name="smartcar">  
  3   <link name="base_link">  
  4     <visual>  
  5       <geometry>  
  6         <box size="0.25 .16 .05"/>  
  7     geometry>  
  8     <origin rpy="0 0 1.57075" xyz="0 0 0"/>  
  9     <material name="blue">  
 10         <color rgba="0 0 .8 1"/>  
 11     material>  
 12     visual>  
 13 link>  
 14  
 15 <link name="right_front_wheel">  
 16     <visual>  
 17       <geometry>  
 18         <cylinder length=".02" radius="0.025"/>  
 19       geometry>  
 20       <material name="black">  
 21         <color rgba="0 0 0 1"/>  
 22       material>  
 23     visual>  
 24   link>  
 25  
 26   <joint name="right_front_wheel_joint" type="continuous">  
 27     <axis xyz="0 0 1"/>  
 28     <parent link="base_link"/>  
 29     <child link="right_front_wheel"/>  
 30     <origin rpy="0 1.57075 0" xyz="0.08 0.1 -0.03"/>  
 31     <limit effort="100" velocity="100"/>  
 32     <joint_properties damping="0.0" friction="0.0"/>  
 33   joint>  
 34  
 35   <link name="right_back_wheel">  
 36     <visual>  
 37       <geometry>  
 38         <cylinder length=".02" radius="0.025"/>  
 39       geometry>  
 40       <material name="black">  
 41         <color rgba="0 0 0 1"/>  
 42       material>  
 43     visual>  
 44   link>  
 45  
 46   <joint name="right_back_wheel_joint" type="continuous">  
 47     <axis xyz="0 0 1"/>  
 48     <parent link="base_link"/>  
 49     <child link="right_back_wheel"/>  
 50     <origin rpy="0 1.57075 0" xyz="0.08 -0.1 -0.03"/>  
 51     <limit effort="100" velocity="100"/>  
 52     <joint_properties damping="0.0" friction="0.0"/>  
 53 joint>  
 54  
 55 <link name="left_front_wheel">  
 56     <visual>  
 57       <geometry>  
 58         <cylinder length=".02" radius="0.025"/>  
 59       geometry>  
 60       <material name="black">  
 61         <color rgba="0 0 0 1"/>  
 62       material>  
 63     visual>  
 64   link>  
 65  
 66   <joint name="left_front_wheel_joint" type="continuous">  
 67     <axis xyz="0 0 1"/>  
 68     <parent link="base_link"/>  
 69     <child link="left_front_wheel"/>  
 70     <origin rpy="0 1.57075 0" xyz="-0.08 0.1 -0.03"/>  
 71     <limit effort="100" velocity="100"/>  
 72     <joint_properties damping="0.0" friction="0.0"/>  
 73   joint>  
 74  
 75   <link name="left_back_wheel">  
 76     <visual>  
 77       <geometry>  
 78         <cylinder length=".02" radius="0.025"/>  
 79       geometry>  
 80       <material name="black">  
 81         <color rgba="0 0 0 1"/>  
 82       material>  
 83     visual>  
 84   link>  
 85  
 86   <joint name="left_back_wheel_joint" type="continuous">  
 87     <axis xyz="0 0 1"/>  
 88     <parent link="base_link"/>  
 89     <child link="left_back_wheel"/>  
 90     <origin rpy="0 1.57075 0" xyz="-0.08 -0.1 -0.03"/>  
 91     <limit effort="100" velocity="100"/>  
 92     <joint_properties damping="0.0" friction="0.0"/>  
 93   joint>  
 94  
 95   <link name="head">  
 96     <visual>  
 97       <geometry>  
 98         <box size=".02 .03 .03"/>  
 99       geometry>  
100       <material name="white">  
101           <color rgba="1 1 1 1"/>  
102       material>  
103     visual>  
104   link>  
105  
106   <joint name="tobox" type="fixed">  
107     <parent link="base_link"/>  
108     <child link="head"/>  
109     <origin xyz="0 0.08 0.025"/>  
110   joint>  
111 robot>

四、建立launch命令文件

 在smartcar_description文件夹下建立launch文件夹,创建智能车的描述文件 base.urdf.rviz.launch(输入:touch base.urdf.rviz.launch创建),对其最后一行进行更改(更改内容:(find urdf_tutorial)/urdf.vcg 改为 (find urdf_tutorial)/urdf.rviz)描述代码如下:

 

 1 <launch>     
 2     <arg name="model" />      
 3     <arg name="gui" default="False" />     
 4     <param name="robot_description" textfile="$(find smartcar_description)/urdf/smartcar.urdf" />      
 5     <param name="use_gui" value="$(arg gui)"/>     
 6     <node name="joint_state_publisher" pkg="joint_state_publisher" type="joint_state_publisher" >
 7     node>      
 8     <node name="robot_state_publisher" pkg="robot_state_publisher" type="state_publisher" />      
 9     <node name="rviz" pkg="rviz" type="rviz" args="-d $(find urdf_tutorial)/urdf.rviz" />  
10 launch>

 

五、效果演示

        在终端中输入显示命令:
roslaunch smartcar_description base.urdf.rviz.launch gui:=true

 

 

posted on 2017-05-03 18:14 林先森_007 阅读( ...) 评论( ...) 编辑 收藏

转载于:https://www.cnblogs.com/LQLin168/p/6803251.html

你可能感兴趣的:(Robot Operating System (ROS)学习笔记---创建简单的机器人模型smartcar)