• Diff for "asr_ros_uri/UsageTutorial"
Differences between revisions 4 and 5
Revision 4 as of 2017-05-23 11:49:57
Size: 1372
Comment:
Revision 5 as of 2017-05-23 11:51:04
Size: 1374
Comment:
Deletions are marked like this. Additions are marked like this.
Line 34: Line 34:
Call '''std::string file_uri(fs::path path) '''to simply add the file-prefix ("file://") to the given path. Call '''std::string file_uri(fs::path path) '''to simply add the file-prefix (''file://'') to the given path.

(!) Please ask about problems and questions regarding this tutorial on answers.ros.org. Don't forget to include in your question the link to this page, the versions of your OS & ROS, and also add appropriate tags.

Usage of asr_ros_uri

Description: This tutorial explains the available functions of the asr_ros_uri-package

Tutorial Level: BEGINNER

Setup

Simply add asr_ros_uri as a dependency and you can use the functions of this package.

Tutorial

Getting the absolute path of a URI

Call std::string absolute_path(std::string uriString) to get the absolute path of the given uri (either with a file or a package prefix: file:// of package://).

Example:

std::string path = ros_uri::absolute_path("package://<package_name>/<path_in_package>");

Getting the package-URI from a file path

Call std::string package_uri(std::string pathStr, std::string packageName = std::string()) to get the package-URI for the given file. Optionally you can provide the name of the package the file is located in.

Example:

std::string uri = package_uri("/path/to/file");

Prefixing a path with the file-protocol prefix

Call std::string file_uri(fs::path path) to simply add the file-prefix (file://) to the given path.

Wiki: asr_ros_uri/UsageTutorial (last edited 2017-06-06 11:53:28 by TobiasAllgeyer)