Common

Classes and functions used by multiple modules. More...

Files

file  CommonTypes.hh
 

Namespaces

 gazebo::common
 Common namespace.
 

Classes

class  Animation
 Manages an animation, which is a collection of keyframes and the ability to interpolate between the keyframes. More...
 
class  AssertionInternalError
 Class for generating Exceptions which come from gazebo assertions. More...
 
class  AudioDecoder
 An audio decoder based on FFMPEG. More...
 
class  Battery
 A battery abstraction. More...
 
class  BVHLoader
 Handles loading BVH animation files. More...
 
class  ColladaExporter
 Class used to export Collada mesh files. More...
 
class  ColladaLoader
 Class used to load Collada mesh files. More...
 
class  Color
 Defines a color. More...
 
class  Console
 Container for loggers, and global logging options (such as verbose vs. More...
 
class  DEM
 Encapsulates a DEM (Digital Elevation Model) file. More...
 
class  Dem
 
class  Exception
 Class for generating exceptions. More...
 
class  FileLogger
 A logger that outputs messages to a file. More...
 
class  GTSMeshUtils
 Creates GTS utilities for meshes. More...
 
class  HeightmapData
 Encapsulates a generic heightmap data file. More...
 
class  Image
 Encapsulates an image. More...
 
class  ImageHeightmap
 Encapsulates an image that will be interpreted as a heightmap. More...
 
class  InternalError
 Class for generating Internal Gazebo Errors: those errors which should never happend and represent programming bugs. More...
 
class  KeyEvent
 Generic description of a keyboard event. More...
 
class  KeyFrame
 A key frame in an animation. More...
 
class  Logger
 Terminal logger. More...
 
class  Material
 Encapsulates description of a material. More...
 
class  Mesh
 A 3D mesh. More...
 
class  MeshCSG
 Creates CSG meshes. More...
 
class  MeshExporter
 Base class for exporting meshes. More...
 
class  MeshLoader
 Base class for loading meshes. More...
 
class  MeshManager
 Maintains and manages all meshes. More...
 
class  ModelDatabase
 Connects to model database, and has utility functions to find models. More...
 
class  ModelPlugin
 A plugin with access to physics::Model. More...
 
class  MouseEvent
 Generic description of a mouse event. More...
 
class  MovingWindowFilter< T >
 Base class for MovingWindowFilter. More...
 
class  NodeAnimation
 Node animation. More...
 
class  NodeAssignment
 Vertex to node weighted assignement for skeleton animation visualization. More...
 
class  NodeTransform
 NodeTransform Skeleton.hh common/common.hh More...
 
class  NumericAnimation
 A numeric animation. More...
 
class  NumericKeyFrame
 A keyframe for a NumericAnimation. More...
 
class  PID
 Generic PID controller class. More...
 
class  PluginT< T >
 A class which all plugins must inherit from. More...
 
class  PoseAnimation
 A pose animation. More...
 
class  PoseKeyFrame
 A keyframe for a PoseAnimation. More...
 
class  SemanticVersion
 Version comparison class based on Semantic Versioning 2.0.0 http://semver.org/ Compares versions and converts versions from string. More...
 
class  SensorPlugin
 A plugin with access to physics::Sensor. More...
 
class  SingletonT< T >
 Singleton template class. More...
 
class  Skeleton
 A skeleton. More...
 
class  SkeletonAnimation
 Skeleton animation. More...
 
class  SkeletonNode
 A skeleton node. More...
 
class  SphericalCoordinates
 Convert spherical coordinates for planetary surfaces. More...
 
class  STLLoader
 Class used to load STL mesh files. More...
 
class  SubMesh
 A child mesh. More...
 
class  SystemPaths
 Functions to handle getting system paths, keeps track of: More...
 
class  SystemPlugin
 A plugin loaded within the gzserver on startup. More...
 
class  Time
 A Time class, can be used to hold wall- or sim-time. More...
 
class  Timer
 A timer class, used to time things in real world walltime. More...
 
class  Video
 Handle video encoding and decoding using libavcodec. More...
 
class  VisualPlugin
 A plugin loaded within the gzserver on startup. More...
 
class  WorldPlugin
 A plugin with access to physics::World. More...
 

Macros

#define gzdbg   (gazebo::common::Console::dbg(__FILE__, __LINE__))
 Output a debug message. More...
 
#define gzerr   (gazebo::common::Console::err(__FILE__, __LINE__))
 Output an error message. More...
 
#define gzlog   (gazebo::common::Console::log())
 Output a message to a log file. More...
 
#define gzLogDirectory()   (gazebo::common::Console::log.GetLogDirectory())
 Get the full path of the directory where the log files are stored. More...
 
#define gzLogInit(_prefix, _str)   (gazebo::common::Console::log.Init(_prefix, _str))
 Initialize log file with filename given by _str. More...
 
#define gzmsg   (gazebo::common::Console::msg())
 Output a message. More...
 
#define gzthrow(msg)
 This macro logs an error to the throw stream and throws an exception that contains the file name and line number. More...
 
#define gzwarn   (gazebo::common::Console::warn(__FILE__, __LINE__))
 Output a warning message. More...
 

Enumerations

enum  PluginType {
  WORLD_PLUGIN, MODEL_PLUGIN, SENSOR_PLUGIN, SYSTEM_PLUGIN,
  VISUAL_PLUGIN, GUI_PLUGIN
}
 Used to specify the type of plugin. More...
 

Functions

 MovingWindowFilter ()
 Constructor. More...
 
 SemanticVersion ()
 Default constructor. More...
 
 SemanticVersion (const std::string &_v)
 Constructor. More...
 
 SemanticVersion (const SemanticVersion &_copy)
 Copy constructor. More...
 
 SemanticVersion (const unsigned int _major, const unsigned int _minor=0, const unsigned int _patch=0, const std::string &_prerelease="", const std::string &_build="")
 Constructor. More...
 
virtual ~MovingWindowFilter ()
 Destructor. More...
 
 ~SemanticVersion ()
 Destructor. More...
 
void add_search_path_suffix (const std::string &_suffix)
 add path sufix to common::SystemPaths More...
 
std::string Build () const
 Get the build metadata string. More...
 
static bool DelaunayTriangulation (const std::vector< ignition::math::Vector2d > &_vertices, const std::vector< ignition::math::Vector2i > &_edges, SubMesh *_submesh)
 Perform delaunay triangulation on input vertices. More...
 
void DownloadDependencies (const std::string &_path)
 Download all dependencies for a give model path. More...
 
std::string find_file (const std::string &_file)
 search for file in common::SystemPaths More...
 
std::string find_file (const std::string &_file, bool _searchLocalPath)
 search for file in common::SystemPaths More...
 
std::string find_file_path (const std::string &_file)
 search for a file in common::SystemPaths More...
 
void Fini ()
 Finalize the model database. More...
 
Get ()
 Get filtered result. More...
 
template<typename T >
std::string get_sha1 (const T &_buffer)
 Compute the SHA1 hash of an array of bytes. More...
 
std::string GetDBConfig (const std::string &_uri)
 Return the database.config file as a string. More...
 
const char * getEnv (const char *_name)
 Cross platform retrieval of an environment variable. More...
 
std::string GetModelConfig (const std::string &_uri)
 Return the model.config file as a string. More...
 
std::string GetModelFile (const std::string &_uri)
 Get a model's SDF file based on a URI. More...
 
std::string GetModelName (const std::string &_uri)
 Get the name of a model based on a URI. More...
 
std::string GetModelPath (const std::string &_uri, bool _forceDownload=false)
 Get the local path to a model. More...
 
std::map< std::string,
std::string > 
GetModels ()
 Returns the dictionary of all the model names. More...
 
event::ConnectionPtr GetModels (boost::function< void(const std::map< std::string, std::string > &)> _func)
 Get the dictionary of all model names via a callback. More...
 
std::string GetURI ()
 Returns the the global model database URI. More...
 
bool GetWindowFilled () const
 Get whether the window has been filled. More...
 
unsigned int GetWindowSize () const
 Get the window size. More...
 
bool HasModel (const std::string &_modelName)
 Returns true if the model exists on the database. More...
 
void load ()
 Load the common library. More...
 
unsigned int Major () const
 Get the major number. More...
 
unsigned int Minor () const
 Get the minor number. More...
 
bool operator!= (const SemanticVersion &_other) const
 Inequality comparison operator. More...
 
bool operator< (const SemanticVersion &_other) const
 Less than comparison operator. More...
 
bool operator<= (const SemanticVersion &_other) const
 Less than or equal comparison operator. More...
 
SemanticVersion & operator= (const SemanticVersion &_other)
 Assignment operator. More...
 
bool operator== (const SemanticVersion &_other) const
 Equality comparison operator. More...
 
bool operator> (const SemanticVersion &_other) const
 Greater than comparison operator. More...
 
bool operator>= (const SemanticVersion &_other) const
 Greater than or equal comparison operator. More...
 
bool Parse (const std::string &_versionStr)
 Parse a version string and set the major, minor, patch numbers, and prerelease and build strings. More...
 
unsigned int Patch () const
 Get the patch number. More...
 
std::string Prerelease () const
 Get the prerelease string. More...
 
void SetWindowSize (unsigned int _n)
 Set window size. More...
 
std::vector< std::string > split (const std::string &_str, const std::string &_delim)
 Splits a string into tokens. More...
 
void Start (bool _fetchImmediately=false)
 Start the model database. More...
 
void Update (T _val)
 Update value of filter. More...
 
std::string Version () const
 Returns the version as a string. More...
 

Variables

static std::string PixelFormatNames []
 String names for the pixel formats. More...
 

Friends

std::ostream & operator<< (std::ostream &_out, const SemanticVersion &_v)
 Stream insertion operator. More...
 

Detailed Description

Classes and functions used by multiple modules.

Macro Definition Documentation

#define gzdbg   (gazebo::common::Console::dbg(__FILE__, __LINE__))

Output a debug message.

Output a message to a log file.

#define gzLogDirectory ( )    (gazebo::common::Console::log.GetLogDirectory())

Get the full path of the directory where the log files are stored.

Returns
Full path of the directory
#define gzLogInit (   _prefix,
  _str 
)    (gazebo::common::Console::log.Init(_prefix, _str))

