AGX Dynamics  2.35.0.1
MultiGear.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/Connector.h>
20 
21 #include <agxDriveTrain/Gear.h>
22 #include <agxDriveTrain/Shaft.h>
23 
24 #include <agx/Vector.h>
25 
26 #include <agxModel/export.h>
27 
28 
29 namespace agxDriveTrain
30 {
32 
41  {
42  public:
44 
53  bool connect(agxPowerLine::Unit* unit, agx::Real gearRatio);
54 
62  virtual bool connect(agxPowerLine::Unit* unit) override;
63 
64  virtual bool connect(agxPowerLine::Side mySide, agxPowerLine::Side otherSide, agxPowerLine::Unit* otherUnit) override;
65 
72  virtual bool disconnect(agxPowerLine::Unit* unit) override;
73 
74 
83  bool setGearRatio(agxPowerLine::Unit* unit, agx::Real gearRatio);
84 
94 
95 
101 
102 
103  public: // Methods called by the rest of the PowerLine framework.
105 
106  using agxPowerLine::Connector::connect;
107  using agxPowerLine::Connector::disconnect;
108 
113  bool connect(
114  agxPowerLine::Side mySide,
115  agxPowerLine::Side unitSide,
116  agxPowerLine::Unit* unit,
117  agx::Real gearRatio);
118 
119 #ifndef SWIG
120  virtual agxPowerLine::PhysicalDimensionMultiBodyConstraintImplementation* createConstraint() override;
121 #endif
122 
124  virtual bool store(agxStream::StorageStream& out) const override;
125  virtual bool restore(agxStream::StorageStream& in) override;
126 
128  private:
129  agx::Vector<agxDriveTrain::GearRef> m_connections;
130  agxDriveTrain::ShaftRef m_internalShaft;
131  };
132 }
#define AGX_DECLARE_POINTER_TYPES(type)
Definition: Referenced.h:248
#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
A MultiGear is a type of gear connector that can have multiple connected shafts, each with its own ge...
Definition: MultiGear.h:41
virtual bool disconnect(agxPowerLine::Unit *unit) override
Disconnect the give unit from this MultiGear.
virtual bool connect(agxPowerLine::Side mySide, agxPowerLine::Side otherSide, agxPowerLine::Unit *otherUnit) override
virtual bool connect(agxPowerLine::Unit *unit) override
Connect the given unit with a gear ratio of 1.
const agxDriveTrain::Shaft * getInternalShaft() const
bool connect(agxPowerLine::Unit *unit, agx::Real gearRatio)
Connect the given unit to this MultiGear.
agxDriveTrain::Shaft * getInternalShaft()
bool setGearRatio(agxPowerLine::Unit *unit, agx::Real gearRatio)
Change the gear ratio for the given unit.
agx::Real getGearRatio(const agxPowerLine::Unit *unit) const
Returns the gear ratio with which the given unit is connected to this MultiGear.
A Shaft is the most basic PowerLine Unit.
Definition: Shaft.h:35
Links two connections together.
Definition: Connector.h:54
Constraint implementation for constraining a number of physical dimensions of the same type.
Pure virtual class.
Definition: Unit.h:73
Abstract base class for storing/restoring a line/drums with version control.
Definition: StorageStream.h:49
#define DOXYGEN_END_INTERNAL_BLOCK()
Definition: macros.h:97
#define DOXYGEN_START_INTERNAL_BLOCK()
Definition: macros.h:96
A library of agxPowerLine components designed to model the various parts of a vehicle drive train.
agxPowerLine contains a collection of connected components that transport power across a system.
Definition: MotorUnit.h:24
InputRef< T > in(const char *name, T &obj)
Create an object with a name and a reference to the object that should be restored (usually a pointer...
Definition: InputArchive.h:400
OutputRef< Serializable > out(const char *name, const Serializable *obj)
Return an object that contain the name and the object that should be serialized to an archive.
The agx namespace contains the dynamics/math part of the AGX Dynamics API.
double Real
Definition: Real.h:42