AGX Dynamics 2.42.3.1
Loading...
Searching...
No Matches
agxWire::Winch Class Reference

Winch object which works like agxWire::WireWinchController but enables the features of having stored, inactive, wire segments inside of the winch which can be pulled out given a link. More...

#include <Winch.h>

+ Inheritance diagram for agxWire::Winch:

Classes

struct  WireLength
 Internal data to store the inactive wire and the length of that wire. More...
 

Public Member Functions

 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) and initial pulled in length.
 
agx::Bool add (agxWire::Wire *wire, agx::Real length)
 Add inactive wire segment with a given length.
 
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 in to this winch.
 
agx::UInt getNumPulledInWires () const
 
agx::Real getTotalPulledInLength () const
 Calculates the total pulled in length, including the pulled in length of the currently active wire (i.e., getPulledInlength()).
 
agx::Bool remove (const agxWire::Wire *wire)
 Remove an inactive wire segment.
 
- Public Member Functions inherited from agxWire::WireWinchController
 WireWinchController (agx::RigidBody *body, const agx::Vec3 &positionInBodyFrame, const agx::Vec3 &normalInBodyFrame, agx::Real pulledInLength=agx::Real(0))
 Construct this winch given position, normal and body this winch is attached to.
 
agx::Constraint1DOF * get1DOFConstraint ()
 Get pointer to Constraint1DOF.
 
const agx::Constraint1DOF * get1DOFConstraint () const
 
bool getAutoFeed () const
 
const agx::RangeReal & getBrakeForceRange () const
 
virtual agx::Real getCurrentBrakeForce () const
 
virtual agx::Real getCurrentForce () const
 
virtual agx::Real getCurrentSpeed () const
 
agxWire::BodyFixedNode * getFixedNode () const
 
const agx::RangeReal & getForceRange () const
 
agx::Vec3 getLumpNodeReferencePosition () const
 
const agx::Vec3 & getNormal () const
 
virtual agx::Real getPulledInWireLength () const
 
agx::RigidBody * getRigidBody () const
 
agx::Real getSpeed () const
 
agxWire::StopNode * getStopNode () const
 
bool getStopNodeInserted () const
 
agx::Real getStopNodeReferenceDistance () const
 
virtual bool getWithinEndRange () const
 
agx::Vec3 getWorldNormal () const
 
void setAutoFeed (bool autoFeed)
 Set auto feed to this winch.
 
void setBrakeForceRange (agx::RangeReal brakeForceRange)
 Set the desired brake force range where range::lower is the force in which this winch brake can hold the wire from hauling out and ranger::upper the brake force hold the wire from hauling in.
 
void setBrakeForceRange (agx::Real brakeForce)
 Same as setBrakeForceRange( agx::RangeReal brakeForceRange ) but this method will set range as [-brakeForce, brakeForce].
 
void setCompliance (agx::Prismatic *prismatic) const
 Sets the default compliance for the prismatic constraint.
 
void setForceRange (agx::RangeReal forceRange)
 Set the desired winch force where range::lower is the force in which this winch may haul in wire, range::upper haul out.
 
void setForceRange (agx::Real force)
 Same as setForceRange( agx::RangeReal forceRange ) but this method will set range as [-force, force].
 
void setParameterController (agxWire::WireParameterController *parameters)
 Associate a parameter controller to this winch.
 
void setPulledInWireLength (agx::Real pulledInLength)
 Set the pulled in length for this winch.
 
void setSpeed (agx::Real speed)
 Set winch motor speed.
 
void setStabilityController (agxWire::WireStabilityController *stabilityController)
 Associate a stability controller to this winch.
 
- Public Member Functions inherited from agxStream::Serializable
virtual ~Serializable ()
 Destructor for normal C++ use but hidden from SWIG bindings.
 
virtual const char * getClassName () const
 
bool getEnableSerialization () const
 
bool getEnableUuidGeneration ()
 
agx::UInt32 getIndex () const
 This index is given at creation of this object.
 
