Util.hh
Go to the documentation of this file.
std::string removeParentScope(const std::string &_name, const std::string &_delim)
Helper function to remove a parent scope from a given name. This removes the first name found before ...
std::string asFullPath(const std::string &_uri, const std::string &_filePath)
Combine a URI and a file path into a full path. If the URI is already a full path or contains a schem...
bool enableComponent(EntityComponentManager &_ecm, Entity _entity, bool _enable=true)
Helper function to "enable" a component (i.e. create it if it doesn't exist) or "disable" a component...
Definition: Util.hh:241
const ComponentTypeT * Component(const Entity _entity) const
Get a component assigned to an entity based on a component type.
std::string topicFromScopedName(const Entity &_entity, const EntityComponentManager &_ecm, bool _excludeWorld=true)
Helper function that returns a valid Ignition Transport topic consisting of the scoped name for the p...
std::vector< std::string > resourcePaths()
Get resource paths based on latest environment variables.
std::string resolveSdfWorldFile(const std::string &_sdfFilename, const std::string &_fuelResourceCache="")
Convert an SDF world filename string, such as "shapes.sdf", to full system file path. The provided SDF filename may be a Fuel URI, relative path, name of an installed Gazebo world filename, or an absolute path.
const std::string kRenderPluginPathEnv
Environment variable holding paths to custom rendering engine plugins.
Definition: Util.hh:281
std::unordered_set< Entity > entitiesFromScopedName(const std::string &_scopedName, const EntityComponentManager &_ecm, Entity _relativeTo=kNullEntity, const std::string &_delim="::")
Helper function to get an entity given its scoped name. The scope may start at any level by default...
ComponentTypeId entityTypeId(const Entity &_entity, const EntityComponentManager &_ecm)
Generally, each entity will be of some specific high-level type, such as World, Sensor, Collision, etc, and one type only. The entity type is usually marked by having some component that represents that type, such as components::Visual.
const std::string kServerConfigPathEnv
Environment variable holding server config paths.
Definition: Util.hh:277
ComponentTypeT * CreateComponent(const Entity _entity, const ComponentTypeT &_data)
Create a component of a particular type. This will copy the _data parameter.
STL class.
std::string entityTypeStr(const Entity &_entity, const EntityComponentManager &_ecm)
Generally, each entity will be of some specific high-level type, such as "world", "sensor"...
The EntityComponentManager constructs, deletes, and returns components and entities. A component can be of any class which inherits from components::BaseComponent.
Definition: EntityComponentManager.hh:66
Pose3< double > Pose3d
std::string scopedName(const Entity &_entity, const EntityComponentManager &_ecm, const std::string &_delim="/", bool _includePrefix=true)
Helper function to generate scoped name for an entity.
math::Pose3d worldPose(const Entity &_entity, const EntityComponentManager &_ecm)
Helper function to compute world pose of an entity.
uint64_t ComponentTypeId
A unique identifier for a component type. A component type must be derived from components::BaseCompo...
Definition: include/ignition/gazebo/Types.hh:90
bool RemoveComponent(const Entity _entity, const ComponentKey &_key)
Remove a component from an entity based on a key.
const Entity kNullEntity
Indicates a non-existant or invalid Entity.
Definition: Entity.hh:62
STL class.
std::optional< math::Vector3d > sphericalCoordinates(Entity _entity, const EntityComponentManager &_ecm)
Get the spherical coordinates for an entity.
Entity worldEntity(const Entity &_entity, const EntityComponentManager &_ecm)
Get the world to which the given entity belongs.
std::string validTopic(const std::vector< std::string > &_topics)
Helper function to generate a valid transport topic, given a list of topics ordered by preference...
bool exists(const std::string &_path)
Entity topLevelModel(const Entity &_entity, const EntityComponentManager &_ecm)
Get the top level model of an entity.
const std::string kResourcePathEnv
Environment variable holding resource paths.
Definition: Util.hh:270
const std::string kSdfPathEnv
Environment variable used by SDFormat to find URIs inside <include>
Definition: Util.hh:274
This library is part of the Ignition Robotics project.
uint64_t Entity
An Entity identifies a single object in simulation such as a model, link, or light. At its core, an Entity is just an identifier.
Definition: Entity.hh:59
void addResourcePaths(const std::vector< std::string > &_paths={})
Add resource paths based on latest environment variables. This will update the SDF and Ignition envir...