How to dynamically specify the path to a yaml file inside a SDF file?

asked 2022-08-12 14:58:20 -0500

swu gravatar image

Hi!

I am trying to use gazebo_ros2_control in my simulation. In order to use it, one requirement is that I need to specify the path to a yaml file containing my parameters for gazebo_ros2_control:

<plugin name='gazebo_ros2_control' filename='libgazebo_ros2_control.so'>
  <parameters>absolute-path-to-yaml-file-here</parameters>
</plugin>

In xacro/URDF files, I can use a substitution command, such as:

<parameters>$(find gazebo_ros2_control_demos)/config/cartpole_controller.yaml</parameters>

However, this does not exist for SDF files (and my simulation needs to use SDF instead of URDF). Is there still a way to specify the location of the yaml file without hardcoding its entire path or is this impossible? I was trying to get this to work by setting environment variables pointing to my yaml file, such as "gazebo_model_path", "gazebo_resource_path", etc... (similar to how you would specify paths to model files) but this doesn't seem to work. Any help would be appreciated!

Thank you!

edit retag flag offensive close merge delete