Prototypes for moveBodies and iterateDynamics. This is the heart of the dynamics engine, where all computations are performed. The design is fairly old and had not been update to an object-oriented more modular design, so the functions are hard to read through. However, they get the job done. More...
Go to the source code of this file.
Classes | |
struct | StructDynamicParameters |
Defines | |
#define | ERP 0.05 |
Typedefs | |
typedef struct StructDynamicParameters | DynamicParameters |
Functions | |
int | iterateDynamics (std::vector< Robot * > robotVec, std::vector< DynamicBody * > bodyVec, DynamicParameters *dp) |
Computes the new velocites of all bodies, based on contact and joint constraints. | |
int | moveBodies (int numBodies, std::vector< DynamicBody * > bodyVec, double h) |
Moves all dynamic bodies for one time step. |
Prototypes for moveBodies and iterateDynamics. This is the heart of the dynamics engine, where all computations are performed. The design is fairly old and had not been update to an object-oriented more modular design, so the functions are hard to read through. However, they get the job done.
Definition in file dynamics.h.
#define ERP 0.05 |
Definition at line 39 of file dynamics.h.
typedef struct StructDynamicParameters DynamicParameters |
int iterateDynamics | ( | std::vector< Robot * > | robotVec, | |
std::vector< DynamicBody * > | bodyVec, | |||
DynamicParameters * | dp | |||
) |
Computes the new velocites of all bodies, based on contact and joint constraints.
This routine builds a Linear Complementarity Problem (LCP) to solve for the velocities of each dynamic body in a given island of connected dynamic bodies (connected by joints or contacts). The robots and bodies in the island are passed to the routine in the vectors robotVec and bodyVec, and the integration time step h is also provided. The useContactEps flag determines whether error correction will be used for the contacts to ensure non-interpenetration. At the end of the routine, the velocity of each body is updated, as well as all contact and joint forces.
Definition at line 322 of file dynamics.cpp.
int moveBodies | ( | int | numBodies, | |
std::vector< DynamicBody * > | bodyVec, | |||
double | h | |||
) |
Moves all dynamic bodies for one time step.
Given a vector of pointers to dynamic bodies, and the number of bodies in the vector, this routine will move those bodies in the direction of their current velocity for the length of the timestep, h. It uses the pre-computed velocities and accelerations computed by iterateDynamics and stored for each body.
Definition at line 193 of file dynamics.cpp.