7 #ifndef _CONSTRAINT_STABILIZATION_H
8 #define _CONSTRAINT_STABILIZATION_H
11 #include <Ravelin/DynamicBodyd.h>
13 #include <Moby/UnilateralConstraintProblemData.h>
14 #include <Moby/PairwiseDistInfo.h>
18 class ConstraintSimulator;
25 void stabilize(boost::shared_ptr<ConstraintSimulator> sim);
34 unsigned max_iterations;
37 void get_body_configurations(Ravelin::VectorNd& q, boost::shared_ptr<ConstraintSimulator> sim);
38 void update_body_configurations(
const Ravelin::VectorNd& q, boost::shared_ptr<ConstraintSimulator> sim);
39 bool update_q(
const Ravelin::VectorNd& dq, Ravelin::VectorNd& q, boost::shared_ptr<ConstraintSimulator> sim);
40 void compute_problem_data(std::vector<UnilateralConstraintProblemData>& pd, boost::shared_ptr<ConstraintSimulator> sim);
42 void add_limit_constraints(
const std::vector<ControlledBodyPtr>& bodies, std::vector<UnilateralConstraint>& constraints);
43 void generate_body_index_map(std::map<boost::shared_ptr<Ravelin::DynamicBodyd>,
unsigned>& body_index_map, boost::shared_ptr<ConstraintSimulator> sim);
44 static void set_unilateral_constraint_data(UnilateralConstraintProblemData& pd,
const std::list<boost::shared_ptr<Ravelin::SingleBodyd> >& single_bodies);
45 static void set_bilateral_only_constraint_data(UnilateralConstraintProblemData& q,
const std::vector<boost::shared_ptr<Ravelin::DynamicBodyd> >& island);
46 void determine_dq(UnilateralConstraintProblemData& pd, Ravelin::VectorNd& dqm,
const std::map<boost::shared_ptr<Ravelin::DynamicBodyd>,
unsigned>& body_index_map);
47 void update_from_stacked(
const Ravelin::VectorNd& z, UnilateralConstraintProblemData& pd);
48 void update_velocities(
const UnilateralConstraintProblemData& pd);
49 static double get_min_pairwise_dist(
const std::vector<PairwiseDistInfo>& pdi);
50 static boost::shared_ptr<Ravelin::DynamicBodyd> get_super_body_from_rigid_body(boost::shared_ptr<Ravelin::RigidBodyd> sb);
51 static boost::shared_ptr<Ravelin::DynamicBodyd> get_super_body(boost::shared_ptr<Ravelin::DynamicBodyd> sb);
52 double ridders_unilateral(
double x1,
double x2,
double fx1,
double fx2,
unsigned i,
const Ravelin::VectorNd& dq,
const Ravelin::VectorNd& q, boost::shared_ptr<ConstraintSimulator> sim);
53 double ridders_bilateral(
double x1,
double x2,
double fx1,
double fx2,
unsigned i,
const Ravelin::VectorNd& dq,
const Ravelin::VectorNd& q, boost::shared_ptr<ConstraintSimulator> sim);
54 double eval_unilateral(
double t,
unsigned i,
const Ravelin::VectorNd& dq,
const Ravelin::VectorNd& q, boost::shared_ptr<ConstraintSimulator> sim);
55 double eval_bilateral(
double t,
unsigned i,
const Ravelin::VectorNd& dq,
const Ravelin::VectorNd& q, boost::shared_ptr<ConstraintSimulator> sim);
56 static void save_velocities(boost::shared_ptr<ConstraintSimulator> sim, std::vector<Ravelin::VectorNd>& qd);
57 static void restore_velocities(boost::shared_ptr<ConstraintSimulator> sim,
const std::vector<Ravelin::VectorNd>& qd);
58 static void add_contact_to_Jacobian(
const UnilateralConstraint& c,
SparseJacobian& Cn,
const std::map<boost::shared_ptr<Ravelin::DynamicBodyd>,
unsigned>& gc_map,
unsigned contact_idx);
59 static double evaluate_unilateral_constraints(boost::shared_ptr<ConstraintSimulator> sim, std::vector<double>& uC);
60 static double evaluate_bilateral_constraints(boost::shared_ptr<ConstraintSimulator> sim, std::vector<double>& C);
66 std::vector<UnilateralConstraint> constraints;
69 std::vector<std::pair<CollisionGeometryPtr, CollisionGeometryPtr> > _pairs_to_check;
A Sparse Jacobian representation along with multiplication routines.
Definition: SparseJacobian.h:30
boost::shared_ptr< CollisionGeometry > CollisionGeometryPtr
Collision geometry smart pointer.
Definition: Types.h:77
Projected constraint stabilization mechanism.
Definition: ConstraintStabilization.h:21
void stabilize(boost::shared_ptr< ConstraintSimulator > sim)
Stabilizes the constraints in the simulator.
Definition: ConstraintStabilization.cpp:167
Container class for describing a unilateral constraint in the simulation.
Definition: UnilateralConstraint.h:27