4台の車のガゼボシミュレーション

ステップ

ワークスペースアップ1セット

mkdir -p ~/smartcar/src
cd ~/smartcar/src
catkin_init_workspace
cd ~/smartcar/
catkin_make
source devel/setup.bash

注:コンパイルが問題の原因を解決することであった後:

gedit ~/.bashrc  

ファイルの追加の最後に:ソース〜/ smartcar / develの/ setup.bash

ROSトロリーバッグの記述を作成します。2.

cd ~/smartcar/src
roscreate-pkg smartcar_description urdf

書き込み3.urdfファイル

1. smartcar_descriptionフォルダの下にフォルダを作成します。urdf、およびurdfフォルダが作成されsmart.urdfファイルを

cd ~/smartcar/src/smartcar_description/
mkdir urdf
cd ~/smartcar/src/smartcar_description/urdf/
touch smartcar.urdf

記述ファイルsmartcar.urdf 2.以下のコードを書きます:

<?xml version="1.0"?> 
<robot name="smartcar">
    <link name="base_link">      <!-- 连杆名为base_link-->
        <visual>		<!--visual设置连杆的可视化信息-->
            <geometry>		<!--geometry输入模型的形状-->
                <box size="0.25 .16 .05"/>  <!--"box"类型,长宽高分别为0.25,0.16,0.05-->
            </geometry>

            <origin rpy="0 0 1.57075" xyz="0 0 0"/>    <!--origin设置相对于连杆相对坐标系的移动和旋转-->

            <material name="blue">     			<!--material设置连杆的颜色和纹理-->
                <color rgba="0 .5 .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">    <!--设置关节信息 type="continuous"表示旋转关节,可以绕单轴无线旋转-->
        <axis xyz="0 0 1"/>  					<!--axis设置旋转轴-->
        <parent link="base_link"/>  				<!--parent关节的父连杆-->
        <child link="right_front_wheel"/>  			<!--child关节的子连杆-->
        <origin rpy="0 1.57075 0" xyz="0.08 0.1 -0.03"/>  	<!--origin将父连杆坐标系转换为子连杆坐标系-->
        <limit effort="100" velocity="100"/>  			<!--limit 设置关节的速度、力和半径(仅当关节是revolute或prismatic时)-->
        <joint_properties damping="0.0" friction="0.0"/>  	<!--joint_properties设置一些属性 阻尼系数 摩擦系数-->
    </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"/>  <!--将子link(right_front_wheel)连接到父link(base_link)上-->
        <origin xyz="0 0.08 0.025"/>  
    </joint>  
</robot>

注:1
... urdf構成ファイルは2つの部分を有する:属性情報は...情報の形状、色、質量は、ホイールの慣性を言語で記述されたモデルのハードウェア構成を説明する工程; 2として理解されるべき...青いボックスに示されるように間の相互接続は、それが2つの固定された接続情報と位置...等が記載されています。
2.車輪と車体接続は、ブリッジの確立によるものです。
正式行く3. smarter.launchコード書い中国のノートを持っていない、または内容を読み取ることができませんが

書類の作成を起動4

/ smartcar_descriptionフォルダの下に打ち上げフォルダを確立し、スマート車の起動ファイルdisplay.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.rviz" />
</launch>

5. rvizモデル表示

display.launchファイルを実行します

roslaunch smartcar_description display.launch

6.rvizは、いくつかのパラメータを設定します

1. [追加]を表示し、
表示内容の表示の左下隅に追加し、[追加]をクリックします。
Bを選択RobotModel、および表示を追加し、[OK]をクリックします。
2. [変更固定フレームオプションパラメータ
以下のように変更base_link固定フレームは、ディスプレイに垂直です。

公開された23元の記事 ウォン称賛17 ビュー4178

おすすめ

転載: blog.csdn.net/qq_43786066/article/details/104330150