Home | Tutorials | Wiki | Issues
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Hi,

thank you very much, your suggestion works. You can include an element in the SDF, like

<elementToInclude>elem://relative_path_to_file</elementToInclude>

then in the plugin load the path (relative to the Gazebo Resource Path)

const char* gazeboResourcePaths = getenv("GAZEBO_RESOURCE_PATH");
std::string gazeboResourcePathString(gazeboResourcePaths);
sdf::addURIPath("elem://", gazeboResourcePathString);
const std::string absolute_path = sdf::findFile(_sdf->Get<std::string>("elementToInclude"), true, false);

The absolute path then is given in the string absolute_path

Best regards!

Hi,

thank you very much, your suggestion works. You can include an element in the SDF, like

<elementToInclude>elem://relative_path_to_file</elementToInclude>

then in the plugin load the path (relative to the Gazebo Resource Path)

const char* gazeboResourcePaths = getenv("GAZEBO_RESOURCE_PATH");
std::string gazeboResourcePathString(gazeboResourcePaths);
sdf::addURIPath("elem://", gazeboResourcePathString);
const std::string absolute_path = sdf::findFile(_sdf->Get<std::string>("elementToInclude"), true, false);

The absolute path then is given in the string absolute_path.

Best regards!