Ignition Physics

API Reference

2.0.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, typename FeaturesT>
37  class World : public virtual Feature::World<PolicyT, FeaturesT>
38  {
39  public: using ShapePtrType = ShapePtr<PolicyT, FeaturesT>;
40  public: using VectorType =
41  typename FromPolicy<PolicyT>::template Use<Vector>;
42 
43  public: struct ContactPoint
44  {
51  };
52 
53  public: using Contact = RequireData<ContactPoint>;
54 
56  public: std::vector<Contact> GetContactsFromLastStep() const;
57  };
58 
59  public: template <typename PolicyT>
60  class Implementation : public virtual Feature::Implementation<PolicyT>
61  {
62  public: using VectorType =
63  typename FromPolicy<PolicyT>::template Use<Vector>;
64 
65  public: struct ContactInternal
66  {
68  Identity collision1;
70  Identity collision2;
75  };
76 
77  public: virtual std::vector<ContactInternal> GetContactsFromLastStep(
78  const Identity &_worldID) const = 0;
79  };
80 };
81 }
82 }
83 
84 #include "ignition/physics/detail/GetContacts.hh"
85 
86 #endif /* end of include guard: IGNITION_PHYSICS_GETCONTACTS_HH_ */
Identity collision1
Identity of the first body.
Definition: GetContacts.hh:68
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:39
GetContactsFromLastStepFeature is a feature for retrieving the list of contacts generated in the prev...
Definition: GetContacts.hh:33
VectorType point
The point of contact expressed in the world frame.
Definition: GetContacts.hh:72
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:48
ShapePtrType collision1
Collision shape of the first body.
Definition: GetContacts.hh:46
RequireData< ContactPoint > Contact
Definition: GetContacts.hh:53
typename FromPolicy< PolicyT >::template Use< Vector > VectorType
Definition: GetContacts.hh:41
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:63
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:70
VectorType point
The point of contact expressed in the world frame.
Definition: GetContacts.hh:50
CompositeData extraData
Extra data related to contact.
Definition: GetContacts.hh:74