Drake
drake::benchmarks::free_body Namespace Reference

Classes

class  FreeBody
 The purpose of the FreeBody class is to provide the data (initial values and gravity) and methods for calculating the exact analytical solution for the translational and rotational motion of a toque-free rigid body B with axially symmetric inertia, in a Newtonian frame (World) N. More...
 

Functions

void TestDrakeSolutionVsExactSolutionForTorqueFreeCylinder (const drake::systems::RigidBodyPlant< double > &rigid_body_plant, const drake::systems::Context< double > &context, const FreeBody &torque_free_cylinder_solution, const double tolerance, drake::systems::ContinuousState< double > *stateDt_drake)
 This function tests Drake solution versus an exact solution for torque-free motion of axis-symmetric uniform rigid cylinder B in Newtonian frame/World N, where torque-free means the moment of forces about B's mass center is zero. More...
 
void IntegrateForwardWithVariableStepRungeKutta3 (const drake::systems::RigidBodyPlant< double > &rigid_body_plant, const double dt_max, const double t_final, const double maximum_absolute_error_per_integration_step, const FreeBody &torque_free_cylinder_solution, drake::systems::Context< double > *context, drake::systems::ContinuousState< double > *stateDt_drake)
 Numerically integrate rigid body plant's equations of motion from time t = 0 to time t_final with a 3rd-order variable-step Runge-Kutta integrator. More...
 
void TestDrakeSolutionForSpecificInitialValue (const drake::systems::RigidBodyPlant< double > &rigid_body_plant, const FreeBody &torque_free_cylinder_solution, const bool should_numerically_integrate, drake::systems::Context< double > *context, drake::systems::ContinuousState< double > *stateDt_drake)
 This function tests Drake's calculation of the time-derivative of the state at an initial condition, and depending on should_numerically_integrate, also tests Drake's numerical integration of the rigid body's equations of motion. More...
 
void TestDrakeSolutionForVariousInitialValues (const drake::systems::RigidBodyPlant< double > &rigid_body_plant, drake::systems::Context< double > *context, drake::systems::ContinuousState< double > *stateDt_drake)
 This function sets up various initial values for Drake to test against an exact solution. More...
 
 GTEST_TEST (uniformSolidCylinderTorqueFree, testA)
 This function tests Drake's simulation of the motion of an axis-symmetric rigid body B (uniform cylinder) in a Newtonian frame (World) N. More...
 

Function Documentation

drake::benchmarks::free_body::GTEST_TEST ( uniformSolidCylinderTorqueFree  ,
testA   
)

This function tests Drake's simulation of the motion of an axis-symmetric rigid body B (uniform cylinder) in a Newtonian frame (World) N.

Since the only external forces on B are uniform gravitational forces, the moment of all forces about B's mass center is zero ("torque-free"), there exists an exact closed-form analytical solution for B's motion. Specifically, this function tests Drake's solution against an exact solution for: quaternion, angular velocity, and angular acceleration expressed in B (body-frame); position, velocity, and acceleration expressed in N (World). Algorithm from [Kane, 1983] Sections 1.13 and 3.1, Pages 60-62 and 159-169.

Here is the call graph for this function:

void drake::benchmarks::free_body::IntegrateForwardWithVariableStepRungeKutta3 ( const drake::systems::RigidBodyPlant< double > &  rigid_body_plant,
const double  dt_max,
const double  t_final,
const double  maximum_absolute_error_per_integration_step,
const FreeBody torque_free_cylinder_solution,
drake::systems::Context< double > *  context,
drake::systems::ContinuousState< double > *  stateDt_drake 
)

Numerically integrate rigid body plant's equations of motion from time t = 0 to time t_final with a 3rd-order variable-step Runge-Kutta integrator.

Parameters
[in]rigid_body_plantA reference to the rigid-body system being simulated.
[in]dt_maxThe maximum (fixed) step size taken by the integrator. Note: t_final is not an exact multiple of dt, the final integration step is adjusted.
[in]t_finalValue of time that signals the simulation to stop. t_final is not required to be an exact multiple of dt_max as the integration step is adjusted as necessary to land at exactly t_final.
[in]maximum_absolute_error_per_integration_stepMaximum allowable absolute error (for any variable being integrated) for the numerical-integrator's internal time-step (which can shrink or grow).
[in]torque_free_cylinder_solutionData and methods calculate exact solution at time t.
[in,out]contextOn entry, context should be properly filled with all input to System (input ports, parameters, time = 0.0, state). On output, context has been changed so its time = t_final and its state has been updated.
[out]stateDt_drakeOn output, stores time-derivatives of state.

Here is the call graph for this function:

Here is the caller graph for this function:

void drake::benchmarks::free_body::TestDrakeSolutionForSpecificInitialValue ( const drake::systems::RigidBodyPlant< double > &  rigid_body_plant,
const FreeBody torque_free_cylinder_solution,
const bool  should_numerically_integrate,
drake::systems::Context< double > *  context,
drake::systems::ContinuousState< double > *  stateDt_drake 
)

This function tests Drake's calculation of the time-derivative of the state at an initial condition, and depending on should_numerically_integrate, also tests Drake's numerical integration of the rigid body's equations of motion.

Parameters
[in]rigid_body_plantA reference to the rigid-body system being simulated.
[in]torque_free_cylinder_solutionData and methods calculate exact solution at time t.
[in]should_numerically_integrateTrue if also simulate x seconds and check accuracy of simulation results.
[in,out]contextOn entry, context is properly sized for all input to System (input ports, parameters, time, state). On output, context may be changed with specific values of time and state.
[out]stateDt_drakeOn output, stores time-derivatives of state.

Here is the call graph for this function:

Here is the caller graph for this function:

void drake::benchmarks::free_body::TestDrakeSolutionForVariousInitialValues ( const drake::systems::RigidBodyPlant< double > &  rigid_body_plant,
drake::systems::Context< double > *  context,
drake::systems::ContinuousState< double > *  stateDt_drake 
)

This function sets up various initial values for Drake to test against an exact solution.

For one (mostly arbitrary) initial value, this also tests Drake's numerical integration of the rigid body's equations of motion.

Parameters
[in]rigid_body_plantA reference to the rigid-body system being simulated.
[in,out]contextOn entry, context is properly sized for all input to System (input ports, parameters, time, state). On output, context may be changed with specific values of time and state.
[out]stateDt_drakeOn output, stores time-derivatives of state.

Here is the call graph for this function:

Here is the caller graph for this function:

void drake::benchmarks::free_body::TestDrakeSolutionVsExactSolutionForTorqueFreeCylinder ( const drake::systems::RigidBodyPlant< double > &  rigid_body_plant,
const drake::systems::Context< double > &  context,
const FreeBody torque_free_cylinder_solution,
const double  tolerance,
drake::systems::ContinuousState< double > *  stateDt_drake 
)

This function tests Drake solution versus an exact solution for torque-free motion of axis-symmetric uniform rigid cylinder B in Newtonian frame/World N, where torque-free means the moment of forces about B's mass center is zero.

Parameters
[in]rigid_body_plantA reference to the rigid-body being simulated.
[in]contextAll input to System (input ports, parameters, time, state) with cache for computations dependent on these values.
[in]torque_free_cylinder_solutionClass that stores initial values, gravity, and methods to calculation the exact solution at time t.
[in]toleranceMinimum tolerance required to match results.
[out]stateDt_drakeOn output, stores derivative values at t = t_final.

Here is the call graph for this function:

Here is the caller graph for this function: