Cheetah Software
1.0
|
#include <DynamicsSimulator.h>
Public Member Functions | |
EIGEN_MAKE_ALIGNED_OPERATOR_NEW | DynamicsSimulator (FloatingBaseModel< T > &model, bool useSpringDamper=false) |
void | step (T dt, const DVec< T > &tau, T kp, T kd) |
Initialize simulator with given model. More... | |
void | runABA (const DVec< T > &tau) |
Simulate forward one step. More... | |
void | forwardKinematics () |
Do forward kinematics for feet. More... | |
void | integrate (T dt) |
Integrate to find new _state. More... | |
void | setState (const FBModelState< T > &state) |
void | setHoming (const RobotHomingInfo< T > &homing) |
const FBModelState< T > & | getState () const |
const FBModelStateDerivative< T > & | getDState () const |
void | setAllExternalForces (const vectorAligned< SVec< T >> &forces) |
void | addCollisionPlane (T mu, T rest, T height) |
void | addCollisionBox (T mu, T rest, T depth, T width, T height, const Vec3< T > &pos, const Mat3< T > &ori) |
void | addCollisionMesh (T mu, T rest, T grid_size, const Vec3< T > &left_corner_loc, const DMat< T > &height_map) |
size_t | getNumBodies () |
const size_t & | getTotalNumGC () |
const Vec3< T > & | getContactForce (size_t idx) |
const FloatingBaseModel< T > & | getModel () |
Private Member Functions | |
void | updateCollisions (T dt, T kp, T kd) |
Private Attributes | |
FBModelState< T > | _state |
Update ground collision list. More... | |
FBModelStateDerivative< T > | _dstate |
FloatingBaseModel< T > & | _model |
vector< CollisionPlane< T > > | _collisionPlanes |
ContactConstraint< T > * | _contact_constr |
SVec< T > | _lastBodyVelocity |
bool | _useSpringDamper |
RobotHomingInfo< T > | _homing |
Class (containing state) for dynamics simulation of a floating-base system
Definition at line 40 of file DynamicsSimulator.h.
DynamicsSimulator< T >::DynamicsSimulator | ( | FloatingBaseModel< T > & | model, |
bool | useSpringDamper = false |
||
) |
Initialize the dynamics simulator by allocating memory for ABA matrices
Definition at line 17 of file DynamicsSimulator.cpp.
References DynamicsSimulator< T >::_contact_constr, DynamicsSimulator< T >::_dstate, DynamicsSimulator< T >::_lastBodyVelocity, DynamicsSimulator< T >::_model, DynamicsSimulator< T >::_state, and DynamicsSimulator< T >::_useSpringDamper.
|
inline |
Definition at line 97 of file DynamicsSimulator.h.
|
inline |
Definition at line 104 of file DynamicsSimulator.h.
|
inline |
Definition at line 92 of file DynamicsSimulator.h.
|
inline |
Do forward kinematics for feet.
Definition at line 53 of file DynamicsSimulator.h.
|
inline |
Definition at line 114 of file DynamicsSimulator.h.
|
inline |
Get the most recently calculated state derivative (updated by runABA)
Definition at line 80 of file DynamicsSimulator.h.
|
inline |
|
inline |
|
inline |
Get the state of the robot
Definition at line 74 of file DynamicsSimulator.h.
|
inline |
void DynamicsSimulator< T >::integrate | ( | T | dt | ) |
Integrate to find new _state.
Integrate the floating base state
dt | timestep |
Definition at line 87 of file DynamicsSimulator.cpp.
References DynamicsSimulator< T >::_contact_constr, DynamicsSimulator< T >::_dstate, DynamicsSimulator< T >::_lastBodyVelocity, DynamicsSimulator< T >::_state, DynamicsSimulator< T >::_useSpringDamper, spatial::createSXform(), ori::integrateQuat(), ori::integrateQuatImplicit(), ori::quaternionToRotationMatrix(), spatial::rotationFromSXform(), and ori::X.
|
inline |
Simulate forward one step.
Find _dstate with the articulated body algorithm
Definition at line 50 of file DynamicsSimulator.h.
|
inline |
Add external forces. These are added on top of the ground reaction forces The i-th force is the spatial force applied to body i. This is cleared after each step of the simulator.
Definition at line 87 of file DynamicsSimulator.h.
|
inline |
|
inline |
Set the state of the robot being simulated
Definition at line 61 of file DynamicsSimulator.h.
void DynamicsSimulator< T >::step | ( | T | dt, |
const DVec< T > & | tau, | ||
T | kp, | ||
T | kd | ||
) |
Initialize simulator with given model.
Take one simulation step
dt | : timestep duration |
tau | : joint torques |
Definition at line 41 of file DynamicsSimulator.cpp.
References DynamicsSimulator< T >::_homing, DynamicsSimulator< T >::_model, DynamicsSimulator< T >::_state, f(), spatial::forceToSpatialForce(), DynamicsSimulator< T >::forwardKinematics(), DynamicsSimulator< T >::integrate(), ori::quatToso3(), ori::rotationMatrixToQuaternion(), ori::rpyToRotMat(), DynamicsSimulator< T >::runABA(), and DynamicsSimulator< T >::updateCollisions().
|
private |
Definition at line 77 of file DynamicsSimulator.cpp.
References DynamicsSimulator< T >::_contact_constr, and DynamicsSimulator< T >::_model.
|
private |
Definition at line 125 of file DynamicsSimulator.h.
|
private |
Definition at line 126 of file DynamicsSimulator.h.
|
private |
Definition at line 123 of file DynamicsSimulator.h.
|
private |
Definition at line 130 of file DynamicsSimulator.h.
|
private |
Definition at line 127 of file DynamicsSimulator.h.
|
private |
Definition at line 124 of file DynamicsSimulator.h.
|
private |
Update ground collision list.
Definition at line 122 of file DynamicsSimulator.h.
|
private |
Definition at line 128 of file DynamicsSimulator.h.