Cheetah Software  1.0
ContactConstraint.h
Go to the documentation of this file.
1 
8 #ifndef CONTACT_CONSTRAINT_H
9 #define CONTACT_CONSTRAINT_H
10 
11 #include <iostream>
12 #include "Collision/Collision.h"
15 #include "cppTypes.h"
16 
17 #define CC ContactConstraint<T>
18 
19 template <typename T>
21  public:
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  }
29 
30  virtual ~ContactConstraint() {}
31 
36  void AddCollision(Collision<T>* collision) {
37  _collision_list.push_back(collision);
38  ++_nCollision;
39  }
40 
47  virtual void UpdateExternalForces(T K, T D, T dt) = 0;
48 
54  virtual void UpdateQdot(FBModelState<T>& state) = 0;
55 
61 
67  const Vec3<T>& getGCForce(size_t idx) { return _cp_force_list[idx]; }
68 
69  protected:
71  void _groundContactWithOffset(T K, T D);
72 
73  size_t _CheckContact();
74 
76 
77  size_t _nContact;
78  size_t _nCollision;
79 
81 
82  std::vector<Collision<T>*> _collision_list;
83  std::vector<size_t> _idx_list;
84  std::vector<T> _cp_resti_list;
85  std::vector<T> _cp_mu_list;
86 
87  std::vector<T> _cp_penetration_list;
88  vectorAligned<Vec3<T>> _cp_force_list; // For All contact point w.r.t Global
92 };
93 
94 #endif
virtual void UpdateExternalForces(T K, T D, T dt)=0
virtual void UpdateQdot(FBModelState< T > &state)=0
std::vector< T > _cp_resti_list
std::vector< T > _cp_mu_list
vectorAligned< Vec3< T > > _cp_force_list
vectorAligned< Vec3< T > > _cp_pos_list
const vectorAligned< Vec3< T > > & getContactPosList()
std::vector< Collision< T > * > _collision_list
typename Eigen::Matrix< T, 3, 1 > Vec3
Definition: cppTypes.h:26
vectorAligned< Mat3< T > > _cp_frame_list
void _groundContactWithOffset(T K, T D)
void AddCollision(Collision< T > *collision)
vectorAligned< Vec3< T > > _cp_local_force_list
Virtual class of Collision logic.
std::vector< size_t > _idx_list
virtual ~ContactConstraint()
FloatingBaseModel< T > * _model
vectorAligned< Vec2< T > > _tangentialDeflections
typename std::vector< T, Eigen::aligned_allocator< T >> vectorAligned
Definition: cppTypes.h:118
const Vec3< T > & getGCForce(size_t idx)
ContactConstraint(FloatingBaseModel< T > *model)
vectorAligned< Vec2< T > > deflectionRate
Implementation of Rigid Body Floating Base model data structure.
std::vector< T > _cp_penetration_list