Skip to content

robot_description: export gazebo paths to package#37

Merged
CotsaftisGarnierMatthieu merged 4 commits intomasterfrom
feat/gportay/robot_description-export-gazebo-paths-to-package
Mar 28, 2025
Merged

robot_description: export gazebo paths to package#37
CotsaftisGarnierMatthieu merged 4 commits intomasterfrom
feat/gportay/robot_description-export-gazebo-paths-to-package

Conversation

@gportay
Copy link
Copy Markdown
Collaborator

@gportay gportay commented Mar 28, 2025

This exports the gazebo_model_path and gazebo_media_path (i.e. resource)
to automatically make the workspace resources and models to ROS Gazebo.
See 13.

Note: It that removes the needs to manually append these directories via
the environment variables GAZEBO_RESOURCE_PATH and GAZEBO_MODEL_PATH.
The python module gazebo_ros_paths.py4 extracts the paths from the
list of package.xml; the two python launch scripts gzserver.launch.py
and gzclient.launch.py uses that module to concatenate these path to the
environment variables5. The third launch script gazebo.launch.py
launches the Gazebo server and client script.

gportay added 4 commits March 28, 2025 09:38
The ROS workspace setup file does not source the ROS system setup file.

This adds the sourcing for the ROS system setup file.

Note: This seems to be unnecessary as the environment is the same if
sourcing the workspace setup files only, and if sourcing both setup
files (i.e. system and workspace).

[1]: https://docs.ros.org/en/humble/Tutorials/Beginner-CLI-Tools/Configuring-ROS2-Environment.html#source-the-setup-files
The ROS workspace setup file does not source the ROS Gazebo system setup
file.

This adds the sourcing for the ROS Gazebo system setup file. It drops
the workaround that sets the gazebo-11 system's directory. The sourcing
for the ROS Gazebo system setup file was the missing bits.

Note: This exports the following additional Gazebo variable to the
environment:
 - GAZEBO_MASTER_URI=http://localhost:11345
 - GAZEBO_PLUGIN_PATH=/usr/share/gazebo/../../lib/x86_64-linux-gnu/gazebo-11/plugins:
 - GAZEBO_MODEL_DATABASE_URI=http://models.gazebosim.org
 - GAZEBO_RESOURCE_PATH=/usr/share/gazebo/../../share/gazebo-11:
 - GAZEBO_MODEL_PATH=/usr/share/gazebo/../../share/gazebo-11/models:
 - OGRE_RESOURCE_PATH=/usr/lib/x86_64-linux-gnu/OGRE-1.9.0

Also, the LD_LIBRARY_PATH lists the extra Gazebo plugin directory
/opt/ros/humble/lib:/usr/lib/x86_64-linux-gnu/gazebo-11/plugins:
 -LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu/gazebo-11/plugins:/opt/ros/humble/opt/rviz_ogre_vendor/lib:/opt/ros/humble/lib/x86_64-linux-gnu:/opt/ros/humble/lib
 +LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu/gazebo-11/plugins:/opt/ros/humble/opt/rviz_ogre_vendor/lib:/opt/ros/humble/lib/x86_64-linux-gnu:/opt/ros/humble/lib:/usr/share/gazebo/../../lib/x86_64-linux-gnu/gazebo-11/plugins:

[1]: https://classic.gazebosim.org/tutorials?tut=ros2_installing#Introduction
This appends the robot_control's models directory to the environ
GAZEBO_MODEL_PATH, using the action AppendEnvironmentVariable.

Note: It sets the gazebo-11 system's directories too, to workaround some
missing bits.

Note: This is unnecessary as the robot_controls's resource directory is
appended to the environment GAZEBO_RESOURCE_PATH already. That resource
directory contains the models directory and extra resources that are
necessary to ROS Gazebo.
This exports the gazebo_model_path and gazebo_media_path (i.e. resource)
to automatically make the workspace resources and models to ROS Gazebo.
See [1][2][3].

Note: It that removes the needs to manually append these directories via
the environment variables GAZEBO_RESOURCE_PATH and GAZEBO_MODEL_PATH.
The python module gazebo_ros_paths.py[4] extracts the paths from the
list of package.xml; the two python launch scripts gzserver.launch.py
and gzclient.launch.py uses that module to concatenate these path to the
environment variables[5][6]. The third launch script gazebo.launch.py
launches the Gazebo server and client script.

[1]: https://docs.ros.org/en/humble/Tutorials/Intermediate/URDF/Using-a-URDF-in-Gazebo.html#side-note-configuring-meshes
[2]: https://classic.gazebosim.org/tutorials?tut=ros_roslaunch
[3]: https://wiki.ros.org/simulator_gazebo/GazeboConfiguration
[4]: https://github.com/ros-simulation/gazebo_ros_pkgs/blob/3.7.0/gazebo_ros/scripts/gazebo_ros_paths.py#L53-L65
[5]: https://github.com/ros-simulation/gazebo_ros_pkgs/blob/3.7.0/gazebo_ros/launch/gzserver.launch.py#L65-L78
[6]: https://github.com/ros-simulation/gazebo_ros_pkgs/blob/3.7.0/gazebo_ros/launch/gzclient.launch.py#L40-L53
[7]: https://github.com/ros-simulation/gazebo_ros_pkgs/blob/3.7.0/gazebo_ros/launch/gazebo.launch.py#L35-L43
@gportay gportay force-pushed the feat/gportay/robot_description-export-gazebo-paths-to-package branch from cf3ad0c to b7cba55 Compare March 28, 2025 08:48
@CotsaftisGarnierMatthieu CotsaftisGarnierMatthieu merged commit c133127 into master Mar 28, 2025
0 of 2 checks passed
@CotsaftisGarnierMatthieu CotsaftisGarnierMatthieu deleted the feat/gportay/robot_description-export-gazebo-paths-to-package branch March 28, 2025 08:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants