Gazebo Gazebo

API Reference

6.16.0
gz/sim/Link.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 GZ_GAZEBO_LINK_HH_
18 #define GZ_GAZEBO_LINK_HH_
19 
20 #include <memory>
21 #include <optional>
22 #include <string>
23 #include <vector>
24 
25 #include <gz/math/Pose3.hh>
26 #include <gz/math/Quaternion.hh>
27 #include <gz/math/Vector3.hh>
28 
29 #include <gz/sim/config.hh>
31 #include <gz/sim/Export.hh>
32 #include <gz/sim/Model.hh>
33 #include <gz/sim/Types.hh>
34 
35 namespace ignition
36 {
37  namespace gazebo
38  {
39  // Inline bracket to help doxygen filtering.
40  inline namespace IGNITION_GAZEBO_VERSION_NAMESPACE {
41  // Forward declarations.
42  class IGNITION_GAZEBO_HIDDEN LinkPrivate;
43  //
63  class IGNITION_GAZEBO_VISIBLE Link
64  {
67  public: explicit Link(gz::sim::Entity _entity = kNullEntity);
68 
71  public: Link(const Link &_link);
72 
75  public: Link(Link &&_link) noexcept;
76 
80  public: Link &operator=(Link &&_link) noexcept;
81 
85  public: Link &operator=(const Link &_link);
86 
88  public: ~Link();
89 
92  public: gz::sim::Entity Entity() const;
93 
96  public: void ResetEntity(gz::sim::Entity _newEntity);
97 
102  public: bool Valid(const EntityComponentManager &_ecm) const;
103 
108  public: std::optional<std::string> Name(
109  const EntityComponentManager &_ecm) const;
110 
115  public: std::optional<Model> ParentModel(
116  const EntityComponentManager &_ecm) const;
117 
121  public: bool IsCanonical(const EntityComponentManager &_ecm) const;
122 
126  public: bool WindMode(const EntityComponentManager &_ecm) const;
127 
133  public: gz::sim::Entity CollisionByName(
134  const EntityComponentManager &_ecm,
135  const std::string &_name) const;
136 
142  public: gz::sim::Entity VisualByName(const EntityComponentManager &_ecm,
143  const std::string &_name) const;
144 
148  public: std::vector<gz::sim::Entity> Collisions(
149  const EntityComponentManager &_ecm) const;
150 
154  public: std::vector<gz::sim::Entity> Visuals(
155  const EntityComponentManager &_ecm) const;
156 
161  public: uint64_t CollisionCount(const EntityComponentManager &_ecm) const;
162 
167  public: uint64_t VisualCount(const EntityComponentManager &_ecm) const;
168 
173  public: std::optional<math::Pose3d> WorldPose(
174  const EntityComponentManager &_ecm) const;
175 
181  public: std::optional<math::Pose3d> WorldInertialPose(
182  const EntityComponentManager &_ecm) const;
183 
192  public: std::optional<math::Vector3d> WorldLinearVelocity(
193  const EntityComponentManager &_ecm) const;
194 
203  public: std::optional<math::Vector3d> WorldLinearVelocity(
204  const EntityComponentManager &_ecm,
205  const math::Vector3d &_offset) const;
206 
212  public: std::optional<math::Vector3d> WorldAngularVelocity(
213  const EntityComponentManager &_ecm) const;
214 
221  public: void EnableVelocityChecks(EntityComponentManager &_ecm,
222  bool _enable = true) const;
223 
228  public: void SetLinearVelocity(EntityComponentManager &_ecm,
229  const math::Vector3d &_vel) const;
230 
231 
236  public: void SetAngularVelocity(EntityComponentManager &_ecm,
237  const math::Vector3d &_vel) const;
238 
244  public: std::optional<math::Vector3d> WorldAngularAcceleration(
245  const EntityComponentManager &_ecm) const;
246 
252  public: std::optional<math::Vector3d> WorldLinearAcceleration(
253  const EntityComponentManager &_ecm) const;
254 
261  public: void EnableAccelerationChecks(EntityComponentManager &_ecm,
262  bool _enable = true) const;
263 
269  public: std::optional<math::Matrix3d> WorldInertiaMatrix(
270  const EntityComponentManager &_ecm) const;
271 
279  public: std::optional<double> WorldKineticEnergy(
280  const EntityComponentManager &_ecm) const;
281 
286  public: void AddWorldForce(EntityComponentManager &_ecm,
287  const math::Vector3d &_force) const;
288 
295  public: void AddWorldForce(EntityComponentManager &_ecm,
296  const math::Vector3d &_force,
297  const math::Vector3d &_position) const;
298 
305  public: void AddWorldWrench(EntityComponentManager &_ecm,
306  const math::Vector3d &_force,
307  const math::Vector3d &_torque) const;
308 
310  private: std::unique_ptr<LinkPrivate> dataPtr;
311  };
312  }
313  }
314 }
315 #endif
uint64_t Entity
An Entity identifies a single object in simulation such as a model, link, or light....
Definition: gz/sim/Entity.hh:58
This library is part of the Gazebo project.
STL class.
The EntityComponentManager constructs, deletes, and returns components and entities....
Definition: gz/sim/EntityComponentManager.hh:66
STL class.
class IGNITION_GAZEBO_HIDDEN LinkPrivate
Definition: gz/sim/Link.hh:42
Component< bool, class WindModeTag > WindMode
A component used to indicate whether an entity is affected by wind.
Definition: gz/sim/components/WindMode.hh:33
const Entity kNullEntity
Indicates a non-existant or invalid Entity.
Definition: gz/sim/Entity.hh:61
Component< NoData, class LinkTag > Link
A component that identifies an entity as being a link.
Definition: gz/sim/components/Link.hh:33
Component< std::string, class NameTag, serializers::StringSerializer > 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:37