Gazebo Physics

API Reference

6.5.1
gz/physics/ContactProperties.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2021 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_CONTACTPROPERTIES_HH_
19 #define GZ_PHYSICS_CONTACTPROPERTIES_HH_
20 
21 #include <string>
22 #include <vector>
23 
26 #include <gz/physics/Geometry.hh>
29 
30 namespace gz
31 {
32 namespace physics
33 {
37 class GZ_PHYSICS_VISIBLE SetContactPropertiesCallbackFeature
38  : public virtual FeatureWithRequirements<ForwardStep>
39 {
46  public: template <typename PolicyT> struct ContactSurfaceParams
47  {
49  std::optional<typename PolicyT::Scalar> frictionCoeff;
50 
52  std::optional<typename PolicyT::Scalar> secondaryFrictionCoeff;
53 
55  std::optional<typename PolicyT::Scalar> rollingFrictionCoeff;
56 
58  std::optional<typename PolicyT::Scalar> secondaryRollingFrictionCoeff;
59 
61  std::optional<typename PolicyT::Scalar> torsionalFrictionCoeff;
62 
65  std::optional<typename PolicyT::Scalar> slipCompliance;
66 
69  std::optional<typename PolicyT::Scalar> secondarySlipCompliance;
70 
73  std::optional<typename PolicyT::Scalar> restitutionCoeff;
74 
78  std::optional<typename FromPolicy<PolicyT>::template Use<Vector>>
80 
87  std::optional<typename FromPolicy<PolicyT>::template Use<Vector>>
89 
93  std::optional<typename PolicyT::Scalar> errorReductionParameter;
94 
96  std::optional<typename PolicyT::Scalar> maxErrorReductionVelocity;
97 
99  std::optional<typename PolicyT::Scalar> maxErrorAllowance;
100 
104  std::optional<typename PolicyT::Scalar> constraintForceMixing;
105  };
106 
107  public: template <typename PolicyT, typename FeaturesT>
108  class World : public virtual Feature::World<PolicyT, FeaturesT>
109  {
110  public: using ShapePtrType = typename GetContactsFromLastStepFeature
111  ::World<PolicyT, FeaturesT>::ShapePtrType;
112 
125  public: typedef std::function<
126  void(
127  const typename GetContactsFromLastStepFeature::
129  size_t /*_numContactsOnCollision*/,
130  ContactSurfaceParams<PolicyT>& /*_surfaceParams*/)
132 
134  public: void AddContactPropertiesCallback(
135  const std::string &_callbackID, SurfaceParamsCallback _callback);
136 
138  public: bool RemoveContactPropertiesCallback(
139  const std::string &_callbackID);
140  };
141 
142  public: template <typename PolicyT>
143  class Implementation : public virtual Feature::Implementation<PolicyT>
144  {
145  public: using ContactImpl = typename GetContactsFromLastStepFeature
146  ::Implementation<PolicyT>::ContactInternal;
147 
148  public: typedef std::function<
149  void(const ContactImpl&, size_t, ContactSurfaceParams<PolicyT>&)
151 
153  public: virtual void AddContactPropertiesCallback(
154  const Identity &_worldID,
155  const std::string &_callbackID,
156  SurfaceParamsCallback _callback) = 0;
157 
159  public: virtual bool RemoveContactPropertiesCallback(
160  const Identity &_worldID, const std::string &_callbackID) = 0;
161  };
162 };
163 
164 }
165 }
166 
167 #include "gz/physics/detail/ContactProperties.hh"
168 
169 #endif /* end of include guard: GZ_PHYSICS_CONTACTPROPERTIES_HH_ */