AGX Dynamics  2.35.0.1
RotationalDimension.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 #ifndef AGXPOWERLINE_ROTATIONAL_DIMENSION_H
18 #define AGXPOWERLINE_ROTATIONAL_DIMENSION_H
19 
20 #include <agxModel/export.h>
22 #include <agxPowerLine/Connector.h>
24 
26 
27 #include <agxUtil/agxUtil.h>
28 
29 #include <agx/RigidBody.h>
31 #include <agx/Attachment.h>
32 
33 namespace agxPowerLine
34 {
35  #define DEFAULT_ROTATIONAL_DIRECTION agx::Vec3(0,1,0)
36 
37  class RotationalUnit;
46  {
47  public:
52 
57  agxPowerLine::Unit* unit,
58  agx::RigidBody* body,
59  agx::UInt8 slot);
60 
65  agxPowerLine::Unit* unit,
66  agx::RigidBody* body,
67  const agx::Vec3& direction,
68  agxPowerLine::DirectionReference directionReference,
69  bool externalBody = false);
70 
71 
75  virtual void renderDebug() override;
76 
80  virtual agx::Real getOutputLoad() const override;
83 
84 
88  virtual agx::Real getPowerIn() const override;
89  virtual agx::Real getPowerOut() const override;
90 
94  virtual agx::Real getMassProperty() const override;
96 
101  virtual bool setInertia( agx::Real value );
102 
106  virtual void setAngularVelocityDamping( agx::Real damping );
107 
111  virtual bool store(agxStream::StorageStream& out) const override;
112 
116  virtual bool restore(agxStream::StorageStream& in) override;
117 
119 
123  virtual std::string getTypeName() const override;
124 
130  static std::string getStaticTypeName();
131 
133 
134 
135 
136  protected:
137  friend class RotationalUnit;
138  void postUpdate(agx::Real timeStep);
139 
140  protected:
143  };
144 
146 
147 
148 
153  {
154  public:
159 
164 
169 
173  virtual bool store(agxStream::StorageStream& str) const override;
174 
178  virtual bool restore(agxStream::StorageStream& str) override;
179 
181 
182  protected:
184 
185  };
186 
188 
189 
190 
191 
196  {
197  public:
203 
207  virtual agx::Real variableLookupFunction( ) const override;
208 
212  virtual agx::Real resultScalerFunction( ) const override;
213 
217  virtual bool store(agxStream::StorageStream& str) const override;
218 
222  virtual bool restore(agxStream::StorageStream& str) override;
223 
225 
226  protected:
228  virtual ~TorqueGenerator();
229  virtual void applyPower() override;
231 
232  };
233 
234 }
235 
236 #endif // AGXMODEL_ROTATIONAL_DIMENSION_H
#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
Links two connections together.
Definition: Connector.h:54
Constraint implementation for constraining a number of physical dimensions of the same type.
Will generate power by adding a load to a physical dimension.
Defines a stiff gear constraint between two rotational dimensions.
RotationalConnector()
Create a connector between two rotational dimensions.
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 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 PhysicalDimensionMultiBodyConstraintImplementation * createConstraint() override
Create a gear constraint.
The rotational has one rotational degree of freedom.
virtual void renderDebug() override
Render the axis of the dimension.
virtual bool store(agxStream::StorageStream &out) const override
Stores internal data into stream.
RotationalDimension(agxPowerLine::Unit *unit, agx::RigidBody *body, agx::UInt8 slot)
Virtual function so that an instance can find its own name and not the name of the base class.
static std::string getStaticTypeName()
Each class inheriting from agxPowerLine::PhysicalDimension has to have a static function returning a ...
virtual std::string getTypeName() const override
Virtual function so that an instance can find its own name and not the name of the base class.
virtual agx::Real getOutputLoad() const override
void postUpdate(agx::Real timeStep)
virtual agx::Real getMassProperty() const override
virtual bool restore(agxStream::StorageStream &in) override
Restores internal data from stream.
RotationalDimension(agxPowerLine::Unit *unit, agx::RigidBody *body, const agx::Vec3 &direction, agxPowerLine::DirectionReference directionReference, bool externalBody=false)
Create a RotationalDimension whose direction can be relative to either the world or the body coordina...
virtual void setAngularVelocityDamping(agx::Real damping)
set the angular velocity damping.
virtual agx::Real getPowerOut() const override
static agxPowerLine::PhysicalDimension::Type getStaticType()
virtual bool setInertia(agx::Real value)
set the inertia of the rotational dimension.
virtual agx::Real getPowerIn() const override
RotationalDimension(Unit *unit)
Create a RotationalDimension with a direction relative to the world coordinate frame.
A rotational unit has one degree of freedom.
A torque generator adds torque to the body of a rotational dimension.
virtual bool restore(agxStream::StorageStream &str) override
Restores internal data from stream.
virtual void applyPower() override
Implement this to apply power each timestep.
agx::observer_ptr< RotationalDimension > m_rotationalDimension
TorqueGenerator(agxPowerLine::RotationalDimension *dimension)
Create a torque generator.
virtual bool store(agxStream::StorageStream &str) const override
Stores internal data into stream.
virtual agx::Real variableLookupFunction() const override
Finds the current RPM (and not angular velocity)
virtual agx::Real resultScalerFunction() const override
Implement this to scale lookups accordingly.
Pure virtual class.
Definition: Unit.h:73
Abstract base class for storing/restoring a line/drums with version control.
Definition: StorageStream.h:49
The rigid body class, combining a geometric model and a frame of reference.
Definition: RigidBody.h:55
Smart pointer for observed objects, that automatically set pointers to them to null when they deleted...
Definition: observer_ptr.h:61
agxPowerLine contains a collection of connected components that transport power across a system.
Definition: MotorUnit.h:24
DirectionReference
The DirectionReference specifies what the direction attribute of a DimensionState is relative to.
agx::ref_ptr< RotationalConnector > RotationalConnectorRef
agx::ref_ptr< RotationalDimension > RotationalDimensionRef
Definition: MotorUnit.h:26
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.
double Real
Definition: Real.h:42
uint8_t UInt8
Definition: Integer.h:38