Liquid-ai / Plankton

Open source simulator for maritime robotics researchers
Apache License 2.0
127 stars 43 forks source link

Service %s/spawn_entity unavailable. Was Gazebo started with GazeboRosFactory? #59

Open HYD-PG opened 1 year ago

HYD-PG commented 1 year ago

Hi,thank you very much for your contribution. But when I compile, I have the following problem with the terminal. Anyone experiencing the same issue? If you have the same problem, please help me, greatly appreciated.

: Waiting for entity xml on robot_description [spawn_entity.py-1] [INFO] [1671761703.354007793] [rexrov.urdf_spawner]: Waiting for service /gazebo/spawn_entity, timeout = 30 [spawn_entity.py-1] [INFO] [1671761703.354242044] [rexrov.urdf_spawner]: Waiting for service /gazebo/spawn_entity [spawn_entity.py-1] [ERROR] [1671761733.394673836] [rexrov.urdf_spawner]: Service %s/spawn_entity unavailable. Was Gazebo started with GazeboRosFactory? [spawn_entity.py-1] [ERROR] [1671761733.395134307] [rexrov.urdf_spawner]: Spawn service failed. Exiting. [ERROR] [spawn_entity.py-1]: process has died [pid 89139, exit code 1, cmd '/opt/ros/humble/lib/gazebo_ros/spawn_entity.py -gazebo_namespace /gazebo -x 0 -y 0 -z -20 -R 0.0 -P 0.0 -Y 0.0 -entity rexrov -topic robot_description --ros-args -r __node:=urdf_spawner -r __ns:=/rexrov --params-file /tmp/launch_params_8oj6kd7r'].

bioniwulf commented 1 year ago

@yudonghou123 Dear friend, I have the same problem on Ubuntu 22.04 + ROS2 Humble. I found that you have resolved it (link). My Chinese not so good, I tried to autotranslate your last comment and only could understand that problem is somehow connected with namespacing. Could you, please, help me with this problem?

bioniwulf commented 1 year ago

So, to whom it may concern. I think I've found the problem.

OS: Ubuntu 22.04 ROS version: Humble

For some reason Gazebo is creating the spawn entity on the /spawn_entity service, but the vehicle model is trying to connect to the /gazebo/spawn_entity service. So as a quick patch, I just remapped the topic for the urdf_spawner node in the vehicle description launch file as follows:

urdf_spawner = Node(
        name = 'urdf_spawner',
        package='gazebo_ros',
        executable='spawn_entity.py',
        output='screen',
        parameters=[{'use_sim_time': res}],
        arguments=args,
        remappings=[
            ('/gazebo/spawn_entity', '/spawn_entity')
        ]
    )

Now Plankton works correctly (after many minor changes in Plankton code).