AGX Dynamics  2.37.2.0
OneBodyTire.h
Go to the documentation of this file.
1 /*
2 Copyright 2007-2024. 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 
60  agx::RigidBody* getRigidBody();
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 
84  const ContactInfoVector& getContacts();
85 
86  protected:
87  OneBodyTire();
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:
117  virtual ~TireConstraintController();
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 
150  TireConstraintControllerRef m_constraintController;
151  agx::Vector<ContactInfo> m_contacts; // Only used for external queries
152  };
153 }
154 
155 #endif // AGXMODEL_ONE_BODY_TIRE_H
agx::ref_ptr< agxUtil::GeneralStepListener< OneBodyTire > > m_stepCallback
Definition: OneBodyTire.h:144
virtual agxSDK::ContactEventListener::KeepContactPolicy impact(const agx::TimeStamp &, agxCollide::GeometryContact *gc)
Definition: OneBodyTire.h:138
Utility class to hold custom implementations of constraints.
Definition: agxUtil.h:463
Utility class to get step event callbacks to any class having the methods implemented.
Definition: agxUtil.h:524
agx::SymmetricPair< agx::Physics::GeometryPtr > GeometryPair
Definition: Geometry.h:66
ContactInfo(agx::RigidBody *body, agxCollide::LocalContactPointVector *contacts)
Definition: OneBodyTire.h:72
agxCollide::LocalContactPointVector * getContactPoints()
Definition: OneBodyTire.h:75
agx::Vector< ContactInfo > m_contacts
Definition: OneBodyTire.h:151
virtual void removeNotification(agxSDK::Simulation *)
Called when this assembly is removed from a simulation.
Definition: Assembly.h:621
Class holding the constraints between ONE tire and an arbitrary number of other bodies.
Definition: OneBodyTire.h:91
A contact between two geometries.
Definition: Contacts.h:270
#define AGX_DECLARE_POINTER_TYPES(type)
Definition: Referenced.h:254
agx::Real TimeStamp
Definition: TimeStamp.h:26
Contain classes for higher level modeling primitives, such as Tree, Terrain etc.
Definition: FlowUnit.h:36
Templated vector class.
Definition: Vector.h:52
TireConstraintControllerRef m_constraintController
Definition: OneBodyTire.h:150
agx::RigidBodyRef m_rigidBody
Definition: OneBodyTire.h:147
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...
agx::FrameRef m_refFrame
Definition: OneBodyTire.h:149
KeepContactPolicy
Defines whether contact should be kept or removed after contact/impact methods returns.
The rigid body class, combining a geometric model and a frame of reference.
Definition: RigidBody.h:54
The object defining a frame of reference and providing transformations operations.
Definition: Frame.h:67
#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
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:616
agx::ref_ptr< TireConstraintController > TireConstraintControllerRef
Definition: OneBodyTire.h:120
agx::Vector< ContactInfo > ContactInfoVector
Definition: OneBodyTire.h:82
Simulation is a class that bridges the collision space agxCollide::Space and the dynamic simulation s...
Definition: Simulation.h:126
virtual void separation(const agx::TimeStamp &, agxCollide::GeometryPair &)
Definition: OneBodyTire.h:140
#define AGXMODEL_EXPORT
virtual agxSDK::ContactEventListener::KeepContactPolicy contact(const agx::TimeStamp &, agxCollide::GeometryContact *gc)
Definition: OneBodyTire.h:139
double Real
Definition: Real.h:42
agx::ref_ptr< agxUtil::GeneralContactEventListener< OneBodyTire > > m_contactCallback
Definition: OneBodyTire.h:145
virtual void pre(const agx::TimeStamp &time)
Called before a step is taken in the simulation Implement this method in the derived class to get cal...
virtual void preCollide(const agx::TimeStamp &time)
Called before collision detection is performed in the simulation Implement this method in the derived...
Utility class to get contact event callbacks to any class having the methods implemented.
Definition: agxUtil.h:572