18 #ifndef LIBBIOMIMETICS_FLOATINGBASEMODEL_H 19 #define LIBBIOMIMETICS_FLOATINGBASEMODEL_H 25 #include <eigen3/Eigen/StdVector> 39 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
47 printf(
"position: %.3f %.3f %.3f\n", bodyPosition[0], bodyPosition[1],
58 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
95 int addGroundContactPoint(
int bodyID,
const Vec3<T>& location,
103 void addGroundContactBoxPoints(
int bodyId,
const Vec3<T>& dims);
152 T totalNonRotorMass();
156 const std::vector<SpatialInertia<T>,
157 Eigen::aligned_allocator<SpatialInertia<T>>>&
162 const std::vector<SpatialInertia<T>,
163 Eigen::aligned_allocator<SpatialInertia<T>>>&
174 _compute_contact_info[gc_index] = flag;
177 DMat<T> invContactInertia(
const int gc_index,
179 T invContactInertia(
const int gc_index,
const Vec3<T>& force_ics_at_contact);
181 T applyTestForce(
const int gc_index,
const Vec3<T>& force_ics_at_contact,
184 T applyTestForce(
const int gc_index,
const Vec3<T>& force_ics_at_contact,
187 void addDynamicsVars(
int count);
189 void resizeSystemMatricies();
194 _biasAccelerationsUpToDate =
false;
195 _compositeInertiasUpToDate =
false;
197 resetCalculationFlags();
200 _articulatedBodiesUpToDate =
false;
201 _kinematicsUpToDate =
false;
202 _forcePropagatorsUpToDate =
false;
203 _qddEffectsUpToDate =
false;
204 _accelerationsUpToDate =
false;
209 _accelerationsUpToDate =
false;
212 Vec3<T> getPosition(
const int link_idx,
const Vec3<T> & local_pos);
213 Vec3<T> getPosition(
const int link_idx);
216 Mat3<T> getOrientation(
const int link_idx);
217 Vec3<T> getLinearVelocity(
const int link_idx,
const Vec3<T>& point);
218 Vec3<T> getLinearVelocity(
const int link_idx);
220 Vec3<T> getLinearAcceleration(
const int link_idx,
const Vec3<T>& point);
221 Vec3<T> getLinearAcceleration(
const int link_idx);
223 Vec3<T> getAngularVelocity(
const int link_idx);
224 Vec3<T> getAngularAcceleration(
const int link_idx);
226 void forwardKinematics();
227 void biasAccelerations();
228 void compositeInertias();
229 void forwardAccelerationKinematics();
230 void contactJacobians();
232 DVec<T> generalizedGravityForce();
233 DVec<T> generalizedCoriolisForce();
246 vector<Mat6<T>, Eigen::aligned_allocator<Mat6<T>>>
_Xtree, _Xrot;
247 vector<SpatialInertia<T>, Eigen::aligned_allocator<SpatialInertia<T>>> _Ibody,
251 size_t _nGroundContact = 0;
274 _Srot, _fvp, _fvprot, _ag, _agrot, _f, _frot;
291 bool _kinematicsUpToDate =
false;
292 bool _biasAccelerationsUpToDate =
false;
293 bool _accelerationsUpToDate =
false;
295 bool _compositeInertiasUpToDate =
false;
297 void updateArticulatedBodies();
298 void updateForcePropagators();
299 void udpateQddEffects();
302 for (
size_t i = 0; i < _nDof; i++) {
307 bool _articulatedBodiesUpToDate =
false;
308 bool _forcePropagatorsUpToDate =
false;
309 bool _qddEffectsUpToDate =
false;
316 #endif // LIBBIOMIMETICS_FLOATINGBASEMODEL_H vector< std::string > _bodyNames
void setDState(const FBModelStateDerivative< T > &dState)
vector< bool > _compute_contact_info
vector< CoordinateAxis > _jointAxes
typename Eigen::Matrix< T, 6, Eigen::Dynamic > D6Mat
Eigen::ColPivHouseholderQR< Mat6< T > > _invIA5
typename Eigen::Matrix< T, 6, 6 > Mat6
EIGEN_MAKE_ALIGNED_OPERATOR_NEW Vec3< T > dBodyPosition
typename Eigen::Matrix< T, 3, 3 > Mat3
typename Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > DMat
const std::vector< int > & getParentVector()
vectorAligned< SpatialInertia< T > > _IC
typename Eigen::Matrix< T, 4, 1 > Quat
vectorAligned< Vec3< T > > _Jcdqd
vector< Mat6< T >, Eigen::aligned_allocator< Mat6< T > > > _Xtree
vectorAligned< SVec< T > > _externalForces
typename Eigen::Matrix< T, 3, 1 > Vec3
void setGravity(Vec3< T > &g)
const DVec< T > & getGravityForce() const
const std::vector< SpatialInertia< T >, Eigen::aligned_allocator< SpatialInertia< T > > > & getBodyInertiaVector()
void resetExternalForces()
const DVec< T > & getCoriolisForce() const
FBModelStateDerivative< T > _dState
typename Eigen::Matrix< T, 6, 1 > SVec
vector< Vec3< T > > _gcLocation
const DMat< T > & getMassMatrix() const
const std::vector< SpatialInertia< T >, Eigen::aligned_allocator< SpatialInertia< T > > > & getRotorInertiaVector()
vectorAligned< SVec< T > > _Utot
vector< size_t > _gcParent
DMat< T > _qdd_from_subqdd
Class representing spatial inertia tensors.
vectorAligned< Mat6< T > > _Xuprot
void resetCalculationFlags()
vectorAligned< SVec< T > > _vrot
void setContactComputeFlag(size_t gc_index, bool flag)
void setState(const FBModelState< T > &state)
typename std::vector< T, Eigen::aligned_allocator< T >> vectorAligned
vectorAligned< D6Mat< T > > _J
vector< uint64_t > _footIndicesGC
vector< SpatialInertia< T >, Eigen::aligned_allocator< SpatialInertia< T > > > _Irot
vectorAligned< SVec< T > > _Jdqd
typename Eigen::Matrix< T, Eigen::Dynamic, 1 > DVec
vectorAligned< D3Mat< T > > _Jc
typename Eigen::Matrix< T, 10, 1 > MassProperties
FBModelState< T > _state
BEGIN ALGORITHM SUPPORT VARIABLES.
EIGEN_MAKE_ALIGNED_OPERATOR_NEW Quat< T > bodyOrientation
Utility functions for manipulating spatial quantities.
DMat< T > _qdd_from_base_accel
vector< JointType > _jointTypes