ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

Gazebo plugin for ROS2 doesn't get loaded

asked 2021-04-04 13:38:55 -0500

balazs-bamer gravatar image

Hi All,

Thanks to a helpful volunteer I managed to fire up Gazebo from ROS2. However, the gazebo-plugin (on the branch gazebo-plugin) apparently does not load, although I have a set of different logging statements and even a file creation one to create a file in /tmp. I find this message totally misleading:

[spawn_entity.py-2] [INFO] [1617560451.452969406] [spawn_entity]: Spawn status: SpawnEntity: Successfully spawned entity [gazebo_arm_model_plugin]

The file in /tmp does not appear after running the command below:

What do I do wrong?

Thank you in advance. Best regards: Balázs Bámer

balazs@sohivatal:~/munka/cuda-trajectory-planner/ros-workspace$ ros2 launch src/link-intersection-brute-force/launch/gazebo.launch.py 
[INFO] [launch]: All log files can be found below /home/balazs/.ros/log/2021-04-04-20-20-46-684235-sohivatal-25224
[INFO] [launch]: Default logging verbosity is set to INFO
{'GAZEBO_MODEL_PATH': '/home/balazs/munka/cuda-trajectory-planner/ros-workspace/install/link-intersection-brute-force/share/link-intersection-brute-force', 'GAZEBO_PLUGIN_PATH': '', 'GAZEBO_RESOURCE_PATH': ''}
[INFO] [gazebo-1]: process started with pid [25226]
[INFO] [spawn_entity.py-2]: process started with pid [25228]
[spawn_entity.py-2] [INFO] [1617560448.238524946] [spawn_entity]: Spawn Entity started
[spawn_entity.py-2] [INFO] [1617560448.239773694] [spawn_entity]: Loading entity XML from file /home/balazs/munka/cuda-trajectory-planner/ros-workspace/install/link-intersection-brute-force/share/link-intersection-brute-force/px150_coll.sdf
[spawn_entity.py-2] [INFO] [1617560448.248038657] [spawn_entity]: Waiting for service /spawn_entity, timeout = 5
[spawn_entity.py-2] [INFO] [1617560448.250261885] [spawn_entity]: Waiting for service /spawn_entity
[gazebo-1] Gazebo multi-robot simulator, version 11.3.0
[gazebo-1] Copyright (C) 2012 Open Source Robotics Foundation.
[gazebo-1] Released under the Apache 2 License.
[gazebo-1] http://gazebosim.org
[gazebo-1] 
[gazebo-1] Gazebo multi-robot simulator, version 11.3.0
[gazebo-1] Copyright (C) 2012 Open Source Robotics Foundation.
[gazebo-1] Released under the Apache 2 License.
[gazebo-1] http://gazebosim.org
[gazebo-1] 
[gazebo-1] [Msg] Waiting for master.
[gazebo-1] [Msg] Connected to gazebo master @ http://127.0.0.1:11345
[gazebo-1] [Msg] Publicized address: 192.168.0.153
[gazebo-1] [Wrn] [ModelDatabase.cc:340] Getting models from[/]. This may take a few seconds.
[gazebo-1] [Wrn] [ModelDatabase.cc:212] Unable to connect to model database using [//database.config]. Only locally installed models will be available.
[gazebo-1] [Wrn] [SystemPaths.cc:459] File or path does not exist [""] [model://sun]
[gazebo-1] [Wrn] [ModelDatabase.cc:340] Getting models from[/]. This may take a few seconds.
[gazebo-1] [Wrn] [ModelDatabase.cc:212] Unable to connect to model database using [//database.config]. Only locally installed models will be available.
[gazebo-1] [Wrn] [SystemPaths.cc:459] File or path does not exist [""] [model://ground_plane]
[gazebo-1] Error Code 12 Msg: Unable to find uri[model://sun]
[gazebo-1] Error Code 12 Msg: Unable to find uri[model://ground_plane]
[spawn_entity.py-2] [INFO] [1617560451.028068043] [spawn_entity]: Calling service /spawn_entity
[gazebo-1] [Msg] Waiting for master.
[gazebo-1] [Msg] Connected to gazebo master @ http://127.0.0.1:11345
[gazebo-1] [Msg] Publicized address: 192.168.0.153
[gazebo-1] [Err] [InsertModelWidget.cc:402] Missing model.config for model "/home/balazs/munka/cuda-trajectory-planner/ros-workspace/install/link-intersection-brute-force/share/link-intersection-brute-force/cmake"
[gazebo-1] [Err] [InsertModelWidget.cc:402] Missing model.config for model "/home/balazs/munka/cuda-trajectory-planner/ros-workspace/install/link-intersection-brute-force/share/link-intersection-brute-force/environment"
[gazebo-1] [Err] [InsertModelWidget.cc:402] Missing model.config for model "/home/balazs/munka/cuda-trajectory-planner/ros-workspace/install/link-intersection-brute-force/share/link-intersection-brute-force/hook ...
(more)
edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
1

answered 2021-04-05 11:57:47 -0500

shonigmann gravatar image

I see a things you can fix right off the bat.

1st, your Gazebo model path seems to only include your custom folder:

{'GAZEBO_MODEL_PATH': '/home/balazs/munka/cuda-trajectory-planner/ros-workspace/install/link-intersection-brute-force/share/link-intersection-brute-force', 'GAZEBO_PLUGIN_PATH': '', 'GAZEBO_RESOURCE_PATH': ''}

You should always append to the Gazebo model path, not overwrite it. In theory, your model path should also include /home/balazs/.gazebo/models. This is where it will find the models that are giving you warnings (sun, ground plane), without having to try to download them every time you launch your simulation.

Depending on how you are setting it, it would be something like this, to preserve gazebo's default path: export GAZEBO_MODEL_PATH=[MY_PACKAGE_PATH]/models:$GAZEBO_MODEL_PATH

You have many [gazebo-1] [Err] [InsertModelWidget.cc:402] Missing model.config for model errors. I would recommend making a 'models' folder within your package and moving your model.config and urdf inside it. Gazebo expects all folders in the model path to contain a model.config.e.g.

link-intersection-brute-force
|-- models
|--|-- link-intersection-brute-force
|--|--|-- model.config
|--|--|-- urdf
|--|--|-- meshes

I am a bit confused by your question, however. Your URDF file does not have a plugin... Could you clarify what is not working as expected? Is your robot not being loaded into Gazebo? Or is it being spawned, but a specific model plugin you've attached is not working as expected?

edit flag offensive delete link more

Comments

Thank you for pointing out errors in the paths and folder structure. I will fix them in the evening. About what not works:

The model appears in Gazebo, does some swings as it hangs without torques. This is fine.

The library compiuled from gazebo-plugin.cpp does not actually run, although Gazebo logs say it has been spawned. I know it does not run because I creaste a file in /tmp in the Load method and it doesn't get created.

balazs-bamer gravatar image balazs-bamer  ( 2021-04-06 02:29:43 -0500 )edit

Thanks for the clarification.

So where do you expect the plugin you created to get started? You haven't included a <plugin> tag in your sdf, so Gazebo won't start it for you.

And the only mention I can see of your plugin in your launch file is in the --entity tag on your spawn_model node. If you look at the details of [spawn_model.py](https://github.com/ros-simulation/gazebo_ros_pkgs/blob/foxy/gazebo_ros/scripts/spawn_entity.py) you will see that the entity tag only sets the name of the model in Gazebo. It has nothing to do with a plugin you want to add.

Gazebo is telling you that the model is spawned correctly, because, from your description, it has done everything you asked it to. I would suggest looking at the tutorial here for details on adding your plugin to your model.

Also, I assume you are using ...(more)

shonigmann gravatar image shonigmann  ( 2021-04-06 11:18:39 -0500 )edit

I experimented a while with these things could not get anything close to my previous solution. About plugin launch: after reading your last comment, I could hack it together. Not a standard solution, but after wasting several days on getting this stuff work, no more time on it. Thank you very much!

balazs-bamer gravatar image balazs-bamer  ( 2021-04-06 13:19:39 -0500 )edit

Question Tools

2 followers

Stats

Asked: 2021-04-04 13:38:55 -0500

Seen: 3,795 times

Last updated: Apr 05 '21