RobWorkProject
Classes | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
RWPEConstraintSolver Class Referenceabstract

Sets up the equation system for constraint forces and solves it. More...

#include <RWPEConstraintSolver.hpp>

Inherited by RWPEConstraintSolverDirect, and RWPEConstraintSolverIterative.

Classes

class  Factory
 A factory for a RWPEConstraintSolver. This factory also defines an extension point for RWPEConstraintSolver. More...
 

Public Member Functions

virtual ~RWPEConstraintSolver ()
 Destructor.
 
virtual const RWPEConstraintSolvercreateSolver (const RWPEBodyConstraintGraph *manager, const rw::math::Vector3D< double > &gravity) const =0
 Create a new solver. More...
 
virtual Eigen::VectorXd solve (double h, bool discontinuity, const rw::kinematics::State &rwstate, const RWPEIslandState &islandState0, const RWPEIslandState &islandStateH, const rw::common::PropertyMap &pmap, class RWPELogUtil *log=NULL) const
 Solve the constraint forces for the constraints in the system. More...
 
virtual Eigen::VectorXd solve (const Eigen::MatrixXd &A, const Eigen::VectorXd &b, Eigen::MatrixXd::Index constraintDim, const rw::common::PropertyMap &pmap, class RWPELogUtil *log=NULL) const =0
 Solve the dynamics. More...
 
virtual void saveSolution (const Eigen::VectorXd &solution, RWPEIslandState &state, class RWPELogUtil *log=NULL) const
 Save the forces and torques obtained with solve() to the state. More...
 
virtual const RWPEBodyConstraintGraphgetManager () const
 Get the body-constraint manager used by the solver. More...
 
virtual const rw::math::Vector3DgetGravity () const
 Get gravity used by the solver. More...
 
virtual void addDefaultProperties (rw::common::PropertyMap &map) const
 Add the default properties to the given map. More...
 

Protected Member Functions

 RWPEConstraintSolver (const RWPEBodyConstraintGraph *manager, const rw::math::Vector3D< double > &gravity)
 Construct new solver. More...
 

Protected Attributes

const RWPEBodyConstraintGraph *const _manager
 The bodies and constraints.
 
const rw::math::Vector3D _gravity
 The gravity used by the solver.
 

Detailed Description

Sets up the equation system for constraint forces and solves it.

Constructor & Destructor Documentation

◆ RWPEConstraintSolver()

RWPEConstraintSolver ( const RWPEBodyConstraintGraph manager,
const rw::math::Vector3D< double > &  gravity 
)
protected

Construct new solver.

Parameters
manager[in] the manager.
gravity[in] the gravity.

Member Function Documentation

◆ addDefaultProperties()

virtual void addDefaultProperties ( rw::common::PropertyMap map) const
virtual

Add the default properties to the given map.

Please look at the documentation for the specific implementations of this function to get information about the required properties for these implementations.

Property Name Type Default value Description
RWPEConstraintSolverDebug int 0 Enable or disable debugging (really slow).
Parameters
map[in/out] the map to add the default properties to.

Reimplemented in RWPEConstraintSolverIterative, and RWPEConstraintSolverDirect.

◆ createSolver()

virtual const RWPEConstraintSolver* createSolver ( const RWPEBodyConstraintGraph manager,
const rw::math::Vector3D< double > &  gravity 
) const
pure virtual

Create a new solver.

Parameters
manager[in] a pointer to the graph of bodies and constraints to use.
gravity[in] the gravity in world coordinates.
Returns
a pointer to a new RWPEConstraintSolver - owned by the caller.

Implemented in RWPEConstraintSolverDirect, and RWPEConstraintSolverIterative.

◆ getGravity()

virtual const rw::math::Vector3D& getGravity ( ) const
virtual

Get gravity used by the solver.

Returns
a reference to the gravity.

◆ getManager()

virtual const RWPEBodyConstraintGraph* getManager ( ) const
virtual

Get the body-constraint manager used by the solver.

Returns
a pointer to a constant RWPEBodyConstraintGraph - NOT owned by caller.

◆ saveSolution()

virtual void saveSolution ( const Eigen::VectorXd &  solution,
RWPEIslandState state,
class RWPELogUtil log = NULL 
) const
virtual

Save the forces and torques obtained with solve() to the state.

Parameters
solution[in] the force/torque vector.
state[in/out] the state.
log[in] (optional) do logging.

◆ solve() [1/2]

virtual Eigen::VectorXd solve ( double  h,
bool  discontinuity,
const rw::kinematics::State rwstate,
const RWPEIslandState islandState0,
const RWPEIslandState islandStateH,
const rw::common::PropertyMap pmap,
class RWPELogUtil log = NULL 
) const
virtual

Solve the constraint forces for the constraints in the system.

Parameters
h[in] the timestep to solve for.
discontinuity[in] true if the integration scheme should be different because of a discontinuity.
rwstate[in] the current state.
islandState0[in] the current RWPEIslandState at beginning of time step.
islandStateH[in] the RWPEIslandState predicted at end of time step.
pmap[in] properties to use - see addDefaultProperties for details.
log[in] (optional) do logging.
Returns
a raw vector with the solution.

◆ solve() [2/2]

virtual Eigen::VectorXd solve ( const Eigen::MatrixXd &  A,
const Eigen::VectorXd &  b,
Eigen::MatrixXd::Index  constraintDim,
const rw::common::PropertyMap pmap,
class RWPELogUtil log = NULL 
) const
pure virtual

Solve the dynamics.

The dynamics problem is often written as a complementarity problem ${\bf A} {\bf f} \geq {\bf b}$ where ${\bf f} \geq {\bf 0}$. This is an equation for the contact and constraint velocities given the interaction forces and torques, ${\bf f}$.

Parameters
A[in] the system matrix on the left hand side of the equation system. This matrix must be symmetric and Positive Semi-definite.
b[in] the right hand side of the equation system.
constraintDim[in] the number of constraints (assumed to be to first equations in system)
pmap[in] properties to use - see addDefaultProperties for details.
log[in] (optional) do logging.
Returns
the vector ${\bf f}$.

Implemented in RWPEConstraintSolverDirect, and RWPEConstraintSolverIterative.


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