virtual StorageAgent * getStorageAgent () const =0
 
agx::Uuid getUuid () const
 
bool isFinished () const
 
void setEnableSerialization (bool flag)
 Set to false to disable serialization of this object.
 
void setFinished ()
 Tells this class that it is restored correctly and should not be deleted during destruction of an Archive.
 
void setUuid (const agx::Uuid &uuid)
 Explicitly set a Uuid on a serializable object.
 

Protected Types

typedef agx::Vector< WireLength > PulledInWiresContainer
 

Protected Member Functions

 Winch ()
 Protected default constructor, used during restore.
 
virtual ~Winch ()
 Reference counted object, protected destructor.
 
virtual void addNotification (agxSDK::SimulationProxy *simulationProxy) override
 Initializes the inactive links.
 
agxWire::Winch::WireLength getAndEraseFromPulledInWires (const agxWire::ConnectingNode *connectingNode)
 Finds the wire the connection node matches and returns that wire including its length.
 
agxWire::Winch::WireLength getAndEraseFromPulledInWires (const agxWire::Wire *wire)
 Returns that wire including its length.
 
virtual bool getForceGeometryListEmpty (bool begin) const override
 
void handleApproachingNodes (agx::Bool begin, agx::Real dt)
 Handles the approaching nodes during preUpdate.
 
void initializePulledInLinks (agxSDK::SimulationProxy *simulationProxy)
 Initializes the inactive links when this winch is added to the simulation.
 
virtual void manipulatePulledInLength (agx::Real newPulledInLength)
 Other friend objects have the possibility to manipulate the pulled in length of the current segment.
 
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 approaching node.
 
virtual agx::Bool pullInWire (agxWire::Winch::WireLength nearWireAndLength, agxWire::LinkRef link, agxWire::WireRef farWire, agxSDK::SimulationProxy *simulationProxy)
 Pull in the near wire completely.
 
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 replaceLink (agxWire::Wire *farWire, agxWire::Link *link)
 Pulling in a wire, replaces link's far node with this winch.
 
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.
 
- Protected Member Functions inherited from agxWire::WireWinchController
 WireWinchController ()
 Default constructor for serialization.
 
virtual ~WireWinchController ()
 
virtual void addNotification (agxSDK::SimulationProxy *)
 Called from Wire::addNotification.
 
virtual bool attach (WireDistanceCompositeConstraint *constraint, WireParameterController *parameters, bool begin)
 Create new nodes for new wire.
 
agx::Real configureInitialState ()
 This method will set the position of the lumped node given the stop node and pulled in length.
 
agx::Prismatic * createPrismatic (Node *fixedNode, Node *lumpedNode, const agx::Vec3 &worldNormal) const
 Creates a prismatic constraint given the fixed-, lumped node and a normal.
 
BodyFixedNode * findParametersHoldingNode (bool begin)
 Search the wire, given begin true of false, for the parameters holding node.
 
virtual void forcePulledInLength (agx::Real newLength)
 
BodyFixedNode * getNextLumpedNode (BodyFixedNode *from, bool begin)
 Finds the next (or previous) lumped node given a lumped node and the direction of the search.
 
virtual agx::Real getReferenceCurrentLength (bool begin) const override
 
virtual Node * getReferenceNode () override
 
virtual void incrementPulledInLength (agx::Real dl)
 
virtual void initialize (bool begin, WireParameterController *parameters) override
 Initializes this winch (inserts the stop node and move the lump for example).
 
bool insertStopNode (bool begin)
 Inserts the stop wire node in the wire.
 
void massUpdate (agx::Real restLengthChange, bool begin)
 Updates mass for lumped nodes where the rest length is changed by restLengthChange.
 
virtual bool owns (const Node *node) const override
 For the wire to know if node belongs to this attachment.
 
virtual void postUpdate (agx::Bool, agxSDK::SimulationProxy *)
 Post update call from the wire.
 
virtual void preCollideUpdate (agx::Bool, agxSDK::SimulationProxy *)
 Pre-collide update call from the wire.
 
