Gazebo Fuel_tools

API Reference

7.3.1
ignition::fuel_tools Namespace Reference

Classes

class  ClientConfig
 High level interface to ignition fuel. More...
 
class  CollectionIdentifier
 Defines how to identify a collection. More...
 
class  FuelClient
 High level interface to ignition fuel. More...
 
class  JSONParser
 A helper class for making REST requests. More...
 
class  LocalCache
 Class for managing stuff in the local cache. 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  HttpMethod {
  GET, POST, DELETE, PUT,
  PATCH, POST_FORM, PATCH_FORM
}
 the types of HTTP methods More...
 
enum  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 ~/.ignition/fuel. More...
 
std::string fetchResourceWithClient (const std::string &_uri, FuelClient &_client)
 Download the specified resource using the ClientConfig contained in the FuelClient parameter. More...
 
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: More...
 
std::string uriToPath (const 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. More...
 

Enumeration Type Documentation

◆ HttpMethod

enum 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 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 ignition::fuel_tools::fetchResource ( const std::string _uri)

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

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

◆ fetchResourceWithClient()

std::string ignition::fuel_tools::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.

◆ sdfFromPath()

std::string ignition::fuel_tools::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 ignition::fuel_tools::uriToPath ( const 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