AGX Dynamics  2.37.2.0
TrackWheel.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 #pragma once
18 
19 #include <agxVehicle/Wheel.h>
20 #include <agxVehicle/TrackNode.h>
21 
22 #include <agx/MergedBody.h>
23 
24 namespace agxVehicle
25 {
27 
32  {
33  public:
34  enum Model
35  {
38  ROLLER
39  };
40 
42  {
43  MERGE_NODES = 1 << 0,
45  SPLIT_SEGMENTS = 1 << 2,
48  MOVE_NODES_TO_ROTATION_PLANE = 1 << 3,
52  MOVE_NODES_TO_WHEEL = 1 << 4
55  };
56 
57  public:
58 #ifndef SWIG
60 #else
62 #endif
63  using Properties = agx::BitState<Property, agx::UInt32>;
64 
65  public:
80  TrackWheel( Model model,
81  agx::Real radius,
82  agx::RigidBody* rb,
83  agx::FrameRef rbRelFrame = nullptr );
84 
99  TrackWheel( Model model,
100  agx::Real radius,
101  agx::RigidBody* rb,
102  agx::AffineMatrix4x4 rbRelTransform );
103 
110  ControlPointContainer getControlPoints( agx::Real circleSegmentLength ) const;
111 
119  agx::Bool getControlPoints( agx::Real circleSegmentLength, ControlPointContainer& container ) const;
120 
124  agx::Bool hasControlPoint( const agx::Vec3& point, const agx::Real epsilon = agx::REAL_SQRT_EPSILON ) const;
125 
129  Model getModel() const;
130 
134  template<typename... ModelTypes>
135  agx::Bool isModel( ModelTypes... modelTypes ) const;
136 
140  const Properties getProperties() const;
141 
147  void setEnableProperty( Property property, agx::Bool enable );
148 
153  agx::Bool getEnableProperty( Property property ) const;
154 
158  agx::MergedBody* getMergedBody() const;
159 
163  agx::MergedBody* getOrCreateMergedBody( agxSDK::Simulation* simulation );
164 
169  agx::UIntVector findMergedNodesIndices() const;
170 
178  IndexRangeContainer findMergedNodesIndexRanges() const;
179 
183  agxVehicle::Track* getTrack() const;
184 
185  public:
187 
189 
190  virtual void onAdd( Track* track );
191  virtual void onRemove( Track* track );
192 
194 
195  protected:
196  TrackWheel();
197  virtual ~TrackWheel();
198 
199  private:
200  Model m_model;
201  Properties m_properties;
202  agx::MergedBodyRef m_mergedBody;
203  Track* m_track;
204  };
205 
206  inline agx::MergedBody* TrackWheel::getMergedBody() const
207  {
208  return m_mergedBody;
209  }
210 
211  template<typename... ModelTypes>
212  inline agx::Bool TrackWheel::isModel( ModelTypes... modelTypes ) const
213  {
214  std::array<Model, sizeof... (ModelTypes)> args = { {modelTypes...} };
215  for ( const auto arg : args )
216  if ( arg == m_model )
217  return true;
218  return false;
219  }
220 
222  {
223  return m_properties;
224  }
225 
227  {
228  return m_properties.Is( property );
229  }
230 
231  inline Track* TrackWheel::getTrack() const
232  {
233  return m_track;
234  }
235 }
Abstraction of a wheel of arbitrary geometry.
Definition: Wheel.h:37
#define AGXVEHICLE_EXPORT
agxVehicle::Track * getTrack() const
Definition: TrackWheel.h:231
Wheel used in tracked vehicles.
Definition: TrackWheel.h:31
bool Bool
Definition: Integer.h:48
AGXCORE_EXPORT Model * getModel(const Path &path, const Path &_namespace=Path())
Definition: Object.h:363
agx::BitState< Property, agx::UInt32 > Properties
Definition: TrackWheel.h:63
#define AGX_DECLARE_POINTER_TYPES(type)
Definition: Referenced.h:254
VectorPOD< Vec3 > Vec3Vector
Structure holding several "normal" rigid bodies.
Definition: MergedBody.h:55
agx::Bool getEnableProperty(Property property) const
Definition: TrackWheel.h:226
const Properties getProperties() const
Definition: TrackWheel.h:221
The agx namespace contains the dynamics/math part of the AGX Dynamics API.
agx::ref_ptr< MergedBody > MergedBodyRef
Definition: MergedBody.h:46
AGXCORE_EXPORT const Real REAL_SQRT_EPSILON
The rigid body class, combining a geometric model and a frame of reference.
Definition: RigidBody.h:54
Sprocket - geared driving wheel with default property MERGE_NODES.
Definition: TrackWheel.h:36
This namespace contains classes related to vehicles dynamics.
#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
Simulation is a class that bridges the collision space agxCollide::Space and the dynamic simulation s...
Definition: Simulation.h:126
agx::Bool isModel(ModelTypes... modelTypes) const
Definition: TrackWheel.h:212
double Real
Definition: Real.h:42
Idler - geared non-powered wheel with default property MERGE_NODES.
Definition: TrackWheel.h:37
uint32_t UInt32
Definition: Integer.h:40
#define DOXYGEN_END_INTERNAL_BLOCK()
Definition: Object.h:98
#define DOXYGEN_START_INTERNAL_BLOCK()
Definition: Object.h:97
Assembly object representing a continuous track with a given number of shoes (nodes).