AGX Dynamics  2.37.2.0
FrictionControllerNlCallback.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/NlmcpCallback.h>
20 
21 namespace agx
22 {
23  class FrictionController;
24 
29  {
30  public:
31  struct ContextData
32  {
34  {
37  }
38 
41  bool useSecondaryConstraint = false;
42  };
43 
44 
45  public:
46  static ContextData findContextData(const agx::FrictionController* frictionController, const agx::ConstraintImplementation* context );
47  static agx::Real calculateNormalForce( const agx::ConstraintImplementation* context, ContextData contextData );
48 
49  public:
53  FrictionControllerNlCallback( const agx::FrictionController* frictionController );
54 
57 
58  virtual agx::Bool initialize( const agx::NlmcpCallback::Args& args ) override;
59 
60  virtual agx::Real calculateResidual( const agx::NlmcpCallback::Args& args ) const override;
61 
62  virtual void update( const agx::NlmcpCallback::Args& args ) const override;
63 
64  virtual void postIterativeSolve( const agx::NlmcpCallback::Args& /*args*/ ) const override;
65 
66  protected:
68 
69  virtual void onSetContext( const NlmcpCallbackSolverData& ) override;
70 
71  protected:
73 
74  private:
75  const FrictionController* m_frictionController;
76  ContextData m_contextData;
77  };
78 }
Solver callback class for elementary FrictionController.
agx::Real calculateNormalImpact(const agx::RealValarray &z) const
bool Bool
Definition: Integer.h:48
virtual void update(const agx::NlmcpCallback::Args &args) const override
Update call when bounds and/or q may be updated given the current solution z.
virtual agx::Real calculateResidual(const agx::NlmcpCallback::Args &args) const override
Calculate residual given current solution.
AGXCORE_EXPORT const InvalidIndexStruct InvalidIndex
virtual void postIterativeSolve(const agx::NlmcpCallback::Args &) const override
Before direct solve, after iterative solve.
Translational or rotational friction controller for Hinge, Prismatic and CylindricalJoint.
virtual agx::Bool initialize(const agx::NlmcpCallback::Args &args) override
This method is a test for the non-linear solver if this callback is active for non-linear solve...
static ContextData findContextData(const agx::FrictionController *frictionController, const agx::ConstraintImplementation *context)
virtual void onSetContext(const NlmcpCallbackSolverData &) override
Called when context constraint has been set and all data is valid.
Constraint solver callback interface with context and start rows for context.
uint32_t UInt
Definition: Integer.h:34
The agx namespace contains the dynamics/math part of the AGX Dynamics API.
std::valarray< agx::Real > RealValarray
For this module, vectors are defined using valarray.
agx::Real calculateNormalForce() const
Data from the solver the ConstraintNlmcpCallback is part of.
double Real
Definition: Real.h:42
FrictionControllerNlCallback(const agx::FrictionController *frictionController)
Default constructor.