AGX Dynamics 2.38.0.2
Loading...
Searching...
No Matches
TrackWheel.h
Go to the documentation of this file.
1/*
2Copyright 2007-2024. Algoryx Simulation AB.
3
4All AGX source code, intellectual property, documentation, sample code,
5tutorials, scene files and technical white papers, are copyrighted, proprietary
6and confidential material of Algoryx Simulation AB. You may not download, read,
7store, distribute, publish, copy or otherwise disseminate, use or expose this
8material unless having a written signed agreement with Algoryx Simulation AB, or having been
9advised so by Algoryx Simulation AB for a time limited evaluation, or having purchased a
10valid commercial license from Algoryx Simulation AB.
11
12Algoryx Simulation AB disclaims all responsibilities for loss or damage caused
13from using this software, unless otherwise stated in written agreements with
14Algoryx Simulation AB.
15*/
16
17#pragma once
18
19#include <agxVehicle/Wheel.h>
21
22#include <agx/MergedBody.h>
23
24namespace 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:
81 agx::Real radius,
83 agx::FrameRef rbRelFrame = nullptr );
84
100 agx::Real radius,
101 agx::RigidBody* rb,
102 agx::AffineMatrix4x4 rbRelTransform );
103
111
119 agx::Bool getControlPoints( agx::Real circleSegmentLength, ControlPointContainer& container ) const;
120
125
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
164
170
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:
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
221 inline const TrackWheel::Properties TrackWheel::getProperties() const
222 {
223 return m_properties;
224 }
225
226 inline agx::Bool TrackWheel::getEnableProperty( TrackWheel::Property property ) const
227 {
228 return m_properties.Is( property );
229 }
230
231 inline Track* TrackWheel::getTrack() const
232 {
233 return m_track;
234 }
235}
#define AGX_DECLARE_POINTER_TYPES(type)
Definition Referenced.h:254
#define AGXSTREAM_DECLARE_SERIALIZABLE(T)
Use this in a Serializable class to add the required methods Important: Use full namespace in the dec...
#define AGXVEHICLE_EXPORT
Simulation is a class that bridges the collision space agxCollide::Space and the dynamic simulation s...
Definition Simulation.h:126
Wheel used in tracked vehicles.
Definition TrackWheel.h:32
agx::Bool hasControlPoint(const agx::Vec3 &point, const agx::Real epsilon=agx::REAL_SQRT_EPSILON) const
agx::MergedBody * getOrCreateMergedBody(agxSDK::Simulation *simulation)
void setEnableProperty(Property property, agx::Bool enable)
Enable/disable a property for this wheel.
agx::UIntVector findMergedNodesIndices() const
List of node indices merged to this wheel.
agx::Bool getControlPoints(agx::Real circleSegmentLength, ControlPointContainer &container) const
Creates a set of points defining the wheel circle, each length circleSegmentLength apart.
TrackWheel(Model model, agx::Real radius, agx::RigidBody *rb, agx::AffineMatrix4x4 rbRelTransform)
Construct given property (wheel type), radius, rigid body and transform defining wheel center,...
agx::BitState< Property, agx::UInt32 > Properties
Definition TrackWheel.h:63
IndexRangeContainer findMergedNodesIndexRanges() const
Finds merged nodes indices and splits the list into ranges where the indices aren't consecutive.
@ SPROCKET
Sprocket - geared driving wheel with default property MERGE_NODES.
Definition TrackWheel.h:36
@ IDLER
Idler - geared non-powered wheel with default property MERGE_NODES.
Definition TrackWheel.h:37
TrackWheel(Model model, agx::Real radius, agx::RigidBody *rb, agx::FrameRef rbRelFrame=nullptr)
Construct given property (wheel type), radius, rigid body and frame defining wheel center,...
Model getModel() const
ControlPointContainer getControlPoints(agx::Real circleSegmentLength) const
Creates a set of points defining the wheel circle, each length circleSegmentLength apart.
Assembly object representing a continuous track with a given number of shoes (nodes).
Abstraction of a wheel of arbitrary geometry.
Definition Wheel.h:38
Structure holding several "normal" rigid bodies.
Definition MergedBody.h:56
The rigid body class, combining a geometric model and a frame of reference.
Definition RigidBody.h:52
#define DOXYGEN_END_INTERNAL_BLOCK()
Definition macros.h:97
#define DOXYGEN_START_INTERNAL_BLOCK()
Definition macros.h:96
This namespace contains classes related to vehicles dynamics.
The agx namespace contains the dynamics/math part of the AGX Dynamics API.
uint32_t UInt32
Definition Integer.h:32
VectorPOD< Vec3 > Vec3Vector
bool Bool
Definition Integer.h:40
AGXCORE_EXPORT const Real REAL_SQRT_EPSILON
double Real
Definition Real.h:42