Initialize log file with filename given by _str.

If called twice, it will close currently in use and open a new log file.

Parameters
[in]_prefixPrefix added to the directory where the log file will be created.
[in]_strName of log file for gzlog messages.

Output a message.

#define gzthrow (   msg)
Value:
{std::ostringstream throwStream;\
throwStream << msg << std::endl << std::flush;\
throw gazebo::common::Exception(__FILE__, __LINE__, throwStream.str()); }
Class for generating exceptions.
Definition: Exception.hh:45

This macro logs an error to the throw stream and throws an exception that contains the file name and line number.

Referenced by TopicManager::Advertise(), CallbackHelperT< M >::GetMsgType(), and SubscribeOptions::Init().

Enumeration Type Documentation

enum PluginType

Used to specify the type of plugin.

Enumerator
WORLD_PLUGIN 

A World plugin.

MODEL_PLUGIN 

A Model plugin.

SENSOR_PLUGIN 

A Sensor plugin.

SYSTEM_PLUGIN 

A System plugin.

VISUAL_PLUGIN 

A Visual plugin.

GUI_PLUGIN 

A GUI plugin.

Function Documentation

MovingWindowFilter ( )

Constructor.

SemanticVersion ( )

Default constructor.

Use the Parse function to populate an instance with version information.

