Closed slim71 closed 1 year ago
I've found an "alternate" solution, or the real one maybe.
I've seen something like this stuff about environment variables. The relevant part is
Gazebo will find your model as long as its parent path is listed on the environment variable GAZEBO_MODEL_PATH
Since I'm using Ignition Fortress, the right variables is IGN_GAZEBO_RESOURCE_PATH
(it can be found by executing ign help gazebo
or similar, depending on the Gazebo/Ignition version).
So in the end I've used environment hooks, found in this GitHub issue.
In the package pelican
I added a folder env-hooks
with a file pelican.dsv.in
, in which I've put
prepend-non-duplicate;IGN_GAZEBO_RESOURCE_PATH;share/@PROJECT_NAME@/models
prepend-non-duplicate;IGN_GAZEBO_RESOURCE_PATH;share/@PROJECT_NAME@/worlds
prepend-non-duplicate;IGN_GAZEBO_RESOURCE_PATH;share/@PROJECT_NAME@/description
Then I made sure to hook it up adding
ament_environment_hooks("${CMAKE_CURRENT_SOURCE_DIR}/env-hooks/${PROJECT_NAME}.dsv.in")
I'll just have to be sure to re-use this structure for any other package and with the appropriate folder structure.
For reference, everything is also explained in the issue above, which points at this and this as examples. I bit of explanation on environment hooks is here, with more in depth explanations in the ColCon docs.
The drone models I've found are using multiple
<uri>
tags (like<uri>model://X3/meshes/led.dae</uri>
) to load meshes and other stuff from the same folder in which the mainmodel.sdf
is located.I can start Ignition with no problem, loading the desired world with the
spawn_world.launch.py
file from packagereach
. I then usex3_spawn.launch.py
from packagepelican
to load the model, which is indeed found and loaded into Ignition but without meshes, as the terminal issues multiple lines likeand so on.
It's not working.
I've seen multiple posts (like this one) from which I gathered that I need
inside the
<export>
tag in thepackage.xml
file (where also adding<exec_depend>gazebo_ros</exec_depend>
is needed) and to install the directory in the package's share folder, using something likein the
CMakeLists.txt
file.More investigation is needed.