赞
踩
这个文件启动了Gazebo仿真环境,配置MAVROS功能包和PX4 SITL功能包。
<?xml version="1.0"?> <launch> <!-- MAVROS posix SITL environment launch script --> <!-- launches Gazebo environment and 2x: MAVROS, PX4 SITL, and spawns vehicle --> <!-- vehicle model and world --> <arg name="est" default="ekf2"/> <arg name="world" default="$(find mavlink_sitl_gazebo)/worlds/indoor1.world"/> <!-- gazebo configs --> <arg name="gui" default="true"/> <arg name="debug" default="false"/> <arg name="verbose" default="false"/> <arg name="paused" default="false"/> <!-- Gazebo sim --> <include file="$(find gazebo_ros)/launch/empty_world.launch"> <arg name="gui" value="$(arg gui)"/> <arg name="world_name" value="$(arg world)"/> <arg name="debug" value="$(arg debug)"/> <arg name="verbose" value="$(arg verbose)"/> <arg name="paused" value="$(arg paused)"/> </include> <!-- iris_0 --> <group ns="iris_0"> <!-- MAVROS and vehicle configs --> <arg name="ID" value="0"/> <arg name="ID_in_group" value="0"/> <arg name="fcu_url" default="udp://:24540@localhost:34580"/> <!-- PX4 SITL and vehicle spawn --> <include file="$(find px4)/launch/single_vehicle_spawn_xtd.launch"> <arg name="x" value="0"/> <arg name="y" default="7.5"/> <arg name="z" default="1"/> <arg name="R" value="0"/> <arg name="P" value="0"/> <arg name="Y" value="0"/> <arg name="vehicle" value="iris"/> <arg name="sdf" value="iris_stereo_camera"/> <arg name="mavlink_udp_port" value="18570"/> <arg name="mavlink_tcp_port" value="4560"/> <arg name="ID" value="$(arg ID)"/> <arg name="ID_in_group" value="$(arg ID_in_group)"/> </include> <!-- MAVROS --> <include file="$(find mavros)/launch/px4.launch"> <arg name="fcu_url" value="$(arg fcu_url)"/> <arg name="gcs_url" value=""/> <arg name="tgt_system" value="$(eval 1 + arg('ID'))"/> <arg name="tgt_component" value="1"/> </include> </group> </launch> <!--the launch file is generated by XTDrone multi-vehicle generator.py -->
程序中添加了注释,不要复制运行此处代码。
<!-- vehicle model and world --> <arg name="est" default="ekf2"/> <arg name="world" default="$(find mavlink_sitl_gazebo)/worlds/indoor1.world"/>可在此处修改仿真环境地图 <!-- gazebo configs --> <arg name="gui" default="true"/>定义变量 <arg name="debug" default="false"/> <arg name="verbose" default="false"/> <arg name="paused" default="false"/> <!-- Gazebo sim --> <include file="$(find gazebo_ros)/launch/empty_world.launch">嵌套的另一个launch文件,打开为一个空地图仿真环境 <arg name="gui" value="$(arg gui)"/>这里是对configs已经定义的变量进行调用 <arg name="world_name" value="$(arg world)"/> <arg name="debug" value="$(arg debug)"/> <arg name="verbose" value="$(arg verbose)"/> <arg name="paused" value="$(arg paused)"/> </include>
<!-- iris_0 --> <group ns="iris_0"> <!-- MAVROS and vehicle configs --> <arg name="ID" value="0"/> <arg name="ID_in_group" value="0"/> <arg name="fcu_url" default="udp://:24540@localhost:34580"/> <!-- PX4 SITL and vehicle spawn --> <include file="$(find px4)/launch/single_vehicle_spawn_xtd.launch">嵌入的launch文件启动 PX4 SITL <arg name="x" value="0"/> <arg name="y" default="7.5"/> <arg name="z" default="1"/> <arg name="R" value="0"/>roll <arg name="P" value="0"/>pitch <arg name="Y" value="0"/>yaw <arg name="vehicle" value="iris"/> <arg name="sdf" value="iris_stereo_camera"/>无人机模型在此修改 <arg name="mavlink_udp_port" value="18570"/> <arg name="mavlink_tcp_port" value="4560"/> <arg name="ID" value="$(arg ID)"/> <arg name="ID_in_group" value="$(arg ID_in_group)"/> </include>
<!-- MAVROS -->基本不需要修改
<include file="$(find mavros)/launch/px4.launch">
<arg name="fcu_url" value="$(arg fcu_url)"/>
<arg name="gcs_url" value=""/>
<arg name="tgt_system" value="$(eval 1 + arg('ID'))"/>
<arg name="tgt_component" value="1"/>
</include>
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。