<launch>
	<arg name="model" default="$(env TURTLEBOT3_MODEL)" doc="model type [burger, waffle, waffle_pi]"/>
  <param name="/use_sim_time" value="true" />

	<arg name="gazebo_gui" default="false"/>
	<arg name="x_pos" default="0.0"/>
	<arg name="y_pos" default="0.0"/>
	<arg name="z_pos" default="0.0"/>

  <arg name="urdf_file" default="$(find xacro)/xacro --inorder '$(find turtlebot3_description)/urdf/turtlebot3_$(arg model).urdf.xacro'" />

  <param name="robot_description" command="$(arg urdf_file)"/>

  <node pkg="tf" type="static_transform_publisher" name="base_imu_to_base_link"
      args="0 0.0 0 0 0.0 0.0 /base_link /imu_link 40" />

  <include file="$(find gazebo_ros)/launch/empty_world.launch">
    <arg name="world_name" value="$(find turtlebot3_gazebo)/worlds/empty.world"/>
    <arg name="paused" value="false"/>
    <arg name="use_sim_time" value="true"/>
    <arg name="gui" value="$(arg gazebo_gui)"/>
    <arg name="headless" value="false"/>
    <arg name="debug" value="false"/>
  </include>

  <node pkg="gazebo_ros" type="spawn_model" name="spawn_urdf" args="-urdf -model turtlebot_$(arg model) -x $(arg x_pos) -y $(arg y_pos) -z $(arg z_pos) -param robot_description" />

  <node name="joint_state_publisher" pkg="joint_state_publisher" type="joint_state_publisher"  output="screen">
    	<param name="rate" value="20.0"/>
  </node>

  <node name="robot_state_publisher" pkg="robot_state_publisher" type="robot_state_publisher">
      <param name="publish_frequency" type="double" value="20.0" />
  </node>
</launch>