Spawn_model for gazebo.urdf files
Hi,
I want to edit the file turtlebot3_world.launch that's code is the following in Melodic:
<launch>
<arg name="model" default="$(env TURTLEBOT3_MODEL)" doc="model type [burger, waffle, waffle_pi]"/>
<arg name="x_pos" default="-1.0"/>
<arg name="y_pos" default="-6"/>
<arg name="z_pos" default="0.0"/>
<include file="$(find gazebo_ros)/launch/empty_world.launch">
<arg name="world_name" value="$(find multibot3)/worlds/turtlebot3_world.world"/>
<arg name="paused" value="false"/>
<arg name="use_sim_time" value="true"/>
<arg name="gui" value="true"/>
<arg name="headless" value="false"/>
<arg name="debug" value="false"/>
</include>
<param name="robot_description" command="$(find xacro)/xacro --inorder $(find turtlebot3_description)/urdf/turtlebot3_$(arg model).urdf.xacro" />
<node pkg="gazebo_ros" type="spawn_model" name="spawn_urdf" args="-urdf -model turtlebot3_$(arg model) -x $(arg x_pos) -y $(arg y_pos) -z $(arg z_pos) -param robot_description" />
</launch>
My question is this: My understanding of this suggests to me that I need two files, a .urdf.xacro for the visual part and a .gazebo.xacro for the various sensors and plugin. I want to modify this file to charge my definitions and not only that corresponding to turtlebot3, so based on my understanding (wrong I guess) I did this:
<launch>
<arg name="model" default="$(env TURTLEBOT3_MODEL)" doc="model type [burger, waffle, waffle_pi]"/>
<arg name="x_pos" default="-2.0"/>
<arg name="y_pos" default="-0.5"/>
<arg name="z_pos" default="0.0"/>
<include file="$(find gazebo_ros)/launch/empty_world.launch">
<arg name="world_name" value="$(find turtlebot3_gazebo)/worlds/turtlebot3_world.world"/>
<arg name="paused" value="false"/>
<arg name="use_sim_time" value="true"/>
<arg name="gui" value="true"/>
<arg name="headless" value="false"/>
<arg name="debug" value="false"/>
</include>
<param name="robot_description" command="$(find xacro)/xacro --inorder $(find turtlebot3_description)/urdf/turtlebot3_$(arg model).urdf.xacro" />
<node pkg="gazebo_ros" type="spawn_model" name="spawn_urdf" args="-file /home/xyz/ros_ws/src/turtlebot3/turtlebot3_description/urdf/turtlebot3_$(arg model).gazebo.xacro -x $(arg x_pos) -y $(arg y_pos) -z $(arg z_pos) -param robot_description" />
</launch>
But then I get this error:
spawn_model: error: argument -param: not allowed with argument -file
[spawn_urdf-4] process has died [pid 3277, exit code 2, cmd /opt/ros/melodic/lib/gazebo_ros/spawn_model -file /home/xyz/ros_ws/src/turtlebot3/turtlebot3_description/urdf/turtlebot3_waffle_pi.gazebo.xacro -x -2.0 -y -0.5 -z 0.0 -param robot_description __name:=spawn_urdf __log:=/home/xyz/.ros/log/e5538a02-69f2-11eb-82a4-40b89aaac2f7/spawn_urdf-4.log].
log file: /home/xyz/.ros/log/e5538a02-69f2-11eb-82a4-40b89aaac2f7/spawn_urdf-4*.log