Robotics StackExchange | Archived questions

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

Hi!

I am trying to use gazeboros2control 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 gazeboros2control:

<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 "gazebomodelpath", "gazeboresourcepath", 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!

Asked by swu on 2022-08-12 14:58:20 UTC

Comments

Answers