AGX Dynamics  2.38.0.2
WireParameterController.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 <agx/agxPhysics_export.h>
20 #include <agx/Vec2.h>
21 #include <agx/Vec3.h>
22 
23 #define MAXIMUM_DISTANCE_BETWEEN_NODE_AND_GEOMETRY 0.05
24 
25 namespace agxStream
26 {
27  class OutputArchive;
28  class InputArchive;
29 }
30 
31 namespace agxWire
32 {
38  {
39  public:
46  {
57  };
58 
60 
62 
66  void resetToDefault();
67 
74  inline void setMinimumDistanceBetweenNodes(agx::Real minDistanceBetweenNodes);
75 
80  agx::Real getMinimumDistanceBetweenNodes() const;
81 
89  inline void setStopNodeReferenceDistance(agx::Real stopNodeReferenceDistance);
90 
95  agx::Real getStopNodeReferenceDistance() const;
96 
102  void setStopNodeLumpMinDistanceFraction(agx::Real stopNodeLumpMinDistanceFraction);
103 
108  agx::Real getStopNodeLumpMinDistanceFraction() const;
109 
116  void setScaleConstant(agx::Real scaleConstant);
117 
122  agx::Real getScaleConstant() const;
123 
130  void setRadiusMultiplier(agx::Real radiusMultiplier);
131 
132  agx::Real getNonScaledRadiusMultiplier() const;
133 
137  agx::Real getRadiusMultiplier(agx::Real wireRadius) const;
138 
144  void setMaximumContactMovementOneTimestep(agx::Real maxMovement);
145 
146  agx::Real getMaximumContactMovementOneTimestep() const;
147 
152  inline agx::Real getSensorRadius(agx::Real wireRadius) const;
153 
157  void setSplitTensionMultiplier(agx::Real multiplier);
158 
162  agx::Real getSplitTensionMultiplier() const;
163 
169  void setWireContactDynamicsSolverDampingScale(agx::Real scale);
170 
174  agx::Real getWireContactDynamicsSolverDampingScale() const;
175 
177 
178  agx::Real getWireContactPrecision() const;
179  agx::Real getContactNodeEdgeDefaultLength() const;
180  agx::Bool getSolverUseExtraLength() const;
181  agx::Bool getSolverMoveNodesBeforeMainSolver() const;
182 
186  void setWireContactPrecision(agx::Real precision);
187 
188  void setContactNodeEdgeDefaultLength(agx::Real length);
189  void setSolverUseExtraLength(agx::Bool useExtraLength);
190  void setSolverMoveNodesBeforeMainSolver(agx::Bool moveNodesBeforeSolver);
191 
195  WinchPrismaticCompliance& getWinchPrismaticCompliance();
196 
200  const WinchPrismaticCompliance& getWinchPrismaticCompliance() const;
201 
205  void store( agxStream::OutputArchive& out ) const;
206 
210  void restore( agxStream::InputArchive& in );
211 
213 
214 
215  private:
216  agx::Real m_minimumDistanceBetweenNodes;
217  agx::Real m_stopNodeReferenceDistance;
218  agx::Real m_stopNodeLumpMinDistanceFraction;
219  WinchPrismaticCompliance m_winchPrismaticCompliance;
220  agx::Real m_scaleConstant;
221  agx::Real m_radiusMultiplier;
222  agx::Real m_maximumContactMovementOneTimestep;
223  agx::Real m_splitTensionMultiplier;
224  agx::Real m_wireContactPrecision;
225  agx::Real m_wireContactDynamicsSolverDampingScale;
226  agx::Real m_contactNodeEdgeDefaultLength;
227  agx::Bool m_useExtraLength;
228  agx::Bool m_moveNodesBeforeSolver;
229  agx::Bool m_clampNodesToEdges;
230  };
231 
232  inline WireParameterController::WinchPrismaticCompliance& WireParameterController::getWinchPrismaticCompliance()
233  {
234  return m_winchPrismaticCompliance;
235  }
236 
237  inline const WireParameterController::WinchPrismaticCompliance& WireParameterController::getWinchPrismaticCompliance() const
238  {
239  return m_winchPrismaticCompliance;
240  }
241 
243  {
244  agxAssert(minDistanceBetweenNodes > 0);
245  m_minimumDistanceBetweenNodes = minDistanceBetweenNodes;
246  }
247 
248 
250  {
251  return m_minimumDistanceBetweenNodes;
252  }
253 
254 
256  {
257  m_stopNodeReferenceDistance = stopNodeReferenceDistance;
258  }
259 
261  {
262  return m_stopNodeReferenceDistance;
263  }
264 
265 
266  inline void WireParameterController::setStopNodeLumpMinDistanceFraction(agx::Real stopNodeLumpMinDistanceFraction)
267  {
268  m_stopNodeLumpMinDistanceFraction = stopNodeLumpMinDistanceFraction;
269  }
270 
271 
273  {
274  return m_stopNodeLumpMinDistanceFraction;
275  }
276 
277 
278 
280  {
281  agxAssert(scaleConstant > 0);
282  m_scaleConstant = scaleConstant;
283  }
284 
285 
287  {
288  return m_scaleConstant;
289  }
290 
291 
293  {
294  agxAssert(radiusMultiplier > 0);
295  m_radiusMultiplier = radiusMultiplier;
296  }
297 
299  {
300  return m_radiusMultiplier;
301  }
302 
304  {
305  agxAssert(!agx::equalsZero(wireRadius));
306 
307  agx::Real radiusInMultiplier = wireRadius * m_radiusMultiplier;
308 
309  agx::Real extra = agx::clamp(radiusInMultiplier - wireRadius, agx::Real(0), agx::Real(MAXIMUM_DISTANCE_BETWEEN_NODE_AND_GEOMETRY));//Max contact node distance from geometry == 0.05
310 
311  return (wireRadius + extra) / wireRadius;
312  }
313 
315  {
316  maxMovement = std::abs(maxMovement); //must be positive
317  m_maximumContactMovementOneTimestep = maxMovement;
318  }
319 
321  {
322  return m_maximumContactMovementOneTimestep;
323  }
324 
326  {
327  return m_maximumContactMovementOneTimestep * 2 + wireRadius * 4;
328  }
329 }
agxPhysics_export.h
agxWire::WireParameterController::setStopNodeReferenceDistance
void setStopNodeReferenceDistance(agx::Real stopNodeReferenceDistance)
Set the distance between the lump node and the stop node for winches.
Definition: WireParameterController.h:255
agx::Real
double Real
Definition: Real.h:42
agxStream::out
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.
Definition: OutputArchive.h:412
agxWire::WireParameterController::getNonScaledRadiusMultiplier
agx::Real getNonScaledRadiusMultiplier() const
Definition: WireParameterController.h:298
agxWire::WireParameterController::setStopNodeLumpMinDistanceFraction
void setStopNodeLumpMinDistanceFraction(agx::Real stopNodeLumpMinDistanceFraction)
Set the fraction of stop node reference distance that defines the range end of the prismatic constrai...
Definition: WireParameterController.h:266
agxWire::WireParameterController::getMinimumDistanceBetweenNodes
agx::Real getMinimumDistanceBetweenNodes() const
Definition: WireParameterController.h:249
agxWire::WireParameterController::getSensorRadius
agx::Real getSensorRadius(agx::Real wireRadius) const
Definition: WireParameterController.h:325
DOXYGEN_END_INTERNAL_BLOCK
#define DOXYGEN_END_INTERNAL_BLOCK()
Definition: macros.h:97
DOXYGEN_START_INTERNAL_BLOCK
#define DOXYGEN_START_INTERNAL_BLOCK()
Definition: macros.h:96
agxAssert
#define agxAssert(expr)
Definition: debug.h:143
MAXIMUM_DISTANCE_BETWEEN_NODE_AND_GEOMETRY
#define MAXIMUM_DISTANCE_BETWEEN_NODE_AND_GEOMETRY
Definition: WireParameterController.h:23
agxWire::WireParameterController::WinchPrismaticCompliance::rotational_d
agx::Vec3 rotational_d
Damping.
Definition: WireParameterController.h:50
agx
The agx namespace contains the dynamics/math part of the AGX Dynamics API.
Definition: AddedMassInteraction.h:22
agxWire::WireParameterController::WinchPrismaticCompliance::spatial
agx::Vec2 spatial
Compliance.
Definition: WireParameterController.h:47
agxWire::WireParameterController::getStopNodeReferenceDistance
agx::Real getStopNodeReferenceDistance() const
Definition: WireParameterController.h:260
AGXPHYSICS_EXPORT
#define AGXPHYSICS_EXPORT
agxStream::in
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:399
agxWire::WireParameterController::WinchPrismaticCompliance::range_d
agx::Real range_d
Damping.
Definition: WireParameterController.h:54
agx::clamp
T1 clamp(T1 v, T2 minimum, T3 maximum)
Definition: Math.h:318
Vec2.h
agx::equalsZero
AGXPHYSICS_EXPORT agx::Bool equalsZero(const agx::AddedMassInteraction::Matrix6x6 &matrix, agx::Real eps=agx::RealEpsilon)
Vec3.h
agxWire::WireParameterController::getScaleConstant
agx::Real getScaleConstant() const
Definition: WireParameterController.h:286
agxWire::WireParameterController::WinchPrismaticCompliance::spatial_d
agx::Vec2 spatial_d
Damping.
Definition: WireParameterController.h:48
agxWire::WireParameterController::WinchPrismaticCompliance::motor
agx::Real motor
Compliance.
Definition: WireParameterController.h:51
agxWire::WireParameterController::getRadiusMultiplier
agx::Real getRadiusMultiplier(agx::Real wireRadius) const
Definition: WireParameterController.h:303
agxWire::WireParameterController::setMaximumContactMovementOneTimestep
void setMaximumContactMovementOneTimestep(agx::Real maxMovement)
This value should be related the size of objects the wire is interacting with, to avoid tunneling If ...
Definition: WireParameterController.h:314
agxWire::WireParameterController::WinchPrismaticCompliance::range
agx::Real range
Compliance.
Definition: WireParameterController.h:53
agxWire
Implements a Wire model with adaptive resolution.
Definition: MergedBody.h:39
agx::Vec2T< Real >
agxWire::WireParameterController::setScaleConstant
void setScaleConstant(agx::Real scaleConstant)
The scale constant controls the insert/remove of lumped nodes in a wire.
Definition: WireParameterController.h:279
agxWire::WireParameterController::setRadiusMultiplier
void setRadiusMultiplier(agx::Real radiusMultiplier)
Set the wire sphere geometry radius multiplier.
Definition: WireParameterController.h:292
agxWire::WireParameterController::WinchPrismaticCompliance
Structure with compliance parameters for the prismatic constraint used by winches.
Definition: WireParameterController.h:45
agxWire::WireParameterController::getMaximumContactMovementOneTimestep
agx::Real getMaximumContactMovementOneTimestep() const
Definition: WireParameterController.h:320
agxWire::WireParameterController
Class to hold specific parameters for the wire - this makes the wires highly configurable.
Definition: WireParameterController.h:37
agxWire::WireParameterController::WinchPrismaticCompliance::lock
agx::Real lock
Compliance.
Definition: WireParameterController.h:55
agx::Bool
bool Bool
Definition: Integer.h:40
agxStream
This namespace contain classes for streaming classes into archives, ASCII, binary for storage (serial...
Definition: ElementaryConstraint.h:31
agxWire::WireParameterController::WinchPrismaticCompliance::lock_d
agx::Real lock_d
Damping.
Definition: WireParameterController.h:56
agx::Vec3T< Real >
agxWire::WireParameterController::setMinimumDistanceBetweenNodes
void setMinimumDistanceBetweenNodes(agx::Real minDistanceBetweenNodes)
Set the minimum distance allowed between nodes.
Definition: WireParameterController.h:242
agxWire::WireParameterController::WinchPrismaticCompliance::motor_d
agx::Real motor_d
Damping.
Definition: WireParameterController.h:52
agxWire::WireParameterController::getStopNodeLumpMinDistanceFraction
agx::Real getStopNodeLumpMinDistanceFraction() const
Definition: WireParameterController.h:272
agxWire::WireParameterController::WinchPrismaticCompliance::rotational
agx::Vec3 rotational
Compliance.
Definition: WireParameterController.h:49