Gazebo Sim

API Reference

7.9.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_SIM_LINK_HH_
18 #define GZ_SIM_LINK_HH_
19 
20 #include <memory>
21 #include <optional>
22 #include <string>
23 #include <vector>
24 
25 #include <gz/math/Matrix3.hh>
26 #include <gz/math/Matrix6.hh>
27 #include <gz/math/Pose3.hh>
28 #include <gz/math/Quaternion.hh>
29 #include <gz/math/Vector3.hh>
30 
31 #include <gz/sim/config.hh>
33 #include <gz/sim/Export.hh>
34 #include <gz/sim/Model.hh>
35 #include <gz/sim/Types.hh>
36 
37 namespace gz
38 {
39  namespace sim
40  {
41  // Inline bracket to help doxygen filtering.
42  inline namespace GZ_SIM_VERSION_NAMESPACE {
43  // Forward declarations.
44  class GZ_SIM_HIDDEN LinkPrivate;
45  //
65  class GZ_SIM_VISIBLE Link
66  {
69  public: explicit Link(sim::Entity _entity = kNullEntity);
70 
73  public: Link(const Link &_link);
74 
77  public: Link(Link &&_link) noexcept;
78 
82  public: Link &operator=(Link &&_link) noexcept;
83 
87  public: Link &operator=(const Link &_link);
88 
90  public: ~Link();
91 
94  public: sim::Entity Entity() const;
95 
98  public: void ResetEntity(sim::Entity _newEntity);
99 
104  public: bool Valid(const EntityComponentManager &_ecm) const;
105 
110  public: std::optional<std::string> Name(
111  const EntityComponentManager &_ecm) const;
112 
117  public: std::optional<Model> ParentModel(
118  const EntityComponentManager &_ecm) const;
119 
123  public: bool IsCanonical(const EntityComponentManager &_ecm) const;
124 
128  public: bool WindMode(const EntityComponentManager &_ecm) const;
129 
135  public: sim::Entity CollisionByName(const EntityComponentManager &_ecm,
136  const std::string &_name) const;
137 
143  public: sim::Entity VisualByName(const EntityComponentManager &_ecm,
144  const std::string &_name) const;
145 
149  public: std::vector<sim::Entity> Collisions(
150  const EntityComponentManager &_ecm) const;
151 
155  public: std::vector<sim::Entity> Visuals(
156  const EntityComponentManager &_ecm) const;
157 
162  public: uint64_t CollisionCount(const EntityComponentManager &_ecm) const;
163 
168  public: uint64_t VisualCount(const EntityComponentManager &_ecm) const;
169 
174  public: std::optional<math::Pose3d> WorldPose(
175  const EntityComponentManager &_ecm) const;
176 
182  public: std::optional<math::Pose3d> WorldInertialPose(
183  const EntityComponentManager &_ecm) const;
184 
193  public: std::optional<math::Vector3d> WorldLinearVelocity(
194  const EntityComponentManager &_ecm) const;
195 
204  public: std::optional<math::Vector3d> WorldLinearVelocity(
205  const EntityComponentManager &_ecm,
206  const math::Vector3d &_offset) const;
207 
213  public: std::optional<math::Vector3d> WorldAngularVelocity(
214  const EntityComponentManager &_ecm) const;
215 
222  public: void EnableVelocityChecks(EntityComponentManager &_ecm,
223  bool _enable = true) const;
224 
229  public: void SetLinearVelocity(EntityComponentManager &_ecm,
230  const math::Vector3d &_vel) const;
231 
232 
237  public: void SetAngularVelocity(EntityComponentManager &_ecm,
238  const math::Vector3d &_vel) const;
239 
245  public: std::optional<math::Vector3d> WorldAngularAcceleration(
246  const EntityComponentManager &_ecm) const;
247 
253  public: std::optional<math::Vector3d> WorldLinearAcceleration(
254  const EntityComponentManager &_ecm) const;
255 
262  public: void EnableAccelerationChecks(EntityComponentManager &_ecm,
263  bool _enable = true) const;
264 
270  public: std::optional<math::Matrix3d> WorldInertiaMatrix(
271  const EntityComponentManager &_ecm) const;
272 
278  public: std::optional<math::Matrix6d> WorldFluidAddedMassMatrix(
279  const EntityComponentManager &_ecm) const;
280 
288  public: std::optional<double> WorldKineticEnergy(
289  const EntityComponentManager &_ecm) const;
290 
295  public: void AddWorldForce(EntityComponentManager &_ecm,
296  const math::Vector3d &_force) const;
297 
304  public: void AddWorldForce(EntityComponentManager &_ecm,
305  const math::Vector3d &_force,
306  const math::Vector3d &_position) const;
307 
314  public: void AddWorldWrench(EntityComponentManager &_ecm,
315  const math::Vector3d &_force,
316  const math::Vector3d &_torque) const;
317 
326  public: void AddWorldWrench(EntityComponentManager &_ecm,
327  const math::Vector3d &_force,
328  const math::Vector3d &_torque,
329  const math::Vector3d &_offset) const;
330 
332  private: std::unique_ptr<LinkPrivate> dataPtr;
333  };
334  }
335  }
336 }
337 #endif