AGXDynamics  2.35.0.3
TrackWheel.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 #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 }
agx::REAL_SQRT_EPSILON
const AGXCORE_EXPORT Real REAL_SQRT_EPSILON
agx::Real
double Real
Definition: Real.h:42
agx::RigidBody
The rigid body class, combining a geometric model and a frame of reference.
Definition: RigidBody.h:54
agxVehicle::TrackWheel::Model
Model
Definition: TrackWheel.h:34
DOXYGEN_END_INTERNAL_BLOCK
#define DOXYGEN_END_INTERNAL_BLOCK()
Definition: macros.h:97
agx::AffineMatrix4x4T< Real >
DOXYGEN_START_INTERNAL_BLOCK
#define DOXYGEN_START_INTERNAL_BLOCK()
Definition: macros.h:96
agxVehicle::Track
Assembly object representing a continuous track with a given number of shoes (nodes).
Definition: agxVehicle/Track.h:36
agxVehicle::TrackWheel::isModel
agx::Bool isModel(ModelTypes... modelTypes) const
Definition: TrackWheel.h:212
AGXSTREAM_DECLARE_SERIALIZABLE
#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
agxVehicle::TrackWheel::Properties
agx::BitState< Property, agx::UInt32 > Properties
Definition: TrackWheel.h:63
agx::VectorPOD< Vec3 >
agx
The agx namespace contains the dynamics/math part of the AGX Dynamics API.
Definition: AddedMassInteraction.h:22
agx::Vec3Vector
VectorPOD< Vec3 > Vec3Vector
Definition: agx_vector_types.h:58
agxVehicle::TrackWheel::getProperties
const Properties getProperties() const
Definition: TrackWheel.h:221
agxVehicle::TrackWheel::IDLER
@ IDLER
Idler - geared non-powered wheel with default property MERGE_NODES.
Definition: TrackWheel.h:37
agxVehicle::TrackWheel::Property
Property
Definition: TrackWheel.h:41
agx::ref_ptr< Frame >
agxSDK::Simulation
Simulation is a class that bridges the collision space agxCollide::Space and the dynamic simulation s...
Definition: Simulation.h:126
TrackNode.h
MergedBody.h
agx::MergedBodyRef
agx::ref_ptr< MergedBody > MergedBodyRef
Definition: MergedBody.h:46
agxVehicle
This namespace contains classes related to vehicles dynamics.
Definition: AckermannSteering.h:22
agxVehicle::TrackWheel::getTrack
agxVehicle::Track * getTrack() const
Definition: TrackWheel.h:231
AGX_DECLARE_POINTER_TYPES
#define AGX_DECLARE_POINTER_TYPES(type)
Definition: Referenced.h:248
agx::Bool
bool Bool
Definition: Integer.h:48
agxVehicle::TrackWheel
Wheel used in tracked vehicles.
Definition: TrackWheel.h:31
Wheel.h
AGXVEHICLE_EXPORT
#define AGXVEHICLE_EXPORT
Definition: agxVehicle/export.h:38
agx::Vec3T< Real >
agx::UInt32
uint32_t UInt32
Definition: Integer.h:40
agx::MergedBody
Structure holding several "normal" rigid bodies.
Definition: MergedBody.h:55
agx::getModel
AGXCORE_EXPORT Model * getModel(const Path &path, const Path &_namespace=Path())
Definition: Object.h:364
agxVehicle::Wheel
Abstraction of a wheel of arbitrary geometry.
Definition: Wheel.h:37
agxVehicle::TrackWheel::SPROCKET
@ SPROCKET
Sprocket - geared driving wheel with default property MERGE_NODES.
Definition: TrackWheel.h:36
agxVehicle::TrackWheel::getEnableProperty
agx::Bool getEnableProperty(Property property) const
Definition: TrackWheel.h:226