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

Best way to add package's models path to GAZEBO_MODEL_PATH in ROS2?

asked 2021-06-14 16:12:40 -0500

shonigmann gravatar image

updated 2021-06-15 02:35:06 -0500

gvdhoorn gravatar image

In ROS1, you could add your package's models path to the GAZEBO_MODEL_PATH in package.xml (e.g. as shown here).

It doesn't seem like the same functionality (provided by gazebo_ros_paths_plugin.cpp) exists in ROS2. So is there a preferred alternative?

I know you can set environment variables using launch substitutions, but this would have to be done for each launch file.

Is there a way to set the environment variable at the package level (or at the workspace level, e.g. when sourcing your setup.bash)? Or would that be bad form?

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
1

answered 2021-06-15 14:45:04 -0500

updated 2021-06-16 00:09:46 -0500

gvdhoorn gravatar image

I see it in the ros2 branch: https://github.com/ros-simulation/gaz... and I do believe it is working.

edit flag offensive delete link more

Comments

One day I'll learn to look at the full directory, and to not just check if one particular file still exists... Thanks though - exactly what I was looking for.

shonigmann gravatar image shonigmann  ( 2021-06-15 15:19:31 -0500 )edit
2

answered 2021-06-16 02:16:38 -0500

Joe28965 gravatar image

Just to add, another (and in my opinion cleaner) way to do it is using environment hooks. This will set it directly in Gazebo (when you source the workspace), without the dependency on gazebo_ros.

edit flag offensive delete link more

Question Tools

4 followers

Stats

Asked: 2021-06-14 16:12:40 -0500

Seen: 2,476 times

Last updated: Jun 16 '21