Surface.hh
Go to the documentation of this file.
1 /*
2  * Copyright 2020 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 #ifndef SDF_SURFACE_HH_
18 #define SDF_SURFACE_HH_
19 
20 #include <cstdint>
21 #include <optional>
22 
23 #include <gz/math/Vector3.hh>
24 #include <gz/utils/ImplPtr.hh>
25 #include "sdf/Element.hh"
26 #include "sdf/Types.hh"
27 #include "sdf/sdf_config.h"
28 #include "sdf/system_util.hh"
29 
30 namespace sdf
31 {
32  // Inline bracket to help doxygen filtering.
33  inline namespace SDF_VERSION_NAMESPACE {
36  {
38  public: Contact();
39 
46  public: Errors Load(ElementPtr _sdf);
47 
52  public: sdf::ElementPtr Element() const;
53 
56  public: uint16_t CollideBitmask() const;
57 
60  public: void SetCollideBitmask(const uint16_t _bitmask);
61 
64  public: std::optional<uint16_t> CategoryBitmask() const;
65 
68  public: void SetCategoryBitmask(const uint16_t _bitmask);
69 
71  GZ_UTILS_IMPL_PTR(dataPtr)
72  };
73 
76  {
78  public: ODE();
79 
86  public: Errors Load(ElementPtr _sdf);
87 
90  public: double Mu() const;
91 
94  public: void SetMu(double _mu);
95 
98  public: double Mu2() const;
99 
102  public: void SetMu2(double _mu2);
103 
106  public: const gz::math::Vector3d &Fdir1() const;
107 
110  public: void SetFdir1(const gz::math::Vector3d &_fdir);
111 
114  public: double Slip1() const;
115 
118  public: void SetSlip1(double _slip1);
119 
122  public: double Slip2() const;
123 
126  public: void SetSlip2(double _slip2);
127 
132  public: sdf::ElementPtr Element() const;
133 
135  GZ_UTILS_IMPL_PTR(dataPtr)
136  };
137 
140  {
142  public: BulletFriction();
143 
150  public: Errors Load(ElementPtr _sdf);
151 
154  public: double Friction() const;
155 
158  public: void SetFriction(double _friction);
159 
163  public: double Friction2() const;
164 
167  public: void SetFriction2(double _friction);
168 
172  public: const gz::math::Vector3d &Fdir1() const;
173 
177  public: void SetFdir1(const gz::math::Vector3d &_fdir);
178 
181  public: double RollingFriction() const;
182 
185  public: void SetRollingFriction(double _friction);
186 
191  public: sdf::ElementPtr Element() const;
192 
194  GZ_UTILS_IMPL_PTR(dataPtr)
195  };
196 
199  {
201  public: Torsional();
202 
209  public: Errors Load(ElementPtr _sdf);
210 
213  public: double Coefficient() const;
214 
217  public: void SetCoefficient(double _coefficient);
218 
222  public: bool UsePatchRadius() const;
223 
228  public: void SetUsePatchRadius(bool _usePatchRadius);
229 
232  public: double PatchRadius() const;
233 
236  public: void SetPatchRadius(double _radius);
237 
240  public: double SurfaceRadius() const;
241 
244  public: void SetSurfaceRadius(double _radius);
245 
248  public: double ODESlip() const;
249 
252  public: void SetODESlip(double _slip);
253 
258  public: sdf::ElementPtr Element() const;
259 
261  GZ_UTILS_IMPL_PTR(dataPtr)
262  };
263 
266  {
268  public: Friction();
269 
276  public: Errors Load(ElementPtr _sdf);
277 
281  public: const sdf::ODE *ODE() const;
282 
285  public: void SetODE(const sdf::ODE &_ode);
286 
290  public: const sdf::BulletFriction *BulletFriction() const;
291 
294  public: void SetBulletFriction(const sdf::BulletFriction &_bullet);
295 
299  public: const sdf::Torsional *Torsional() const;
300 
303  public: void SetTorsional(const sdf::Torsional &_torsional);
304 
309  public: sdf::ElementPtr Element() const;
310 
312  GZ_UTILS_IMPL_PTR(dataPtr)
313  };
314 
317  {
319  public: Surface();
320 
327  public: Errors Load(ElementPtr _sdf);
328 
333  public: sdf::ElementPtr Element() const;
334 
338  public: const sdf::Contact *Contact() const;
339 
342  public: void SetContact(const sdf::Contact &_contact);
343 
347  public: const sdf::Friction *Friction() const;
348 
351  public: void SetFriction(const sdf::Friction &_friction);
352 
358  public: sdf::ElementPtr ToElement() const;
359 
366  public: sdf::ElementPtr ToElement(sdf::Errors &_errors) const;
367 
369  GZ_UTILS_IMPL_PTR(dataPtr)
370  };
371  }
372 }
373 
374 #endif
BulletFriction information for a friction.
Definition: Surface.hh:140
double Friction() const
Get the friction coefficient in first friction pyramid direction.
sdf::ElementPtr Element() const
Get a pointer to the SDF element that was used during load.
const gz::math::Vector3d & Fdir1() const
Get the first friction pyramid direction in collision-fixed reference.
double RollingFriction() const
Get the rolling friction coefficient.
void SetFriction(double _friction)
Set friction coefficient in first friction pyramid direction.
Errors Load(ElementPtr _sdf)
Load BulletFriction friction based on a element pointer.
void SetRollingFriction(double _friction)
Set the rolling friction coefficient.
void SetFdir1(const gz::math::Vector3d &_fdir)
Set the first friction pyramid direction in collision-fixed reference.
double Friction2() const
Get the friction coefficient in second friction pyramid direction.
void SetFriction2(double _friction)
Set friction coefficient in second friction pyramid direction.
Contact information for a surface.
Definition: Surface.hh:36
Errors Load(ElementPtr _sdf)
Load the contact based on a element pointer.
uint16_t CollideBitmask() const
Get the collide bitmask parameter.
void SetCategoryBitmask(const uint16_t _bitmask)
Set the category bitmask parameter.
std::optional< uint16_t > CategoryBitmask() const
Get the category bitmask parameter.
sdf::ElementPtr Element() const
Get a pointer to the SDF element that was used during load.
void SetCollideBitmask(const uint16_t _bitmask)
Set the collide bitmask parameter.
Friction information for a surface.
Definition: Surface.hh:266
const sdf::BulletFriction * BulletFriction() const
Get the associated BulletFriction object.
const sdf::ODE * ODE() const
Get the associated ODE object.
void SetODE(const sdf::ODE &_ode)
Set the associated ODE object.
Errors Load(ElementPtr _sdf)
Load the friction based on a element pointer.
void SetBulletFriction(const sdf::BulletFriction &_bullet)
Set the associated BulletFriction object.
const sdf::Torsional * Torsional() const
Get the torsional friction.
sdf::ElementPtr Element() const
Get a pointer to the SDF element that was used during load.
void SetTorsional(const sdf::Torsional &_torsional)
Set the torsional friction.
ODE information for a friction.
Definition: Surface.hh:76
double Slip1() const
Get the slip1.
double Mu2() const
Get the Mu2.
void SetFdir1(const gz::math::Vector3d &_fdir)
Set fdir.
void SetMu(double _mu)
Set Mu.
double Mu() const
Set the Mu.
ODE()
Default constructor.
void SetSlip2(double _slip2)
Set Slip2.
double Slip2() const
Get the Slip2.
void SetSlip1(double _slip1)
Set Slip1.
sdf::ElementPtr Element() const
Get a pointer to the SDF element that was used during load.
void SetMu2(double _mu2)
Set Mu2.
const gz::math::Vector3d & Fdir1() const
Get the fdir.
Errors Load(ElementPtr _sdf)
Load the ODE based on a element pointer.
Surface information for a collision.
Definition: Surface.hh:317
const sdf::Friction * Friction() const
Get the associated friction object.
sdf::ElementPtr ToElement() const
Create and return an SDF element filled with data from this surface.
void SetContact(const sdf::Contact &_contact)
Set the associated contact object.
sdf::ElementPtr ToElement(sdf::Errors &_errors) const
Create and return an SDF element filled with data from this surface.
void SetFriction(const sdf::Friction &_friction)
Set the associated friction object.
sdf::ElementPtr Element() const
Get a pointer to the SDF element that was used during load.
Errors Load(ElementPtr _sdf)
Load the surface based on a element pointer.
const sdf::Contact * Contact() const
Get the associated contact object.
Torsional friction.
Definition: Surface.hh:199
Errors Load(ElementPtr _sdf)
Load torsional friction based on a element pointer.
void SetPatchRadius(double _radius)
Set the radius of contact patch surface.
void SetODESlip(double _slip)
Set the ODE force dependent slip for torsional friction.
double ODESlip() const
Get the ODE force dependent slip for torsional friction.
sdf::ElementPtr Element() const
Get a pointer to the SDF element that was used during load.
void SetSurfaceRadius(double _radius)
Set the surface radius on the contact point.
double SurfaceRadius() const
Get the surface radius on the contact point.
bool UsePatchRadius() const
Get whether the patch radius is used to calculate torsional friction.
void SetUsePatchRadius(bool _usePatchRadius)
Set whether to use patch radius for torsional friction calculation.
double Coefficient() const
Get the torsional friction coefficient.
double PatchRadius() const
Get the radius of contact patch surface.
void SetCoefficient(double _coefficient)
Set the torsional friction coefficient.
std::vector< Error > Errors
A vector of Error.
Definition: Types.hh:95
std::shared_ptr< Element > ElementPtr
Definition: Element.hh:55
namespace for Simulation Description Format parser
Definition: Actor.hh:35
#define SDFORMAT_VISIBLE
Use to represent "symbol visible" if supported.
Definition: system_util.hh:25