AGX Dynamics  2.37.3.2
Winch.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 <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:
195  PulledInWiresContainer m_pulledInWires;
196  };
197 
199 }
200 
201 
Winch object which works like agxWire::WireWinchController but enables the features of having stored...
Definition: Winch.h:30
agxWire::WireRef wire
Definition: Winch.h:106
Connecting nodes contains two nodes, one at center of mass and the other at the user defined position...
bool Bool
Definition: Integer.h:48
WireLength(agxWire::Wire *w, agx::Real len)
Construct given a wire and a length.
Definition: Winch.h:99
#define AGXPHYSICS_EXPORT
agx::Vector< WireLength > PulledInWiresContainer
Definition: Winch.h:111
Interface class for nodes connected to links.
Definition: ILinkNode.h:28
Interface and placeholder of controllers/helpers for wires.
Definition: Wire.h:61
uint32_t UInt
Definition: Integer.h:34
Implements a Wire model with adaptive resolution.
Definition: MergedBody.h:39
Internal data to store the inactive wire and the length of that wire.
Definition: Winch.h:89
agx::ref_ptr< Winch > WinchRef
Definition: Winch.h:198
Class to hold specific parameters for the wire - this makes the wires highly configurable.
LinearProbingHashSetImplementation< KeyT, HashT >::iterator begin(LinearProbingHashSetImplementation< KeyT, HashT > &set)
static WireLength invalid()
Definition: Winch.h:94
The rigid body class, combining a geometric model and a frame of reference.
Definition: RigidBody.h:54
#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
agx::Bool isValid() const
Definition: Winch.h:104
Interface class used by internal objects running in parallel.
Winch class for handling in and out hauling of wires.
double Real
Definition: Real.h:42
PulledInWiresContainer m_pulledInWires
Definition: Winch.h:195
#define DOXYGEN_END_INTERNAL_BLOCK()
Definition: Object.h:98
#define DOXYGEN_START_INTERNAL_BLOCK()
Definition: Object.h:97