Ignition Physics

API Reference

2.3.0
GetContacts.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 IGNITION_PHYSICS_GETCONTACTS_HH_
19 #define IGNITION_PHYSICS_GETCONTACTS_HH_
20 
21 #include <vector>
26 
27 namespace ignition
28 {
29 namespace physics
30 {
33 class IGNITION_PHYSICS_VISIBLE GetContactsFromLastStepFeature
34  : public virtual FeatureWithRequirements<ForwardStep>
35 {
36  public: template <typename PolicyT>
38  {
39  using Scalar = typename PolicyT::Scalar;
40  using VectorType = typename FromPolicy<PolicyT>::template Use<Vector>;
41 
50  };
51 
52  public: template <typename PolicyT, typename FeaturesT>
53  class World : public virtual Feature::World<PolicyT, FeaturesT>
54  {
55  public: using Scalar = typename PolicyT::Scalar;
56  public: using ShapePtrType = ShapePtr<PolicyT, FeaturesT>;
57  public: using VectorType =
58  typename FromPolicy<PolicyT>::template Use<Vector>;
60 
61  public: struct ContactPoint
62  {
69  };
70 
71  public: using Contact = SpecifyData<
72  RequireData<ContactPoint>,
73  ExpectData<ExtraContactData> >;
74 
76  public: std::vector<Contact> GetContactsFromLastStep() const;
77  };
78 
79  public: template <typename PolicyT>
80  class Implementation : public virtual Feature::Implementation<PolicyT>
81  {
82  public: using Scalar = typename PolicyT::Scalar;
83  public: using VectorType =
84  typename FromPolicy<PolicyT>::template Use<Vector>;
86 
87  public: struct ContactInternal
88  {
90  Identity collision1;
92  Identity collision2;
97  };
98 
99  public: virtual std::vector<ContactInternal> GetContactsFromLastStep(
100  const Identity &_worldID) const = 0;
101  };
102 };
103 }
104 }
105 
106 #include "ignition/physics/detail/GetContacts.hh"
107 
108 #endif /* end of include guard: IGNITION_PHYSICS_GETCONTACTS_HH_ */
Identity collision1
Identity of the first body.
Definition: GetContacts.hh:90
typename FromPolicy< PolicyT >::template Use< Vector > VectorType
Definition: GetContacts.hh:40
If your feature is known to require any other features, then you should have your feature class inher...
Definition: FeatureList.hh:108
ShapePtr< PolicyT, FeaturesT > ShapePtrType
Definition: GetContacts.hh:56
GetContactsFromLastStepFeature is a feature for retrieving the list of contacts generated in the prev...
Definition: GetContacts.hh:33
typename PolicyT::Scalar Scalar
Definition: GetContacts.hh:39
Scalar depth
The penetration depth.
Definition: GetContacts.hh:49
VectorType normal
The normal of the force acting on the first body expressed in the world frame.
Definition: GetContacts.hh:47
VectorType point
The point of contact expressed in the world frame.
Definition: GetContacts.hh:94
This struct is used to conveniently convert from a policy to a geometric type. Example usage: ...
Definition: Geometry.hh:69
ShapePtrType collision2
Collision shape of the second body.
Definition: GetContacts.hh:66
typename PolicyT::Scalar Scalar
Definition: GetContacts.hh:82
VectorType force
The contact force acting on the first body expressed in the world frame.
Definition: GetContacts.hh:44
ShapePtrType collision1
Collision shape of the first body.
Definition: GetContacts.hh:64
typename FromPolicy< PolicyT >::template Use< Vector > VectorType
Definition: GetContacts.hh:58
Placeholder class in case a Feature does not define its own World API.
Definition: Feature.hh:49
typename FromPolicy< PolicyT >::template Use< Vector > VectorType
Definition: GetContacts.hh:84
The CompositeData class allows arbitrary data structures to be composed together, copied...
Definition: CompositeData.hh:43
STL class.
Identity collision2
Identity of the second body.
Definition: GetContacts.hh:92
The SpecifyData class allows you to form combinations of data specifications. In other words...
Definition: SpecifyData.hh:262
VectorType point
The point of contact expressed in the world frame.
Definition: GetContacts.hh:68
typename PolicyT::Scalar Scalar
Definition: GetContacts.hh:55
CompositeData extraData
Extra data related to contact.
Definition: GetContacts.hh:96