Gazebo Gazebo

API Reference

3.15.2
gz/sim/Model.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2018 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 GZ_GAZEBO_MODEL_HH_
18 #define GZ_GAZEBO_MODEL_HH_
19 
20 #include <memory>
21 #include <string>
22 #include <vector>
23 
24 #include <gz/math/Pose3.hh>
25 
26 #include <gz/sim/config.hh>
28 #include <gz/sim/Export.hh>
29 #include <gz/sim/Types.hh>
30 
31 namespace ignition
32 {
33  namespace gazebo
34  {
35  // Inline bracket to help doxygen filtering.
36  inline namespace IGNITION_GAZEBO_VERSION_NAMESPACE {
37  // Forward declarations.
38  class IGNITION_GAZEBO_HIDDEN ModelPrivate;
39  //
60  class IGNITION_GAZEBO_VISIBLE Model {
63  public: explicit Model(gz::sim::Entity _entity = kNullEntity);
64 
67  public: Model(const Model &_model);
68 
71  public: Model(Model &&_model) noexcept;
72 
76  public: Model &operator=(Model &&_model) noexcept;
77 
81  public: Model &operator=(const Model &_model);
82 
84  public: virtual ~Model();
85 
88  public: gz::sim::Entity Entity() const;
89 
94  public: bool Valid(const EntityComponentManager &_ecm) const;
95 
99  public: std::string Name(const EntityComponentManager &_ecm) const;
100 
104  public: bool Static(const EntityComponentManager &_ecm) const;
105 
109  public: bool SelfCollide(const EntityComponentManager &_ecm) const;
110 
114  public: bool WindMode(const EntityComponentManager &_ecm) const;
115 
122  const;
123 
130  public: gz::sim::Entity JointByName(const EntityComponentManager &_ecm,
131  const std::string &_name);
132 
139  public: gz::sim::Entity LinkByName(const EntityComponentManager &_ecm,
140  const std::string &_name);
141 
145  public: std::vector<gz::sim::Entity> Joints(
146  const EntityComponentManager &_ecm) const;
147 
151  public: std::vector<gz::sim::Entity> Links(
152  const EntityComponentManager &_ecm) const;
153 
158  public: uint64_t JointCount(const EntityComponentManager &_ecm) const;
159 
164  public: uint64_t LinkCount(const EntityComponentManager &_ecm) const;
165 
169  public: void SetWorldPoseCmd(EntityComponentManager &_ecm,
170  const math::Pose3d &_pose);
171 
176  const EntityComponentManager &_ecm) const;
177 
179  private: std::unique_ptr<ModelPrivate> dataPtr;
180  };
181  }
182  }
183 }
184 #endif
bool Valid(const EntityComponentManager &_ecm) const
Check whether this model correctly refers to an entity that has a components::Model.
uint64_t Entity
An Entity identifies a single object in simulation such as a model, link, or light....
Definition: gz/sim/Entity.hh:59
This library is part of the Ignition Robotics project.
STL class.
The EntityComponentManager constructs, deletes, and returns components and entities....
Definition: gz/sim/EntityComponentManager.hh:65
bool SelfCollide(const EntityComponentManager &_ecm) const
Get whether this model has self-collide enabled.
This class provides wrappers around entities and components which are more convenient and straight-fo...
Definition: gz/sim/Model.hh:60
std::vector< gz::sim::Entity > Joints(const EntityComponentManager &_ecm) const
Get all joints which are immediate children of this model.
STL class.
Component< bool, class WindModeTag > WindMode
A component used to indicate whether an entity is affected by wind.
Definition: gz/sim/components/WindMode.hh:33
uint64_t JointCount(const EntityComponentManager &_ecm) const
Get the number of joints which are immediate children of this model.
std::vector< gz::sim::Entity > Links(const EntityComponentManager &_ecm) const
Get all links which are immediate children of this model.
virtual ~Model()
Destructor.
Component< std::string, class NameTag > Name
This component holds an entity's name. The component has no concept of scoped names nor does it care ...
Definition: gz/sim/components/Name.hh:35
class IGNITION_GAZEBO_HIDDEN ModelPrivate
Definition: gz/sim/Model.hh:38
Component< std::string, class SourceFilePathTag > SourceFilePath
This component holds the filepath to the source from which an entity is created. For example,...
Definition: gz/sim/components/SourceFilePath.hh:36
const Entity kNullEntity
Indicates a non-existant or invalid Entity.
Definition: gz/sim/Entity.hh:62
Component< NoData, class CanonicalLinkTag > CanonicalLink
A component that identifies an entity as being a canonical link.
Definition: gz/sim/components/CanonicalLink.hh:33
std::string SourceFilePath(const EntityComponentManager &_ecm) const
Get the source file where this model came from. If empty, the model wasn't loaded directly from a fil...
gz::sim::Entity Entity() const
Get the entity which this Model is related to.
std::string Name(const EntityComponentManager &_ecm) const
Get the model's unscoped name.
gz::sim::Entity JointByName(const EntityComponentManager &_ecm, const std::string &_name)
Get the ID of a joint entity which is an immediate child of this model.
Component< NoData, class ModelTag > Model
A component that identifies an entity as being a model.
Definition: gz/sim/components/Model.hh:35
void SetWorldPoseCmd(EntityComponentManager &_ecm, const math::Pose3d &_pose)
Set a command to change the model's pose.
bool WindMode(const EntityComponentManager &_ecm) const
Get whether this model has wind enabled.
Model(gz::sim::Entity _entity=kNullEntity)
Constructor.
Component< bool, class StaticTag > Static
A component used to indicate that a model is static (i.e. not moveable).
Definition: gz/sim/components/Static.hh:34
Component< bool, class SelfCollideTag > SelfCollide
A component used to hold a model's self collide property.
Definition: gz/sim/components/SelfCollide.hh:33
gz::sim::Entity LinkByName(const EntityComponentManager &_ecm, const std::string &_name)
Get the ID of a link entity which is an immediate child of this model.
Model & operator=(Model &&_model) noexcept
Move assignment operator.
gz::sim::Entity CanonicalLink(const EntityComponentManager &_ecm) const
Get the model's canonical link entity.
uint64_t LinkCount(const EntityComponentManager &_ecm) const
Get the number of links which are immediate children of this model.
bool Static(const EntityComponentManager &_ecm) const
Get whether this model is static.