I am following a tutorial to build a custom robot in Ros. I followed in detail this tutorial: https://www.youtube.com/watch?v=uvPFDQxfm2w&t=70s I am trying to make my robot called "mrm" spawn in gazebo. When I launch this spawn.launch file:
<?xml version="1.0" ?>
<launch>
<param name="robot_description" command="$(find xacro)/xacro --inorder '$(find mrm_description)/urdf/mrm.xacro'"/>
<arg name="x" default="0"/>
<arg name="y" default="0"/>
<arg name="z" default="0.5"/>
<node name="mybot_spawn" pkg="gazebo_ros" type="spawn_model" output="screen"
args="-param robot_description -urdf -model mrm -x $(arg x) -y $(arg y) -z $(arg z)"/>
</launch>
No error messages are appearing but everything is stuck: the robot doesn't appear and Gazebo is not open. I can only see this message in the terminal:
SUMMARY
========
PARAMETERS
* /robot_description: <?xml version="1....
* /rosdistro: noetic
* /rosversion: 1.15.15
NODES
/
mybot_spawn (gazebo_ros/spawn_model)
auto-starting new master
process[master]: started with pid [35299]
ROS_MASTER_URI=http://localhost:11311
setting /run_id to e34362f0-8a2f-11ed-a9b7-ef7c5e0a5b08
process[rosout-1]: started with pid [35309]
started core service [/rosout]
process[mybot_spawn-2]: started with pid [35312]
[INFO] [1672617380.741138]: Loading model XML from ros parameter robot_description
[INFO] [1672617380.745654]: Waiting for service /gazebo/spawn_urdf_model
It appears it is searching for the model of the robot as reported by: https://answers.ros.org/question/383910/generic-question-about-the-error-waiting-for-service-gazebospawn_urdf_model/
I found an old similar question: Error: gazebo_ros_control plugin is waiting for model URDF in parameter But I do not think it fits my case.
I tried to create a new simplified model and launched it in a different workspace where I am already working with Franka model in gazebo but when I launch my custom robot the same issue appears.
If someone has some hints about how to solve this problem I would be very grateful.
Lorenzo
The message you get is indeed not an error message but it indicates infinite waiting. Ros is waiting for a service that is not available/hanging.
Note that the launch file you have provided does not open gazebo, it only creates a node that spawns something using an existing (running!) gazebo service. So you need to have a gazebo world open beforehand.
You want to source your ros distro in a separate terminal window and run gazebo from there, like so:
Then in another terminal window you source your workspace and run your launch file from there:
This should spawn your robot in the opened gazebo window.
The part where to run your launch file you need to source your own workspace is so that you "make ros aware" of the packages you have created. The fact you need to source your ros distro itself to run gazebo is because gazebo_ros is a ros package that is installed with your ros distro.
P.S. The
catkin clean
andbuild
commands are optional, I would just run them to make sure the build is reset to the latest version of all your packages.