AGX Dynamics  2.35.0.1
OneBodyTire.h
Go to the documentation of this file.
1 /*
2 Copyright 2007-2022. Algoryx Simulation AB.
3 
4 All AGX source code, intellectual property, documentation, sample code,
5 tutorials, scene files and technical white papers, are copyrighted, proprietary
6 and confidential material of Algoryx Simulation AB. You may not download, read,
7 store, distribute, publish, copy or otherwise disseminate, use or expose this
8 material unless having a written signed agreement with Algoryx Simulation AB, or having been
9 advised so by Algoryx Simulation AB for a time limited evaluation, or having purchased a
10 valid commercial license from Algoryx Simulation AB.
11 
12 Algoryx Simulation AB disclaims all responsibilities for loss or damage caused
13 from using this software, unless otherwise stated in written agreements with
14 Algoryx Simulation AB.
15 */
16 
17 #ifndef AGXMODEL_ONE_BODY_TIRE_H
18 #define AGXMODEL_ONE_BODY_TIRE_H
19 
20 #include <agxModel/export.h>
21 
22 #include <agxModel/Tire.h>
23 #include <agxSDK/Assembly.h>
24 #include <agxUtil/agxUtil.h>
25 
26 namespace agxModel
27 {
28  class TireConstraintImplementation;
29 
30 
32 
44  {
45  public:
55  OneBodyTire( agx::RigidBody* rigidBody, agx::Real radius, agx::Frame* referenceFrame=nullptr );
56 
61 
65  const agx::RigidBody* getRigidBody() const;
66 
67  // Only used for external queries
69  {
70  public:
72  ContactInfo(agx::RigidBody *body, agxCollide::LocalContactPointVector *contacts) : m_body(body), m_contacts(contacts) {}
73 
74  agx::RigidBody *getBody() { return m_body; }
76 
77  private:
78  agx::RigidBody *m_body;
80  };
81 
83 
85 
86  protected:
92  {
93  public:
95 
102  TireConstraintImplementation* getOrCreateConstraint( agx::RigidBody* rbTire, agx::RigidBody* rbOther );
103 
109  void prepare( const agx::Frame* refFrame, agx::Real radius );
110 
114  void finalize( agx::Real h );
115 
116  protected:
118  };
119 
121 
122  public:
124  protected:
125  virtual ~OneBodyTire();
126 
127  virtual void addNotification( agxSDK::Simulation* simulation ) override;
129  virtual void removeNotification( agxSDK::Simulation* simulation ) override;
131 
133  virtual void preCollide( const agx::TimeStamp& );
134  virtual void pre( const agx::TimeStamp& );
135  virtual void post( const agx::TimeStamp& );
136 
142 
143  protected:
146 
151  agx::Vector<ContactInfo> m_contacts; // Only used for external queries
152  };
153 }
154 
155 #endif // AGXMODEL_ONE_BODY_TIRE_H
#define AGX_DECLARE_POINTER_TYPES(type)
Definition: Referenced.h:248
#define AGXSTREAM_DECLARE_SERIALIZABLE(T)
Use this in a Serializable class to add the required methods Important: Use full namespace in the dec...
Definition: Serializable.h:207
#define AGXMODEL_EXPORT
A contact between two geometries.
Definition: Contacts.h:270
ContactInfo(agx::RigidBody *body, agxCollide::LocalContactPointVector *contacts)
Definition: OneBodyTire.h:72
agxCollide::LocalContactPointVector * getContactPoints()
Definition: OneBodyTire.h:75
Class holding the constraints between ONE tire and an arbitrary number of other bodies.
Definition: OneBodyTire.h:92
void finalize(agx::Real h)
Clears and collects values that are used over time.
void prepare(const agx::Frame *refFrame, agx::Real radius)
All sub-constraints will be created.
TireConstraintImplementation * getOrCreateConstraint(agx::RigidBody *rbTire, agx::RigidBody *rbOther)
Creates and initializes a constraint between the two bodies, or returns an already existing tire cons...
virtual void addNotification(agxSDK::Simulation *simulation) override
Called when this assembly is added to a simulation (given that it not already is in the simulation).
agx::RigidBody * getRigidBody()
virtual agxSDK::ContactEventListener::KeepContactPolicy impact(const agx::TimeStamp &, agxCollide::GeometryContact *gc)
Definition: OneBodyTire.h:138
agx::ref_ptr< TireConstraintController > TireConstraintControllerRef
Definition: OneBodyTire.h:120
const agx::RigidBody * getRigidBody() const
virtual agxSDK::ContactEventListener::KeepContactPolicy contact(const agx::TimeStamp &, agxCollide::GeometryContact *gc)
Definition: OneBodyTire.h:139
agx::Vector< ContactInfo > ContactInfoVector
Definition: OneBodyTire.h:82
TireConstraintControllerRef m_constraintController
Definition: OneBodyTire.h:150
virtual void separation(const agx::TimeStamp &, agxCollide::GeometryPair &)
Definition: OneBodyTire.h:140
agx::Vector< ContactInfo > m_contacts
Definition: OneBodyTire.h:151
agx::ref_ptr< agxUtil::GeneralStepListener< OneBodyTire > > m_stepCallback
Definition: OneBodyTire.h:144
virtual agxSDK::ContactEventListener::KeepContactPolicy handleContact(agxCollide::GeometryContact *gc)
agx::RigidBodyRef m_rigidBody
Definition: OneBodyTire.h:147
virtual void preCollide(const agx::TimeStamp &)
agx::FrameRef m_refFrame
Definition: OneBodyTire.h:149
OneBodyTire(agx::RigidBody *rigidBody, agx::Real radius, agx::Frame *referenceFrame=nullptr)
Construct tire given rigid body (with wheel geometry/geometries) and radius.
virtual void pre(const agx::TimeStamp &)
agx::ref_ptr< agxUtil::GeneralContactEventListener< OneBodyTire > > m_contactCallback
Definition: OneBodyTire.h:145
const ContactInfoVector & getContacts()
virtual void removeNotification(agxSDK::Simulation *)
Called when this assembly is removed from a simulation.
Definition: Assembly.h:618
virtual void addNotification(agxSDK::Simulation *)
Called when this assembly is added to a simulation (given that it not already is in the simulation).
Definition: Assembly.h:613
KeepContactPolicy
Defines whether contact should be kept or removed after contact/impact methods returns.
Simulation is a class that bridges the collision space agxCollide::Space and the dynamic simulation s...
Definition: Simulation.h:127
virtual void post(const agx::TimeStamp &time)
Called after a step is taken in the simulation Implement this method in the derived class to get call...
Utility class to hold custom implementations of constraints.
Definition: agxUtil.h:464
Utility class to get contact event callbacks to any class having the methods implemented.
Definition: agxUtil.h:573
Utility class to get step event callbacks to any class having the methods implemented.
Definition: agxUtil.h:525
The object defining a frame of reference and providing transformations operations.
Definition: agx/Frame.h:68
The rigid body class, combining a geometric model and a frame of reference.
Definition: RigidBody.h:55
Templated vector class.
Definition: agx/Vector.h:53
agx::SymmetricPair< agx::Physics::GeometryPtr > GeometryPair
Definition: Geometry.h:66
Contain classes for higher level modeling primitives, such as Tree, Terrain etc.
Definition: FlowUnit.h:37
double Real
Definition: Real.h:42
agx::Real TimeStamp
Definition: TimeStamp.h:26