Gazebo Fuel_tools

API Reference

10.0.0~pre2
gz::fuel_tools Namespace Reference

Classes

class  ClientConfig
 High level interface to Gazebo Fuel. More...
 
class  CollectionIdentifier
 Defines how to identify a collection. More...
 
class  FuelClient
 High level interface to Gazebo Fuel. More...
 
class  JSONParser
 A helper class for making REST requests. More...
 
class  Model
 Defines how to identify a model. More...
 
class  ModelIdentifier
 Defines how to identify a model. More...
 
class  ModelIter
 class for iterating through models More...
 
class  Rest
 A helper class for making REST requests. More...
 
struct  RestResponse
 Stores a response to a RESTful request. More...
 
class  Result
 Class describing a result of an operation. More...
 
class  ServerConfig
 Describes options needed for a server. More...
 
class  WorldIdentifier
 Defines how to identify a world. More...
 
class  WorldIter
 class for iterating through worlds More...
 
class  Zip
 A helper class for making REST requests. More...
 

Enumerations

enum class  HttpMethod {
  GET , POST , DELETE , PUT ,
  PATCH , POST_FORM , PATCH_FORM
}
 the types of HTTP methods More...
 
enum class  ResultType {
  UNKNOWN = 0 , DELETE , DELETE_NOT_FOUND , DELETE_ERROR ,
  FETCH , FETCH_ALREADY_EXISTS , FETCH_NOT_FOUND , FETCH_ERROR ,
  UPLOAD , UPLOAD_ALREADY_EXISTS , UPLOAD_ERROR , PATCH_ERROR ,
  PATCH
}
 Result type. More...
 

Functions

std::string fetchResource (const std::string &_uri)
 Download the specified resource into the default configuration of fuel tools. This will place the asset in ~/.gz/fuel.
 
std::string fetchResourceWithClient (const std::string &_uri, FuelClient &_client)
 Download the specified resource using the ClientConfig contained in the FuelClient parameter.
 
std::string sanitizeAuthority (const std::string &_uriAuthority)
 Convert the authority portion of a URI to a string suitable to be used as a path on disk for all platforms.
 
std::string sdfFromPath (const std::string &_path)
 Get the SDF file path for a model or world based on a directory containing a Fuel model or world. Here is a typical use case:
 
std::string uriToPath (const gz::common::URI &_uri)
 Convert a URI to a string suitable to use as a path on disk. It strips the scheme and authority's // prefix.
 

Enumeration Type Documentation

◆ HttpMethod

enum class HttpMethod
strong

the types of HTTP methods

Enumerator
GET 

Get method.

POST 

Post method.

DELETE 

Delete method.

PUT 

Put method.

PATCH 

Patch method.

POST_FORM 

Post form method.

PATCH_FORM 

Patch form method.

◆ ResultType

enum class ResultType
strong

Result type.

Enumerator
UNKNOWN 

Uninitialized type.

DELETE 

Delete successful.

DELETE_NOT_FOUND 

Model not found.

DELETE_ERROR 

Delete failed. Other errors.

See also
ReadableResult
FETCH 

Fetch successful.

FETCH_ALREADY_EXISTS 

Model already exists.

FETCH_NOT_FOUND 

Model not found.

FETCH_ERROR 

Fetch failed. Other errors.

See also
ReadableResult
UPLOAD 

Upload successful.

UPLOAD_ALREADY_EXISTS 

Model already exists.

UPLOAD_ERROR 

Upload failed. Other errors.

See also
ReadableResult
PATCH_ERROR 

Patch failed.

PATCH 

Patch successful.

Function Documentation

◆ fetchResource()

std::string fetchResource ( const std::string _uri)

Download the specified resource into the default configuration of fuel tools. This will place the asset in ~/.gz/fuel.

Parameters
[in]_uriURI to the asset.
Returns
Path to the downloaded asset. Empty on error.

◆ fetchResourceWithClient()

std::string fetchResourceWithClient ( const std::string _uri,
FuelClient _client 
)

Download the specified resource using the ClientConfig contained in the FuelClient parameter.

Parameters
[in]_uriURI to the asset.
[in]_clientCustom FuelClient configuration.
Returns
Path to the downloaded asset. Empty on error.

◆ sanitizeAuthority()

std::string sanitizeAuthority ( const std::string _uriAuthority)

Convert the authority portion of a URI to a string suitable to be used as a path on disk for all platforms.

It encodes illegal characters on Windows and Linux filesystems with their corresponding URL-encoded values.

This assumes an authority of the form: username@host:port "@" is encoded as %40 ":" is encoded as %3A

Parameters
[in]_uriAuthoritythe authority section of the URI to convert.
Returns
String suitable to use in file paths

◆ sdfFromPath()

std::string sdfFromPath ( const std::string _path)

Get the SDF file path for a model or world based on a directory containing a Fuel model or world. Here is a typical use case:

  1. Fetch a Fuel resource: std::string resourcePath = fetchResource("https://...")
  2. Get the SDF file for the resource: std::string resourceSdf = sdfFromPath(resourcePath)
  3. Parse the SDF file using libsdformat.

This function will determine the SDF file according to the following:

  1. Check for a metadata.pbtxt file, and return the SDF file specified within the metadata.pbtxt file.
  2. Check for a model.config file, and return the SDF file specified withing the model.config file.
  3. Return the first file with an .sdf extension.
    Parameters
    [in]_pathFilesystem path to a Fuel model or world directory.
    Returns
    Full path to the model or world SDF file, or empty string if the SDF file coult not be determined.

◆ uriToPath()

std::string uriToPath ( const gz::common::URI _uri)

Convert a URI to a string suitable to use as a path on disk. It strips the scheme and authority's // prefix.

Parameters
[in]_uriURI to convert.
Returns
String suitable to use in file paths