virtual void preUpdate (agx::Bool, agxSDK::SimulationProxy *)
 Pre update call from the wire.
 
agx::Real resetLumpPosition (agx::Real angle)
 Resets the lump position to reference.
 
virtual void unitialize ()
 Forgets about all wire parameters and clears the constraint.
 
virtual void update (Node *controlledNode, Node *lumpedNode, bool begin) override
 Called when it's time to update the constraint and reset the position of the lump.
 
void updateConstraintSettings (agx::Prismatic *prismatic, agx::Real desiredSpeed, const agx::RangeReal &forceRange, const agx::RangeReal &brakeRange, bool rangeEnable, bool forcedBrake=false) const
 Updates motor, lock and range parameters.
 
- Protected Member Functions inherited from agxStream::Serializable
 Serializable ()
 Default constructor.
 
 Serializable (const Serializable &other)
 Copy constructor.
 
void generateUuid ()
 

Protected Attributes

PulledInWiresContainer m_pulledInWires
 
- Protected Attributes inherited from agxWire::WireWinchController
bool m_autoFeed
 
agx::RangeReal m_brakeRange
 
BodyFixedNodeRef m_fixedNode
 
bool m_forcedBrake
 
agx::RangeReal m_forceRange
 
agx::observer_ptr< BodyFixedNode > m_lumpedNode
 
agx::Vec3 m_normal
 
WireParameterController * m_parameters
 
agx::observer_ptr< BodyFixedNode > m_parametersHoldingNode
 To access and change rest/current length.
 
agx::Real m_pulledInLength
 
agx::Real m_speed
 
agx::observer_ptr< WireStabilityController > m_stabilityController
 If by the initialization controller, this winch can merge segments and change mass of the lumps via this controller.
 
StopNodeRef m_stopNode
 
bool m_withinEndRange
 

Additional Inherited Members

- Static Public Member Functions inherited from agxStream::Serializable
static void setEnableUuidGeneration (bool flag)
 Specify if there should be UUID:s generated for each new Serializable object. By default it is enabled.
 

Detailed Description

Winch object which works like agxWire::WireWinchController but enables the features of having stored, inactive, wire segments inside of the winch which can be pulled out given a link.

It also features the possibility of completely pulling in a wire segment with a link connection.

Definition at line 30 of file Winch.h.

Member Typedef Documentation

◆ PulledInWiresContainer

Definition at line 111 of file Winch.h.

Constructor & Destructor Documentation

◆ Winch() [1/2]

agxWire::Winch::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) and initial pulled in length.

If the rigid body is null the winch will be attached in world and hence the relative translate and normal is given in world coordinates.

◆ Winch() [2/2]

agxWire::Winch::Winch ( )
protected

Protected default constructor, used during restore.

◆ ~Winch()

virtual agxWire::Winch::~Winch ( )
protectedvirtual

Reference counted object, protected destructor.

Member Function Documentation

◆ add()

agx::Bool agxWire::Winch::add ( agxWire::Wire *  wire,
agx::Real  length 
)

Add inactive wire segment with a given length.

Note
Remember to connect this wire to a link!
Parameters
wire- inactive wire that is fully pulled in to this winch
length- length of the wire
Returns
true if added, false if already added, null or length less than or equal to zero.

◆ addNotification()

virtual void agxWire::Winch::addNotification ( agxSDK::SimulationProxy *  simulationProxy)
overrideprotectedvirtual

Initializes the inactive links.

Reimplemented from agxWire::WireWinchController.

◆ findRestLength()

agx::Real agxWire::Winch::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 in to this winch.

If the wire isn't associated to this winch in any way this method returns -1.

Parameters
wire- wire associated to this winch
Returns
rest length of the wire or -1 if the wire isn't associated to this winch.

◆ getAndEraseFromPulledInWires() [1/2]

agxWire::Winch::WireLength agxWire::Winch::getAndEraseFromPulledInWires ( const agxWire::ConnectingNode *  connectingNode)
protected

