AGX Dynamics  2.38.0.2
RotationalDimension.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 <agxModel/export.h>
21 #include <agxPowerLine/Connector.h>
23 
25 
26 #include <agxUtil/agxUtil.h>
27 
28 #include <agx/RigidBody.h>
30 #include <agx/Attachment.h>
31 
32 namespace agxPowerLine
33 {
34  #define DEFAULT_ROTATIONAL_DIRECTION agx::Vec3(0,1,0)
35 
36  class RotationalUnit;
45  {
46  public:
51 
56  agxPowerLine::Unit* unit,
57  agx::RigidBody* body,
58  agx::UInt8 slot);
59 
64  agxPowerLine::Unit* unit,
65  agx::RigidBody* body,
66  const agx::Vec3& direction,
67  agxPowerLine::DirectionReference directionReference,
68  bool externalBody = false);
69 
70 
74  virtual void renderDebug() override;
75 
76  void setAngularVelocity(agx::Real);
77  agx::Real getAngularVelocity() const;
78 
82  virtual agx::Real getOutputLoad() const override;
83  agx::Real getOutputTorque() const;
84  agx::Real getInputTorque() const;
85 
86 
90  virtual agx::Real getPowerIn() const override;
91  virtual agx::Real getPowerOut() const override;
92 
96  virtual agx::Real getMassProperty() const override;
97  agx::Real getInertia() const;
98 
103  virtual bool setInertia( agx::Real value );
104 
108  virtual void setAngularVelocityDamping( agx::Real damping );
109 
113  virtual bool store(agxStream::StorageStream& out) const override;
114 
118  virtual bool restore(agxStream::StorageStream& in) override;
119 
121 
125  virtual std::string getTypeName() const override;
126 
132  static std::string getStaticTypeName();
133 
134  static agxPowerLine::PhysicalDimension::Type getStaticType();
135 
136 
137 
138  protected:
139  friend class RotationalUnit;
140  void postUpdate(agx::Real timeStep);
141 
142  protected:
144  virtual ~RotationalDimension();
145  };
146 
148 
149 
150 
155  {
156  public:
161 
165  virtual PhysicalDimensionMultiBodyConstraintImplementation* createConstraint() override;
166 
170  virtual agx::RegularizationParameters::VariableType calculateComplianceAndDamping( const agx::Real timeStep, agx::Real& compliance, agx::Real& damping) override;
171 
175  virtual bool store(agxStream::StorageStream& str) const override;
176 
180  virtual bool restore(agxStream::StorageStream& str) override;
181 
183 
184  protected:
185  virtual ~RotationalConnector();
186 
187  };
188 
190 
191 
192 
193 
198  {
199  public:
205 
209  virtual agx::Real variableLookupFunction( ) const override;
210 
214  virtual agx::Real resultScalerFunction( ) const override;
215 
219  virtual bool store(agxStream::StorageStream& str) const override;
220 
224  virtual bool restore(agxStream::StorageStream& str) override;
225 
227 
228  protected:
229  TorqueGenerator();
230  virtual ~TorqueGenerator();
231  virtual void applyPower() override;
233 
234  };
235 
236 }
agx::Real
double Real
Definition: Real.h:42
agx::RegularizationParameters::VariableType
VariableType
Definition: RegularizationParameters.h:32
agxStream::out
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.
Definition: OutputArchive.h:412
agx::RigidBody
The rigid body class, combining a geometric model and a frame of reference.
Definition: RigidBody.h:51
export.h
agxPowerLine::TorqueGenerator::m_rotationalDimension
agx::observer_ptr< RotationalDimension > m_rotationalDimension
Definition: RotationalDimension.h:232
agxPowerLine::PhysicalDimensionMultiBodyConstraintImplementation
Constraint implementation for constraining a number of physical dimensions of the same type.
Definition: PowerLineConstraints.h:149
agxStream::StorageStream
Abstract base class for storing/restoring a line/drums with version control.
Definition: StorageStream.h:48
StepEventListener.h
agxPowerLine::PhysicalDimension
Pure virtual class.
Definition: PhysicalDimension.h:92
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
agxPowerLine::PhysicalDimension::Type
int Type
Definition: PhysicalDimension.h:95
agx::observer_ptr
Smart pointer for observed objects, that automatically set pointers to them to null when they deleted...
Definition: observer_ptr.h:60
agxStream::in
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:399
agxPowerLine::RotationalDimensionRef
agx::ref_ptr< RotationalDimension > RotationalDimensionRef
Definition: MotorUnit.h:26
agxPowerLine::Unit
Pure virtual class.
Definition: Unit.h:71
agx::ref_ptr< RotationalDimension >
agx::UInt8
uint8_t UInt8
Definition: Integer.h:30
Connector.h
agxPowerLine::RotationalConnector
Defines a stiff gear constraint between two rotational dimensions.
Definition: RotationalDimension.h:154
agxPowerLine::RotationalDimension
The rotational has one rotational degree of freedom.
Definition: RotationalDimension.h:44
RigidBody.h
agxPowerLine
agxPowerLine contains a collection of connected components that transport power across a system.
Definition: MotorUnit.h:23
ElementaryConstraint.h
agxPowerLine::Connector
Links two connections together.
Definition: Connector.h:52
DirectionReference.h
AGXMODEL_EXPORT
#define AGXMODEL_EXPORT
Definition: agxModel/export.h:42
agxPowerLine::RotationalUnit
A rotational unit has one degree of freedom.
Definition: RotationalUnit.h:28
agxPowerLine::DirectionReference
DirectionReference
The DirectionReference specifies what the direction attribute of a DimensionState is relative to.
Definition: DirectionReference.h:25
agx::Vec3T< Real >
Attachment.h
agxPowerLine::PowerGenerator
Will generate power by adding a load to a physical dimension.
Definition: PowerLineUtils.h:186
agxPowerLine::TorqueGenerator
A torque generator adds torque to the body of a rotational dimension.
Definition: RotationalDimension.h:197
agxPowerLine::RotationalConnectorRef
agx::ref_ptr< RotationalConnector > RotationalConnectorRef
Definition: RotationalDimension.h:189
agxUtil.h
PhysicalDimension.h