实验6:轨迹跟踪仿真1

文件内容

spawn_car.launch

<?xml version="1.0" encoding="UTF-8"?>
<launch>

    <include file="$(find car_model)/launch/spawn_xacro.launch">#引入文件

        <arg name="x" value="0.0"></arg>#为文件中的元素赋值
        <arg name="y" value="0.0"></arg>
        <arg name="z" value="0.0"></arg>
        <arg name="urdf_robot_file" value="$(find car_model)/urdf/smart.xacro"></arg> #定义小车模型位置
        <arg name="robot_name" value="smart"></arg> #定义小车模型名称

    </include>

</launch>

spawn_xacro.launch

<?xml version="1.0" encoding="UTF-8"?>

<launch>
    
    <arg name="x" default="0.0"></arg>#设置元素默认值
    <arg name="y" default="0.0"></arg>
    <arg name="z" default="0.0"></arg>

    <arg name="urdf_robot_file" default=""></arg>
    <arg name="robot_name" default=""></arg>

    <!-- <param name="robot_description" command="$(arg urdf_robot_file)"/> -->
    <param name="robot_description" command="$(find xacro)/xacro '$(arg urdf_robot_file)' roboname:='smart'" />#获取机器人模型
	%% 创建节点 %%
    <node name="spawn_model" pkg="gazebo_ros" type="spawn_model" respawn="false" output="screen" args="-urdf -x $(arg x) -y $(arg y) -z $(arg z) -model $(arg robot_name) -param robot_description"></node>

</launch>

具体实验

插入模型

美化小车

image.png

控制小车

image.png

右轮偏转0.5弧度

image.png

控制小车速度和转向

image.png

查看小车定位

image.png

查看小车速度

image.png

This line appears after every note.

Notes mentioning this note


Here are all the notes in this garden, along with their links, visualized as a graph.