AGX Dynamics  2.35.0.1
Differential.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 <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
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:
67 
68 
69  };
70 
72 
73 
74 
79  {
80  public:
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 
109 
113  void setLock(bool enable);
114 
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 
147 
148  private:
149  agx::Bool m_locked;
150  agx::Real m_limitedSlipTorque;
151  };
153 
154 }
#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
#define AGXMODEL_EXPORT
Connector for locking of the differential.
Definition: Differential.h:41
virtual bool store(agxStream::StorageStream &str) const override
Stores internal data into stream.
virtual bool restore(agxStream::StorageStream &str) override
Restores internal data from stream.
virtual void initConstraint() override
DifferentialLockConnector()
Lock connector between the outputs for the differential.
A differential for distributing the torque evenly between an arbitrary number of output shafts.
Definition: Differential.h:79
bool getLimitedSlipTorqueEnabled() const
UnitObserverSidePairVector m_children
Definition: Differential.h:146
void setLock(bool enable)
enable/disable the differential lock
Differential()
Create a differential.
virtual bool store(agxStream::StorageStream &str) const override
Stores internal data into stream.
virtual bool connect(agxPowerLine::Side mySide, agxPowerLine::Side unitSide, agxPowerLine::Unit *unit) override
virtual bool removeNotification(agxUtil::ConstraintHolder *holder, agxSDK::Simulation *simulation) override
Function called by a static function.
virtual agx::RegularizationParameters::VariableType calculateComplianceAndDamping(const agx::Real timeStep, agx::Real &compliance, agx::Real &damping) override
Calculate a compliance that will result in the wanted efficiency.
virtual void getConnectorsRecursive(agxPowerLine::ConnectorPtrVector &connectors) override
Fill the given vector with the Connectors that are held by this SubGraph.
virtual bool restore(agxStream::StorageStream &str) override
Restores internal data from stream.
void setLimitedSlipTorque(agx::Real limitedSlipTorque)
By setting the limited slip torque, the lock will no longer hold infinite torque.
agx::Vector< agxDriveTrain::DifferentialLockConnectorRef > m_diffLockConnectors
Definition: Differential.h:145
virtual bool disconnect(agxPowerLine::Unit *unit) override
Disconnect the given unit from this Connector.
void removeDiffLockConnector(size_t connectorIndex)
A gear is a connector between two rotational units.
Definition: Gear.h:35
virtual bool connect(agxPowerLine::Unit *unit)
Connect a unit to this Connector.
virtual bool disconnect()
Defines a stiff gear constraint between two rotational dimensions.
Pure virtual class.
Definition: Unit.h:73
Simulation is a class that bridges the collision space agxCollide::Space and the dynamic simulation s...
Definition: Simulation.h:127
Abstract base class for storing/restoring a line/drums with version control.
Definition: StorageStream.h:49
Utility class to hold custom implementations of constraints.
Definition: agxUtil.h:464
Smart pointer for handling referenced counted objects.
Definition: ref_ptr.h:30
A library of agxPowerLine components designed to model the various parts of a vehicle drive train.
agx::ref_ptr< Differential > DifferentialRef
Definition: Differential.h:152
agx::Vector< UnitObserverSidePair > UnitObserverSidePairVector
Definition: Differential.h:33
agx::ref_ptr< DifferentialLockConnector > DifferentialLockConnectorRef
Definition: Differential.h:71
std::pair< agx::observer_ptr< agxPowerLine::Unit >, agxPowerLine::Side > UnitObserverSidePair
Definition: Differential.h:32
The agxUtil namespace contain classes and methods for utility functionality.
bool Bool
Definition: Integer.h:48
double Real
Definition: Real.h:42