Gazebo Physics

API Reference

2.6.2
gz/physics/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>
24 #include <gz/physics/Geometry.hh>
25 
26 namespace ignition
27 {
28  namespace physics
29  {
31  class IGNITION_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
The implementation API for setting force/torque on a link.
Definition: gz/physics/Link.hh:105
If your feature is known to require any other features, then you should have your feature class inher...
Definition: gz/physics/FeatureList.hh:108
virtual void AddLinkExternalTorqueInWorld(const Identity &_id, const AngularVectorType &_torque)=0
This struct is used to conveniently convert from a policy to a geometric type. Example usage:
Definition: gz/physics/Geometry.hh:69
typename FromPolicy< PolicyT >::template Use< LinearVector > LinearVectorType
Definition: gz/physics/Link.hh:108
Container for specifying Frame IDs. We do not want to use a generic integer type for this,...
Definition: gz/physics/FrameID.hh:46
Definition: gz/physics/Feature.hh:92
typename FromPolicy< PolicyT >::template Use< AngularVector > AngularVectorType
Definition: gz/physics/Link.hh:111
Definition: gz/physics/Link.hh:31
static const FrameID & World()
Get a reference to the world Frame.
virtual void AddLinkExternalForceInWorld(const Identity &_id, const LinearVectorType &_force, const LinearVectorType &_position)=0
Base class for the API of a Frame. This will be inherited by any objects that are able to express Fra...
Definition: gz/physics/FrameSemantics.hh:41