Finds the wire the connection node matches and returns that wire including its length.

It also erases the completely pulled in wire from the list of inactive wires.

◆ getAndEraseFromPulledInWires() [2/2]

agxWire::Winch::WireLength agxWire::Winch::getAndEraseFromPulledInWires ( const agxWire::Wire *  wire)
protected

Returns that wire including its length.

It also erases the completely pulled in wire from the list of inactive wires.

◆ getForceGeometryListEmpty()

virtual bool agxWire::Winch::getForceGeometryListEmpty ( bool  begin) const
overrideprotectedvirtual
Returns
true if the near-wire shouldn't have any geometries active

◆ getNumPulledInWires()

agx::UInt agxWire::Winch::getNumPulledInWires ( ) const
Returns
the number of pulled in wires

◆ getTotalPulledInLength()

agx::Real agxWire::Winch::getTotalPulledInLength ( ) const

Calculates the total pulled in length, including the pulled in length of the currently active wire (i.e., getPulledInlength()).

Note
getPulledInLength will only return the pulled in length of the currently active wire, handled by the agxWire::WireWinchController.
Returns
the total pulled in length including all inactive wires and the current amount pulled in of the active wire (i.e., getPulledInLength()).

◆ handleApproachingNodes()

void agxWire::Winch::handleApproachingNodes ( agx::Bool  begin,
agx::Real  dt 
)
protected

Handles the approaching nodes during preUpdate.

◆ initializePulledInLinks()

void agxWire::Winch::initializePulledInLinks ( agxSDK::SimulationProxy *  simulationProxy)
protected

Initializes the inactive links when this winch is added to the simulation.

◆ manipulatePulledInLength()

virtual void agxWire::Winch::manipulatePulledInLength ( agx::Real  newPulledInLength)
protectedvirtual

Other friend objects have the possibility to manipulate the pulled in length of the current segment.

Use with caution.

◆ preUpdate()

virtual void agxWire::Winch::preUpdate ( agx::Bool  begin,
agxSDK::SimulationProxy *  simulationProxy 
)
overrideprotectedvirtual

Checks for 'forced brake condition' where the winch is automatically stopped due to an unsupported approaching node.

E.g., not a link.

Reimplemented from agxWire::WireWinchController.

◆ pullInWire()

virtual agx::Bool agxWire::Winch::pullInWire ( agxWire::Winch::WireLength  nearWireAndLength,
agxWire::LinkRef  link,
agxWire::WireRef  farWire,
agxSDK::SimulationProxy *  simulationProxy 
)
protectedvirtual

Pull in the near wire completely.

Moves this winch to the far wire, disables the link and stores the near wire and the given length it has.

◆ pullOutWire()

virtual agxWire::Winch::WireLength agxWire::Winch::pullOutWire ( agxWire::LinkRef  link,
agxWire::WireRef  farWire,
agxSDK::SimulationProxy *  simulationProxy 
)
protectedvirtual

Pulls out a new wire segment, if any inactive wire is connected to the link.

◆ remove()

agx::Bool agxWire::Winch::remove ( const agxWire::Wire *  wire)

Remove an inactive wire segment.

Returns
true if removed, otherwise false

◆ replaceLink()

agx::Bool agxWire::Winch::replaceLink ( agxWire::Wire *  farWire,
agxWire::Link *  link 
)
protected

Pulling in a wire, replaces link's far node with this winch.

◆ transfer()

virtual void agxWire::Winch::transfer ( agxWire::ILinkNode *  linkNode,
agxWire::WireDistanceCompositeConstraint *  wireConstraint,
agxWire::WireParameterController *  parameters,
agxWire::WireStabilityController *  stabilityController,
agx::Bool  begin 
)
protectedvirtual

Transfers this winch from far wire to a newly created near wire.

Member Data Documentation

◆ m_pulledInWires

PulledInWiresContainer agxWire::Winch::m_pulledInWires
protected

Definition at line 195 of file Winch.h.


The documentation for this class was generated from the following file: