AGX Dynamics  2.35.0.1
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 
48 
53  agx::Bool remove( const agxWire::Wire* wire );
54 
59 
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;
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:
171 
177 
183 
188 
193 
194  protected:
196  };
197 
199 }
200 
201 
#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 AGXPHYSICS_EXPORT
Interface class used by internal objects running in parallel.
Connecting nodes contains two nodes, one at center of mass and the other at the user defined position...
Interface class for nodes connected to links.
Definition: ILinkNode.h:29
Winch object which works like agxWire::WireWinchController but enables the features of having stored,...
Definition: Winch.h:31
agx::Bool replaceLink(agxWire::Wire *farWire, agxWire::Link *link)
Pulling in a wire, replaces link's far node with this winch.
agx::UInt getNumPulledInWires() const
virtual agxWire::Winch::WireLength pullOutWire(agxWire::LinkRef link, agxWire::WireRef farWire, agxSDK::SimulationProxy *simulationProxy)
Pulls out a new wire segment, if any inactive wire is connected to the link.
agx::Bool add(agxWire::Wire *wire, agx::Real length)
Add inactive wire segment with a given length.
agxWire::Winch::WireLength getAndEraseFromPulledInWires(const agxWire::Wire *wire)
Returns that wire including its length.
PulledInWiresContainer m_pulledInWires
Definition: Winch.h:195
virtual agx::Bool pullInWire(agxWire::Winch::WireLength nearWireAndLength, agxWire::LinkRef link, agxWire::WireRef farWire, agxSDK::SimulationProxy *simulationProxy)
Pull in the near wire completely.
Winch()
Protected default constructor, used during restore.
virtual bool getForceGeometryListEmpty(bool begin) const override
virtual ~Winch()
Reference counted object, protected destructor.
virtual void addNotification(agxSDK::SimulationProxy *simulationProxy) override
Initializes the inactive links.
agx::Vector< WireLength > PulledInWiresContainer
Definition: Winch.h:111
agx::Real getTotalPulledInLength() const
Calculates the total pulled in length, including the pulled in length of the currently active wire (i...
virtual void transfer(agxWire::ILinkNode *linkNode, agxWire::WireDistanceCompositeConstraint *wireConstraint, agxWire::WireParameterController *parameters, agxWire::WireStabilityController *stabilityController, agx::Bool begin)
Transfers this winch from far wire to a newly created near wire.
virtual void preUpdate(agx::Bool begin, agxSDK::SimulationProxy *simulationProxy) override
Checks for 'forced brake condition' where the winch is automatically stopped due to an unsupported ap...
agx::Real findRestLength(const agxWire::Wire *wire) const
Finds rest length of wire if this winch is either attached to wire or when wire is completely pulled ...
void handleApproachingNodes(agx::Bool begin, agx::Real dt)
Handles the approaching nodes during preUpdate.
agx::Bool remove(const agxWire::Wire *wire)
Remove an inactive wire segment.
Winch(agx::RigidBody *rb, const agx::Vec3 &relativeTranslate, const agx::Vec3 &relativeNormal, agx::Real pulledInLength=agx::Real(0))
Construct given rigid body, relative translate (rigid body frame), relative normal (rigid body frame)...
agxWire::Winch::WireLength getAndEraseFromPulledInWires(const agxWire::ConnectingNode *connectingNode)
Finds the wire the connection node matches and returns that wire including its length.
virtual void manipulatePulledInLength(agx::Real newPulledInLength)
Other friend objects have the possibility to manipulate the pulled in length of the current segment.
void initializePulledInLinks(agxSDK::SimulationProxy *simulationProxy)
Initializes the inactive links when this winch is added to the simulation.
Class to hold specific parameters for the wire - this makes the wires highly configurable.
Winch class for handling in and out hauling of wires.
Interface and placeholder of controllers/helpers for wires.
Definition: Wire.h:62
The rigid body class, combining a geometric model and a frame of reference.
Definition: RigidBody.h:55
#define DOXYGEN_END_INTERNAL_BLOCK()
Definition: macros.h:97
#define DOXYGEN_START_INTERNAL_BLOCK()
Definition: macros.h:96
Implements a Wire model with adaptive resolution.
Definition: MergedBody.h:40
agx::ref_ptr< Winch > WinchRef
Definition: Winch.h:198
bool Bool
Definition: Integer.h:48
LinearProbingHashSetImplementation< KeyT, HashT >::iterator begin(LinearProbingHashSetImplementation< KeyT, HashT > &set)
uint32_t UInt
Definition: Integer.h:34
double Real
Definition: Real.h:42
Internal data to store the inactive wire and the length of that wire.
Definition: Winch.h:90
WireLength(agxWire::Wire *w, agx::Real len)
Construct given a wire and a length.
Definition: Winch.h:99
static WireLength invalid()
Definition: Winch.h:94
agx::Bool isValid() const
Definition: Winch.h:104
agxWire::WireRef wire
Definition: Winch.h:106