Gazebo Physics

API Reference

8.0.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
18#ifndef GZ_PHYSICS_LINK_HH_
19#define GZ_PHYSICS_LINK_HH_
20
22#include <gz/physics/FrameID.hh>
25
26namespace gz
27{
28 namespace physics
29 {
31 class GZ_PHYSICS_VISIBLE AddLinkExternalForceTorque
32 : public virtual FeatureWithRequirements<LinkFrameSemantics>
33 {
35 public: template <typename PolicyT, typename FeaturesT>
36 class Link : public virtual LinkFrameSemantics::Link<PolicyT, FeaturesT>
37 {
38 public: using LinearVectorType =
39 typename FromPolicy<PolicyT>::template Use<LinearVector>;
40
41 public: using RelativePositionType =
42 typename FromPolicy<PolicyT>::template Use<RelativePosition>;
43
44 public: using RelativeForceType =
45 typename FromPolicy<PolicyT>::template Use<RelativeForce>;
46
47 public: using AngularVectorType =
48 typename FromPolicy<PolicyT>::template Use<AngularVector>;
49
50 public: using RelativeTorqueType =
51 typename FromPolicy<PolicyT>::template Use<RelativeTorque>;
52
61 public: void AddExternalForce(
62 const RelativeForceType &_force,
63 const RelativePositionType &_position);
64
81 public: void AddExternalForce(
82 const LinearVectorType &_force,
83 const FrameID &_forceInCoordinatesOf = FrameID::World(),
84 const LinearVectorType &_position = LinearVectorType::Zero());
85
91 public: void AddExternalTorque(const RelativeTorqueType &_torque);
92
98 public: void AddExternalTorque(
99 const AngularVectorType &_torque,
100 const FrameID &_inCoordinatesOf = FrameID::World());
101 };
102
104 public: template <typename PolicyT>
105 class Implementation : public virtual Feature::Implementation<PolicyT>
106 {
107 public: using LinearVectorType =
108 typename FromPolicy<PolicyT>::template Use<LinearVector>;
109
110 public: using AngularVectorType =
111 typename FromPolicy<PolicyT>::template Use<AngularVector>;
112
113 // \brief Implementation API for adding a force to link at a specified
114 // position. The force and the position are both expressed in the World
115 // frame
120 public: virtual void AddLinkExternalForceInWorld(
121 const Identity &_id, const LinearVectorType &_force,
122 const LinearVectorType &_position) = 0;
123
124 // \brief Implementation API for adding a torque to link position.
128 public: virtual void AddLinkExternalTorqueInWorld(
129 const Identity &_id, const AngularVectorType &_torque) = 0;
130 };
131 };
132 }
133}
134
135#include <gz/physics/detail/Link.hh>
136
137#endif