Cheetah Software  1.0
ContactConstraint< T > Class Template Referenceabstract

#include <ContactConstraint.h>

+ Inheritance diagram for ContactConstraint< T >:
+ Collaboration diagram for ContactConstraint< T >:

Public Member Functions

 ContactConstraint (FloatingBaseModel< T > *model)
 
virtual ~ContactConstraint ()
 
void AddCollision (Collision< T > *collision)
 
virtual void UpdateExternalForces (T K, T D, T dt)=0
 
virtual void UpdateQdot (FBModelState< T > &state)=0
 
const vectorAligned< Vec3< T > > & getContactPosList ()
 
const Vec3< T > & getGCForce (size_t idx)
 

Protected Member Functions

void _groundContactWithOffset (T K, T D)
 
size_t _CheckContact ()
 

Protected Attributes

vectorAligned< Vec2< T > > deflectionRate
 
vectorAligned< Vec2< T > > _tangentialDeflections
 
size_t _nContact
 
size_t _nCollision
 
FloatingBaseModel< T > * _model
 
std::vector< Collision< T > * > _collision_list
 
std::vector< size_t > _idx_list
 
std::vector< T > _cp_resti_list
 
std::vector< T > _cp_mu_list
 
std::vector< T > _cp_penetration_list
 
vectorAligned< Vec3< T > > _cp_force_list
 
vectorAligned< Vec3< T > > _cp_local_force_list
 
vectorAligned< Vec3< T > > _cp_pos_list
 
vectorAligned< Mat3< T > > _cp_frame_list
 

Detailed Description

template<typename T>
class ContactConstraint< T >

Definition at line 20 of file ContactConstraint.h.

Constructor & Destructor Documentation

template<typename T>
ContactConstraint< T >::ContactConstraint ( FloatingBaseModel< T > *  model)
inline

Definition at line 22 of file ContactConstraint.h.

23  : _nContact(0), _nCollision(0) {
24  _model = model;
25  for (size_t i(0); i < _model->_nGroundContact; ++i) {
26  _cp_force_list.push_back(Vec3<T>::Zero());
27  }
28  }
vectorAligned< Vec3< T > > _cp_force_list
typename Eigen::Matrix< T, 3, 1 > Vec3
Definition: cppTypes.h:26
FloatingBaseModel< T > * _model
template<typename T>
virtual ContactConstraint< T >::~ContactConstraint ( )
inlinevirtual

Definition at line 30 of file ContactConstraint.h.

30 {}

Member Function Documentation

template<typename T >
size_t ContactConstraint< T >::_CheckContact ( )
protected

Definition at line 8 of file ContactConstraint.cpp.

8  {
9  _cp_pos_list.clear();
10  _cp_local_force_list.clear();
11  _cp_penetration_list.clear();
12 
13  _cp_frame_list.clear();
14  _cp_resti_list.clear();
15  _cp_mu_list.clear();
16  _idx_list.clear();
17 
18  Vec3<T> tmp_vec;
19  Mat3<T> cp_frame;
20 
21  T penetration;
22  for (size_t i(0); i < _model->_nGroundContact; ++i) {
23  _cp_force_list[i].setZero();
24  for (size_t j(0); j < _nCollision; ++j) {
25  if (_collision_list[j]->ContactDetection(_model->_pGC[i], penetration,
26  cp_frame)) {
27  // Contact Happens
28  _cp_pos_list.push_back(_model->_pGC[i]);
30  _cp_frame_list.push_back(cp_frame);
31  _cp_penetration_list.push_back(penetration);
32 
33  _idx_list.push_back(i);
34 
35  _cp_resti_list.push_back(_collision_list[j]->getRestitutionCoeff());
36  _cp_mu_list.push_back(_collision_list[j]->getFrictionCoeff());
37  }
38  }
39  }
40  return _cp_pos_list.size();
41 }
std::vector< T > _cp_resti_list
std::vector< T > _cp_mu_list
vectorAligned< Vec3< T > > _cp_force_list
typename Eigen::Matrix< T, 3, 3 > Mat3
Definition: cppTypes.h:54
vectorAligned< Vec3< T > > _cp_pos_list
std::vector< Collision< T > * > _collision_list
typename Eigen::Matrix< T, 3, 1 > Vec3
Definition: cppTypes.h:26
vectorAligned< Mat3< T > > _cp_frame_list
vectorAligned< Vec3< T > > _cp_local_force_list
std::vector< size_t > _idx_list
FloatingBaseModel< T > * _model
std::vector< T > _cp_penetration_list
template<typename T>
void ContactConstraint< T >::_groundContactWithOffset ( K,
D 
)
protected
template<typename T>
void ContactConstraint< T >::AddCollision ( Collision< T > *  collision)
inline

