rosservice call /gazebo/spawn_urdf_model error. How to use this service correctly?
Hi I am new to ROS. I need to spawn a model in gazebo by calling spawn_urdf_model service in a terminal. When I call it I got this error.
$ rosservice call /gazebo/spawn_urdf_model "model_name: 'e_pmm1'
model_xml: '/home/rosi/pro_ws/src/jnj/urdf/pmm1.urdf'
robot_namespace: ''
initial_pose:
position: {x: 1.0, y: 0.0, z: 0.0}
orientation: {x: 0.0, y: 0.0, z: 0.0, w: 1.0}
reference_frame: 'world'"
ERROR: service [/gazebo/spawn_urdf_model] responded with an error:
In the terminal where I launch gazebo world I got this error
[ERROR] [1590224787.297184677, 22524.557000000]: SpawnModel: Failure - entity format is invalid.
Is it because of the model_xml? How can I make it right?
Here is my urdf file
<?xml version="1.0" encoding="UTF-8" ?>
<robot name="e_pmm1" xmlns:xacro="http://ros.org/wiki/xacro">
< link name ="pmm1_link">
<collision>
<origin xyz="0 0 0.015" rpy="0 0 0"/>
<geometry>
<mesh filename="package://jnj/urdf/meshes/pmm1.dae"/>
</geometry>
</collision>
<visual>
<origin xyz="0 0 0.015" rpy="0 0 0"/>
<geometry>
<mesh filename="package://jnj/urdf/meshes/pmm1.dae"/>
</geometry>
</visual>
<inertial>
<origin xyz="0 0 0" />
<mass value="0.088" />
<inertia ixx="1.966873333E-4" ixy="0.0" ixz="0.0" iyy="6.858206667E-4" iyz="0.0" izz="5.0233333333E-4" />
</inertial>
</link>
<gazebo reference="pmm1_link">
<gravity>1</gravity>
<kp>1000000.0</kp>
<kd>1000000.0</kd>
<mu1>0.1</mu1>
<mu2>0.1</mu2>
</gazebo>
</robot>
Any help would be appreciated.