AGXDynamics  2.35.0.2
Winch.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 <agxWire/Wire.h>
20 #include <agxWire/Link.h>
21 
22 namespace agxWire
23 {
31  {
32  public:
38  Winch( agx::RigidBody* rb, const agx::Vec3& relativeTranslate, const agx::Vec3& relativeNormal, agx::Real pulledInLength = agx::Real( 0 ) );
39 
47  agx::Bool add( agxWire::Wire* wire, agx::Real length );
48 
53  agx::Bool remove( const agxWire::Wire* wire );
54 
58  agx::UInt getNumPulledInWires() const;
59 
68  agx::Real getTotalPulledInLength() const;
69 
77  agx::Real findRestLength( const agxWire::Wire* wire ) const;
78 
80  public:
82 
84 
85  protected:
90  {
94  static WireLength invalid() { return WireLength( nullptr, agx::Real( -1 ) ); }
95 
99  WireLength( agxWire::Wire* w, agx::Real len ) : wire( w ), length( len ) {}
100 
104  agx::Bool isValid() const { return wire != nullptr && length >= agx::Real( 0 ); }
105 
108  };
109 
110  protected:
112 
113  protected:
117  Winch();
118 
122  virtual ~Winch();
123 
127  virtual bool getForceGeometryListEmpty( bool begin ) const override;
128 
132  virtual void addNotification( agxSDK::SimulationProxy* simulationProxy ) override;
133 
138  virtual void preUpdate( agx::Bool begin, agxSDK::SimulationProxy* simulationProxy ) override;
139 
140  protected:
141  friend class LinkWinchSliderAlgorithm;
146  virtual agx::Bool pullInWire( agxWire::Winch::WireLength nearWireAndLength, agxWire::LinkRef link, agxWire::WireRef farWire, agxSDK::SimulationProxy* simulationProxy );
147 
148  friend class LinkWinchIdleAlgorithm;
152  virtual agxWire::Winch::WireLength pullOutWire( agxWire::LinkRef link, agxWire::WireRef farWire, agxSDK::SimulationProxy* simulationProxy );
153 
154  friend class WinchWireInitializationController;
158  virtual void transfer( agxWire::ILinkNode* linkNode, agxWire::WireDistanceCompositeConstraint* wireConstraint, agxWire::WireParameterController* parameters, agxWire::WireStabilityController* stabilityController, agx::Bool begin );
159 
164  virtual void manipulatePulledInLength( agx::Real newPulledInLength );
165 
166  protected:
170  agx::Bool replaceLink( agxWire::Wire* farWire, agxWire::Link* link );
171 
176  agxWire::Winch::WireLength getAndEraseFromPulledInWires( const agxWire::ConnectingNode* connectingNode );
177 
182  agxWire::Winch::WireLength getAndEraseFromPulledInWires( const agxWire::Wire* wire );
183 
187  void initializePulledInLinks( agxSDK::SimulationProxy* simulationProxy );
188 
192  void handleApproachingNodes( agx::Bool begin, agx::Real dt );
193 
194  protected:
196  };
197 
199 }
200 
201 
agxWire::Winch::WireLength::invalid
static WireLength invalid()
Definition: Winch.h:94
agx::Real
double Real
Definition: Real.h:42
agx::Vector< WireLength >
agx::RigidBody
The rigid body class, combining a geometric model and a frame of reference.
Definition: RigidBody.h:54
DOXYGEN_END_INTERNAL_BLOCK
#define DOXYGEN_END_INTERNAL_BLOCK()
Definition: macros.h:97
Wire.h
DOXYGEN_START_INTERNAL_BLOCK
#define DOXYGEN_START_INTERNAL_BLOCK()
Definition: macros.h:96
agxWire::Winch::WireLength::wire
agxWire::WireRef wire
Definition: Winch.h:106
agxWire::Wire
Interface and placeholder of controllers/helpers for wires.
Definition: Wire.h:61
agxWire::Winch::WireLength::length
agx::Real length
Definition: Winch.h:107
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
AGXPHYSICS_EXPORT
#define AGXPHYSICS_EXPORT
agxWire::Winch::m_pulledInWires
PulledInWiresContainer m_pulledInWires
Definition: Winch.h:195
agxWire::Winch::WireLength
Internal data to store the inactive wire and the length of that wire.
Definition: Winch.h:89
agx::begin
LinearProbingHashSetImplementation< KeyT, HashT >::iterator begin(LinearProbingHashSetImplementation< KeyT, HashT > &set)
Definition: LinearProbingHashSet.h:606
agx::ref_ptr< Wire >
agxWire
Implements a Wire model with adaptive resolution.
Definition: MergedBody.h:39
agxWire::ConnectingNode
Connecting nodes contains two nodes, one at center of mass and the other at the user defined position...
Definition: agxWire/Node.h:1557
agxWire::WireParameterController
Class to hold specific parameters for the wire - this makes the wires highly configurable.
Definition: WireParameterController.h:37
agxWire::WinchRef
agx::ref_ptr< Winch > WinchRef
Definition: Winch.h:198
agxWire::Winch::PulledInWiresContainer
agx::Vector< WireLength > PulledInWiresContainer
Definition: Winch.h:111
agx::UInt
uint32_t UInt
Definition: Integer.h:34
agx::Bool
bool Bool
Definition: Integer.h:48
agxWire::Winch::WireLength::isValid
agx::Bool isValid() const
Definition: Winch.h:104
agx::Vec3T< Real >
agxWire::Winch
Winch object which works like agxWire::WireWinchController but enables the features of having stored,...
Definition: Winch.h:30
agxWire::ILinkNode
Interface class for nodes connected to links.
Definition: ILinkNode.h:28
agxWire::Winch::WireLength::WireLength
WireLength(agxWire::Wire *w, agx::Real len)
Construct given a wire and a length.
Definition: Winch.h:99
agxWire::WireWinchController
Winch class for handling in and out hauling of wires.
Definition: WireWinchController.h:41
agxSDK::SimulationProxy
Interface class used by internal objects running in parallel.
Definition: SimulationProxy.h:49