SemanticVersion ( const std::string &  _v)

Constructor.

Parameters
[in]_vthe string version. ex: "0.3.2"
SemanticVersion ( const SemanticVersion _copy)

Copy constructor.

Parameters
[in]_copythe other version
SemanticVersion ( const unsigned int  _major,
const unsigned int  _minor = 0,
const unsigned int  _patch = 0,
const std::string &  _prerelease = "",
const std::string &  _build = "" 
)

Constructor.

Parameters
[in]_majorThe major number
[in]_minorThe minor number
[in]_patchThe patch number
[in]_prereleaseThe prerelease string
[in]_buildThe build metadata string
~MovingWindowFilter ( )
virtual

Destructor.

References NULL.

~SemanticVersion ( )

Destructor.

void gazebo::common::add_search_path_suffix ( const std::string &  _suffix)

add path sufix to common::SystemPaths

Parameters
[in]_suffixThe suffix to add.
std::string Build ( ) const

Get the build metadata string.

Build meta data is not used when determining precedence.

Returns
Build metadata string, empty if a build metadata string was not specified.
static bool DelaunayTriangulation ( const std::vector< ignition::math::Vector2d > &  _vertices,
const std::vector< ignition::math::Vector2i > &  _edges,
SubMesh _submesh 
)
static

