Ignition Gazebo

API Reference

6.5.0
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 IGNITION_GAZEBO_LINK_HH_
18 #define IGNITION_GAZEBO_LINK_HH_
19 
20 #include <memory>
21 #include <optional>
22 #include <string>
23 #include <vector>
24 
25 #include <ignition/math/Pose3.hh>
27 #include <ignition/math/Vector3.hh>
28 
29 #include <ignition/gazebo/config.hh>
31 #include <ignition/gazebo/Export.hh>
32 #include <ignition/gazebo/Model.hh>
33 #include <ignition/gazebo/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(gazebo::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: gazebo::Entity Entity() const;
93 
96  public: void ResetEntity(gazebo::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: gazebo::Entity CollisionByName(const EntityComponentManager &_ecm,
134  const std::string &_name) const;
135 
141  public: gazebo::Entity VisualByName(const EntityComponentManager &_ecm,
142  const std::string &_name) const;
143 
147  public: std::vector<gazebo::Entity> Collisions(
148  const EntityComponentManager &_ecm) const;
149 
153  public: std::vector<gazebo::Entity> Visuals(
154  const EntityComponentManager &_ecm) const;
155 
160  public: uint64_t CollisionCount(const EntityComponentManager &_ecm) const;
161 
166  public: uint64_t VisualCount(const EntityComponentManager &_ecm) const;
167 
172  public: std::optional<math::Pose3d> WorldPose(
173  const EntityComponentManager &_ecm) const;
174 
180  public: std::optional<math::Pose3d> WorldInertialPose(
181  const EntityComponentManager &_ecm) const;
182 
191  public: std::optional<math::Vector3d> WorldLinearVelocity(
192  const EntityComponentManager &_ecm) const;
193 
202  public: std::optional<math::Vector3d> WorldLinearVelocity(
203  const EntityComponentManager &_ecm,
204  const math::Vector3d &_offset) const;
205 
211  public: std::optional<math::Vector3d> WorldAngularVelocity(
212  const EntityComponentManager &_ecm) const;
213 
220  public: void EnableVelocityChecks(EntityComponentManager &_ecm,
221  bool _enable = true) const;
222 
227  public: void SetLinearVelocity(EntityComponentManager &_ecm,
228  const math::Vector3d &_vel) const;
229 
235  public: std::optional<math::Vector3d> WorldAngularAcceleration(
236  const EntityComponentManager &_ecm) const;
237 
243  public: std::optional<math::Vector3d> WorldLinearAcceleration(
244  const EntityComponentManager &_ecm) const;
245 
252  public: void EnableAccelerationChecks(EntityComponentManager &_ecm,
253  bool _enable = true) const;
254 
260  public: std::optional<math::Matrix3d> WorldInertiaMatrix(
261  const EntityComponentManager &_ecm) const;
262 
270  public: std::optional<double> WorldKineticEnergy(
271  const EntityComponentManager &_ecm) const;
272 
277  public: void AddWorldForce(EntityComponentManager &_ecm,
278  const math::Vector3d &_force) const;
279 
286  public: void AddWorldForce(EntityComponentManager &_ecm,
287  const math::Vector3d &_force,
288  const math::Vector3d &_position) const;
289 
296  public: void AddWorldWrench(EntityComponentManager &_ecm,
297  const math::Vector3d &_force,
298  const math::Vector3d &_torque) const;
299 
301  private: std::unique_ptr<LinkPrivate> dataPtr;
302  };
303  }
304  }
305 }
306 #endif
class IGNITION_GAZEBO_HIDDEN LinkPrivate
Definition: Link.hh:42
STL class.
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
Component< std::string, class NameTag, serializers::StringSerializer > Name
This component holds an entity&#39;s name. The component has no concept of scoped names nor does it care ...
Definition: Name.hh:37
Component< bool, class WindModeTag > WindMode
A component used to indicate whether an entity is affected by wind.
Definition: WindMode.hh:33
const Entity kNullEntity
Indicates a non-existant or invalid Entity.
Definition: Entity.hh:62
STL class.
Component< NoData, class LinkTag > Link
A component that identifies an entity as being a link.
Definition: components/Link.hh:33
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