Add collision object

Parameters
collision: collision objects

Definition at line 36 of file ContactConstraint.h.

36  {
37  _collision_list.push_back(collision);
38  ++_nCollision;
39  }
std::vector< Collision< T > * > _collision_list
template<typename T>
const vectorAligned<Vec3<T> >& ContactConstraint< T >::getContactPosList ( )
inline

For visualization

Returns
cp_pos_list : all contact point position in the global frame.

Definition at line 60 of file ContactConstraint.h.

60 { return _cp_pos_list; }
vectorAligned< Vec3< T > > _cp_pos_list
template<typename T>
const Vec3<T>& ContactConstraint< T >::getGCForce ( size_t  idx)
inline

For visualization

Returns
cp_force_list : all linear contact force described in the global frame.

Definition at line 67 of file ContactConstraint.h.

67 { return _cp_force_list[idx]; }
vectorAligned< Vec3< T > > _cp_force_list
template<typename T>
virtual void ContactConstraint< T >::UpdateExternalForces ( K,
D,
dt 
)
pure virtual

Used for spring damper based contact constraint method

Parameters
K: Spring constant
D: Damping constant
dt: time step (sec)

Implemented in ContactSpringDamper< T >, and ContactImpulse< T >.

+ Here is the caller graph for this function:

template<typename T>
virtual void ContactConstraint< T >::UpdateQdot ( FBModelState< T > &  state)
pure virtual

Used for impulse based contact constraint method

Parameters
state: full state of a floating system full state
Returns
state : update velocity

Implemented in ContactImpulse< T >, and ContactSpringDamper< T >.

+ Here is the caller graph for this function:

Member Data Documentation

template<typename T>
std::vector<Collision<T>*> ContactConstraint< T >::_collision_list
protected

Definition at line 82 of file ContactConstraint.h.

template<typename T>
vectorAligned<Vec3<T> > ContactConstraint< T >::_cp_force_list
protected

Definition at line 88 of file ContactConstraint.h.

template<typename T>
vectorAligned<Mat3<T> > ContactConstraint< T >::_cp_frame_list
protected

Definition at line 91 of file ContactConstraint.h.

template<typename T>
vectorAligned<Vec3<T> > ContactConstraint< T >::_cp_local_force_list
protected

Definition at line 89 of file ContactConstraint.h.

template<typename T>
std::vector<T> ContactConstraint< T >::_cp_mu_list
protected

Definition at line 85 of file ContactConstraint.h.

template<typename T>
std::vector<T> ContactConstraint< T >::_cp_penetration_list
protected

Definition at line 87 of file ContactConstraint.h.

template<typename T>
vectorAligned<Vec3<T> > ContactConstraint< T >::_cp_pos_list
protected

Definition at line 90 of file ContactConstraint.h.

template<typename T>
std::vector<T> ContactConstraint< T >::_cp_resti_list
protected

Definition at line 84 of file ContactConstraint.h.

template<typename T>
std::vector<size_t> ContactConstraint< T >::_idx_list
protected

Definition at line 83 of file ContactConstraint.h.

template<typename T>
FloatingBaseModel<T>* ContactConstraint< T >::_model
protected

Definition at line 80 of file ContactConstraint.h.

template<typename T>
size_t ContactConstraint< T >::_nCollision
protected

Definition at line 78 of file ContactConstraint.h.

template<typename T>
size_t ContactConstraint< T >::_nContact
protected

Definition at line 77 of file ContactConstraint.h.

template<typename T>
vectorAligned<Vec2<T> > ContactConstraint< T >::_tangentialDeflections
protected

Definition at line 75 of file ContactConstraint.h.

template<typename T>
vectorAligned<Vec2<T> > ContactConstraint< T >::deflectionRate
protected

Definition at line 70 of file ContactConstraint.h.


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