Perform delaunay triangulation on input vertices.

Parameters
[in]_verticesA list of all vertices
[in]_edgesA list of edges. Each edge is made of 2 vertex indices from _vertices
[out]_submeshA submesh that will be populated with the resulting triangles.
Returns
True on success.
void DownloadDependencies ( const std::string &  _path)

Download all dependencies for a give model path.

Look's in the model's manifest file (_path/model.config) for all models listed in the <depend> block, and downloads the models if necessary.

Parameters
[in]_pathPath to a model.
std::string gazebo::common::find_file ( const std::string &  _file)

search for file in common::SystemPaths

Parameters
[in]_fileName of the file to find.
Returns
The path containing the file.
std::string gazebo::common::find_file ( const std::string &  _file,
bool  _searchLocalPath 
)

search for file in common::SystemPaths

Parameters
[in]_fileName of the file to find.
[in]_searchLocalPathTrue to search in the current working directory.
Returns
The path containing the file.
std::string gazebo::common::find_file_path ( const std::string &  _file)

search for a file in common::SystemPaths

Parameters
[in]_filethe file name to look for.
Returns
The path containing the file.
void Fini ( )

Finalize the model database.

T Get ( )

Get filtered result.

Returns
latest filtered value
std::string get_sha1 ( const T &  _buffer)

Compute the SHA1 hash of an array of bytes.

Parameters
[in]_bufferInput sequence. The permitted data types for this function are std::string and any STL container.
Returns
The string representation (40 character) of the SHA1 hash.

References NULL.

std::string GetDBConfig ( const std::string &  _uri)

Return the database.config file as a string.

Returns
The database config file from the model database.
const char* gazebo::common::getEnv ( const char *  _name)

Cross platform retrieval of an environment variable.

Parameters
[in]_nameName of the environment variable to get.
Returns
Environment variable contents, or NULL on error.
std::string GetModelConfig ( const std::string &  _uri)

Return the model.config file as a string.

Returns
The model config file from the model database.
std::string GetModelFile ( const std::string &  _uri)

Get a model's SDF file based on a URI.

Get a model file based on a URI. If the model is on a remote server, then the model fetched and installed locally.

Parameters
[in]_uriThe URI of the model
Returns
The full path and filename to the SDF file
std::string GetModelName ( const std::string &  _uri)

Get the name of a model based on a URI.

The URI must be fully qualified: http://gazebosim.org/gazebo_models/ground_plane or model://gazebo_models

Parameters
[in]_urithe model uri
Returns
the model's name.
std::string GetModelPath ( const std::string &  _uri,
bool  _forceDownload = false 
)

Get the local path to a model.

Get the path to a model based on a URI. If the model is on a remote server, then the model fetched and installed locally.

Parameters
[in]_urithe model uri
[in]_forceDownloadTrue to skip searching local paths.
Returns
path to a model directory
std::map<std::string, std::string> GetModels ( )

Returns the dictionary of all the model names.

This is a blocking call. Which means it will wait for the ModelDatabase to download the model list.

Returns
a map of model names, indexed by their full URI.
event::ConnectionPtr GetModels ( boost::function< void(const std::map< std::string, std::string > &)>  _func)

Get the dictionary of all model names via a callback.

