AGX Dynamics  2.37.2.0
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 
242  inline void WireParameterController::setMinimumDistanceBetweenNodes(agx::Real minDistanceBetweenNodes)
243  {
244  agxAssert(minDistanceBetweenNodes > 0);
245  m_minimumDistanceBetweenNodes = minDistanceBetweenNodes;
246  }
247 
248 
249  inline agx::Real WireParameterController::getMinimumDistanceBetweenNodes() const
250  {
251  return m_minimumDistanceBetweenNodes;
252  }
253 
254 
255  inline void WireParameterController::setStopNodeReferenceDistance(agx::Real stopNodeReferenceDistance)
256  {
257  m_stopNodeReferenceDistance = stopNodeReferenceDistance;
258  }
259 
260  inline agx::Real WireParameterController::getStopNodeReferenceDistance() const
261  {
262  return m_stopNodeReferenceDistance;
263  }
264 
265 
266  inline void WireParameterController::setStopNodeLumpMinDistanceFraction(agx::Real stopNodeLumpMinDistanceFraction)
267  {
268  m_stopNodeLumpMinDistanceFraction = stopNodeLumpMinDistanceFraction;
269  }
270 
271 
272  inline agx::Real WireParameterController::getStopNodeLumpMinDistanceFraction() const
273  {
274  return m_stopNodeLumpMinDistanceFraction;
275  }
276 
277 
278 
279  inline void WireParameterController::setScaleConstant(agx::Real scaleConstant)
280  {
281  agxAssert(scaleConstant > 0);
282  m_scaleConstant = scaleConstant;
283  }
284 
285 
286  inline agx::Real WireParameterController::getScaleConstant() const
287  {
288  return m_scaleConstant;
289  }
290 
291 
292  inline void WireParameterController::setRadiusMultiplier(agx::Real radiusMultiplier)
293  {
294  agxAssert(radiusMultiplier > 0);
295  m_radiusMultiplier = radiusMultiplier;
296  }
297 
298  inline agx::Real WireParameterController::getNonScaledRadiusMultiplier() const
299  {
300  return m_radiusMultiplier;
301  }
302 
303  inline agx::Real WireParameterController::getRadiusMultiplier(agx::Real wireRadius) const
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 
314  inline void WireParameterController::setMaximumContactMovementOneTimestep(agx::Real maxMovement)
315  {
316  maxMovement = std::abs(maxMovement); //must be positive
317  m_maximumContactMovementOneTimestep = maxMovement;
318  }
319 
320  inline agx::Real WireParameterController::getMaximumContactMovementOneTimestep() const
321  {
322  return m_maximumContactMovementOneTimestep;
323  }
324 
325  inline agx::Real WireParameterController::getSensorRadius(agx::Real wireRadius) const
326  {
327  return m_maximumContactMovementOneTimestep * 2 + wireRadius * 4;
328  }
329 }
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:400
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...
bool Bool
Definition: Integer.h:48
#define AGXPHYSICS_EXPORT
The agx namespace contains the dynamics/math part of the AGX Dynamics API.
Implements a Wire model with adaptive resolution.
Definition: MergedBody.h:39
Class to hold specific parameters for the wire - this makes the wires highly configurable.
Structure with compliance parameters for the prismatic constraint used by winches.
#define agxAssert(expr)
Definition: debug.h:143
T1 clamp(T1 v, T2 minimum, T3 maximum)
Definition: Math.h:318
AGXPHYSICS_EXPORT agx::Bool equalsZero(const agx::AddedMassInteraction::Matrix6x6 &matrix, agx::Real eps=agx::RealEpsilon)
double Real
Definition: Real.h:42
#define MAXIMUM_DISTANCE_BETWEEN_NODE_AND_GEOMETRY
This namespace contain classes for streaming classes into archives, ASCII, binary for storage (serial...
#define DOXYGEN_END_INTERNAL_BLOCK()
Definition: Object.h:98
#define DOXYGEN_START_INTERNAL_BLOCK()
Definition: Object.h:97