AGX Dynamics  2.37.2.0
Differential.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 <agxPowerLine/PowerLine.h>
21 
22 #include <agxDriveTrain/Gear.h>
23 
24 namespace agxUtil
25 {
26  class ConstraintHolder;
27 }
28 
29 
30 namespace agxDriveTrain
31 {
32  typedef std::pair<agx::observer_ptr<agxPowerLine::Unit>, agxPowerLine::Side> UnitObserverSidePair;
34 
41  {
42  public:
47 
48  virtual void initConstraint( ) override;
49 
50 #ifndef SWIG
51 
54  virtual bool store( agxStream::StorageStream& str ) const override;
55 
59  virtual bool restore( agxStream::StorageStream& str ) override;
60 
61 
63 #endif
64 
65  protected:
66  virtual ~DifferentialLockConnector( );
67 
68 
69  };
70 
72 
73 
74 
79  {
80  public:
84  Differential();
85 
86  virtual bool connect(agxPowerLine::Side mySide, agxPowerLine::Side unitSide, agxPowerLine::Unit* unit) override;
87  virtual bool disconnect(agxPowerLine::Unit* unit) override;
88 
89  using Gear::connect;
90  using Gear::disconnect;
91 
98  void setLimitedSlipTorque( agx::Real limitedSlipTorque );
99 
103  bool getLockEnabled( ) const;
104 
108  bool getLimitedSlipTorqueEnabled( ) const;
109 
113  void setLock(bool enable);
114 
115  virtual agx::RegularizationParameters::VariableType calculateComplianceAndDamping(
116  const agx::Real timeStep, agx::Real& compliance, agx::Real& damping) override;
117 
118 
119 #if !defined(SWIG) && !defined(SWIG_CPPWRAPPER_BUILD)
120 
121  virtual void getConnectorsRecursive(agxPowerLine::ConnectorPtrVector& connectors) override;
122 
126  virtual bool removeNotification(agxUtil::ConstraintHolder* holder, agxSDK::Simulation* simulation) override;
127 
131  virtual bool store(agxStream::StorageStream& str) const override;
132 
136  virtual bool restore(agxStream::StorageStream& str) override;
137 
139 #endif
140 
141  protected:
142  virtual ~Differential();
143  void removeDiffLockConnector(size_t connectorIndex);
144 
146  UnitObserverSidePairVector m_children;
147 
148  private:
149  agx::Bool m_locked;
150  agx::Real m_limitedSlipTorque;
151  };
153 
154 }
agx::ref_ptr< Differential > DifferentialRef
Definition: Differential.h:152
Utility class to hold custom implementations of constraints.
Definition: agxUtil.h:463
bool Bool
Definition: Integer.h:48
Pure virtual class.
Definition: Unit.h:72
A library of agxPowerLine components designed to model the various parts of a vehicle drive train...
std::pair< agx::observer_ptr< agxPowerLine::Unit >, agxPowerLine::Side > UnitObserverSidePair
Definition: Differential.h:32
UnitObserverSidePairVector m_children
Definition: Differential.h:146
Defines a stiff gear constraint between two rotational dimensions.
Smart pointer for handling referenced counted objects.
Definition: ref_ptr.h:29
A gear is a connector between two rotational units.
Definition: Gear.h:34
agx::ref_ptr< DifferentialLockConnector > DifferentialLockConnectorRef
Definition: Differential.h:71
agx::Vector< agxDriveTrain::DifferentialLockConnectorRef > m_diffLockConnectors
Definition: Differential.h:145
Abstract base class for storing/restoring a line/drums with version control.
Definition: StorageStream.h:48
agx::Vector< UnitObserverSidePair > UnitObserverSidePairVector
Definition: Differential.h:33
#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
#define AGXMODEL_EXPORT
double Real
Definition: Real.h:42
Connector for locking of the differential.
Definition: Differential.h:40
A differential for distributing the torque evenly between an arbitrary number of output shafts...
Definition: Differential.h:78
The agxUtil namespace contain classes and methods for utility functionality.