Gazebo Sim

API Reference

7.7.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/Pose3.hh>
27 #include <gz/math/Quaternion.hh>
28 #include <gz/math/Vector3.hh>
29 
30 #include <gz/sim/config.hh>
32 #include <gz/sim/Export.hh>
33 #include <gz/sim/Model.hh>
34 #include <gz/sim/Types.hh>
35 
36 namespace gz
37 {
38  namespace sim
39  {
40  // Inline bracket to help doxygen filtering.
41  inline namespace GZ_SIM_VERSION_NAMESPACE {
42  // Forward declarations.
43  class GZ_SIM_HIDDEN LinkPrivate;
44  //
64  class GZ_SIM_VISIBLE Link
65  {
68  public: explicit Link(sim::Entity _entity = kNullEntity);
69 
72  public: Link(const Link &_link);
73 
76  public: Link(Link &&_link) noexcept;
77 
81  public: Link &operator=(Link &&_link) noexcept;
82 
86  public: Link &operator=(const Link &_link);
87 
89  public: ~Link();
90 
93  public: sim::Entity Entity() const;
94 
97  public: void ResetEntity(sim::Entity _newEntity);
98 
103  public: bool Valid(const EntityComponentManager &_ecm) const;
104 
109  public: std::optional<std::string> Name(
110  const EntityComponentManager &_ecm) const;
111 
116  public: std::optional<Model> ParentModel(
117  const EntityComponentManager &_ecm) const;
118 
122  public: bool IsCanonical(const EntityComponentManager &_ecm) const;
123 
127  public: bool WindMode(const EntityComponentManager &_ecm) const;
128 
134  public: sim::Entity CollisionByName(const EntityComponentManager &_ecm,
135  const std::string &_name) const;
136 
142  public: sim::Entity VisualByName(const EntityComponentManager &_ecm,
143  const std::string &_name) const;
144 
148  public: std::vector<sim::Entity> Collisions(
149  const EntityComponentManager &_ecm) const;
150 
154  public: std::vector<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 
317  public: void AddWorldWrench(EntityComponentManager &_ecm,
318  const math::Vector3d &_force,
319  const math::Vector3d &_torque,
320  const math::Vector3d &_offset) const;
321 
323  private: std::unique_ptr<LinkPrivate> dataPtr;
324  };
325  }
326  }
327 }
328 #endif