Ignition Gazebo

API Reference

3.5.0
Util.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2019 Open Source Robotics Foundation
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16 */
17 #ifndef IGNITION_GAZEBO_UTIL_HH_
18 #define IGNITION_GAZEBO_UTIL_HH_
19 
20 #include <string>
21 #include <vector>
22 
23 #include <ignition/math/Pose3.hh>
24 #include "ignition/gazebo/config.hh"
27 #include "ignition/gazebo/Export.hh"
28 #include "ignition/gazebo/Types.hh"
29 
30 namespace ignition
31 {
32  namespace gazebo
33  {
34  // Inline bracket to help doxygen filtering.
35  inline namespace IGNITION_GAZEBO_VERSION_NAMESPACE {
36  //
41  math::Pose3d IGNITION_GAZEBO_VISIBLE worldPose(const Entity &_entity,
42  const EntityComponentManager &_ecm);
43 
50  std::string IGNITION_GAZEBO_VISIBLE scopedName(const Entity &_entity,
51  const EntityComponentManager &_ecm, const std::string &_delim = "/",
52  bool _includePrefix = true);
53 
74  ComponentTypeId IGNITION_GAZEBO_VISIBLE entityTypeId(const Entity &_entity,
75  const EntityComponentManager &_ecm);
76 
94  std::string IGNITION_GAZEBO_VISIBLE entityTypeStr(const Entity &_entity,
95  const EntityComponentManager &_ecm);
96 
101  Entity IGNITION_GAZEBO_VISIBLE worldEntity(const Entity &_entity,
102  const EntityComponentManager &_ecm);
103 
109  std::string IGNITION_GAZEBO_VISIBLE removeParentScope(
110  const std::string &_name, const std::string &_delim);
111 
120  std::string IGNITION_GAZEBO_VISIBLE asFullPath(const std::string &_uri,
121  const std::string &_filePath);
122 
125  std::vector<std::string> IGNITION_GAZEBO_VISIBLE resourcePaths();
126 
131  void IGNITION_GAZEBO_VISIBLE addResourcePaths(
132  const std::vector<std::string> &_paths = {});
133 
138  ignition::gazebo::Entity IGNITION_GAZEBO_VISIBLE topLevelModel(
139  const Entity &_entity,
140  const EntityComponentManager &_ecm);
141 
143  const std::string kResourcePathEnv{"IGN_GAZEBO_RESOURCE_PATH"};
144 
147  const std::string kSdfPathEnv{"SDF_PATH"};
148 
151  const std::string kRenderPluginPathEnv{"IGN_GAZEBO_RENDER_ENGINE_PATH"};
152  }
153  }
154 }
155 #endif
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...
std::vector< std::string > resourcePaths()
Get resource paths based on latest environment variables.
const std::string kRenderPluginPathEnv
Environment variable holding paths to custom rendering engine plugins.
Definition: Util.hh:151
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.
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"...
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: Types.hh:87
STL class.
Entity worldEntity(const Entity &_entity, const EntityComponentManager &_ecm)
Get the world to which the given entity belongs.
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:143
const std::string kSdfPathEnv
Environment variable used by SDFormat to find URIs inside <include>
Definition: Util.hh:147
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...