This is the non-blocking version of ModelDatabase::GetModels

Parameters
[in]_funcCallback function that receives the list of models.
Returns
A boost shared pointer. This pointer must remain valid in order to receive the callback.
std::string GetURI ( )

Returns the the global model database URI.

Returns
the URI.
bool GetWindowFilled ( ) const

Get whether the window has been filled.

Returns
True if the window has been filled.
unsigned int GetWindowSize ( ) const

Get the window size.

Returns
The size of the moving window.
bool HasModel ( const std::string &  _modelName)

Returns true if the model exists on the database.

Parameters
[in]_modelNameURI of the model (eg: model://my_model_name).
Returns
True if the model was found.
void gazebo::common::load ( )

Load the common library.

unsigned int Major ( ) const

Get the major number.

Returns
The major number
unsigned int Minor ( ) const

Get the minor number.

Returns
The minor number
bool operator!= ( const SemanticVersion _other) const

Inequality comparison operator.

Parameters
[in]_otherThe other version to compare to
Returns
True if _other version is different
bool operator< ( const SemanticVersion _other) const

Less than comparison operator.

Parameters
[in]_otherThe other version to compare to
Returns
True if _other version is newer
bool operator<= ( const SemanticVersion _other) const

Less than or equal comparison operator.

Parameters
[in]_otherThe other version to compare to
Returns
True if _other version is older or equal
SemanticVersion& operator= ( const SemanticVersion _other)

Assignment operator.

Parameters
[in]_otherThe version to assign from.
Returns
The reference to this instance
bool operator== ( const SemanticVersion _other) const

Equality comparison operator.

Parameters
[in]_otherThe other version to compare to
Returns
True if _other version is the same
bool operator> ( const SemanticVersion _other) const

Greater than comparison operator.

Parameters
[in]_otherThe other version to compare to
Returns
True if _other version is older
bool operator>= ( const SemanticVersion _other) const

Greater than or equal comparison operator.

Parameters
[in]_otherThe other version to compare to
Returns
True if _other version is newer or the same
bool Parse ( const std::string &  _versionStr)

Parse a version string and set the major, minor, patch numbers, and prerelease and build strings.

Parameters
[in]_versionStrThe version string, such as "1.2.3-pr+123" True on success.
unsigned int Patch ( ) const

Get the patch number.

Returns
The patch number
std::string Prerelease ( ) const

Get the prerelease string.

Returns
Prelrease string, empty if a prerelease string was not specified.
void SetWindowSize ( unsigned int  _n)

Set window size.

Parameters
[in]_nnew desired window size
std::vector<std::string> gazebo::common::split ( const std::string &  _str,
const std::string &  _delim 
)

Splits a string into tokens.

Parameters
[in]_strInput string.
[in]_delimToken delimiter.
Returns
Vector of tokens.
void Start ( bool  _fetchImmediately = false)

Start the model database.

Parameters
[in]_fetchImmediatelyTrue to fetch the models without waiting.
void Update ( _val)

Update value of filter.

Parameters
[in]_valnew raw value
std::string Version ( ) const

Returns the version as a string.

Returns
The semantic version string

Variable Documentation

std::string PixelFormatNames[]
static
Initial value:
=
{
"UNKNOWN_PIXEL_FORMAT",
"L_INT8",
"L_INT16",
"RGB_INT8",
"RGBA_INT8",
"BGRA_INT8",
"RGB_INT16",
"RGB_INT32",
"BGR_INT8",
"BGR_INT16",
"BGR_INT32",
"R_FLOAT16",
"RGB_FLOAT16",
"R_FLOAT32",
"RGB_FLOAT32",
"BAYER_RGGB8",
"BAYER_RGGR8",
"BAYER_GBRG8",
"BAYER_GRBG8"
}

String names for the pixel formats.

See Also
Image::PixelFormat.

Friends

std::ostream& operator<< ( std::ostream &  _out,
const SemanticVersion _v 
)
friend

Stream insertion operator.

Parameters
_outoutput stream
_vSemantic version to output
Returns
the stream