Drake
KinematicsCache< T > Class Template Reference

#include <drake/attic/multibody/kinematics_cache.h>

Classes

struct  DataInCalcFrameSpatialVelocityJacobianInWorldFrame
 Preallocated variables used in CalcFrameSpatialVelocityJacobianInWorldFrame. More...
 
struct  DataInGeometricJacobian
 Preallocated variables used in GeometricJacobian. More...
 

Public Member Functions

 KinematicsCache (int num_positions, int num_velocities, const std::vector< int > &num_joint_positions, const std::vector< int > &num_joint_velocities)
 Constructor for a KinematicsCache given the number of positions and velocities per body in the vectors num_joint_positions and num_joint_velocities, respectively. More...
 
void CreateCacheElement (int num_positions, int num_velocities)
 Requests a cache entry for a body mobilized by a joint with num_positions and num_velocities. More...
 
const KinematicsCacheElement< T > & get_element (int body_id) const
 Returns constant reference to a cache entry for body body_id. More...
 
KinematicsCacheElement< T > * get_mutable_element (int body_id)
 Returns mutable pointer to a cache entry for body body_id. More...
 
template<typename Derived >
void initialize (const Eigen::MatrixBase< Derived > &q_in)
 
template<typename DerivedQ , typename DerivedV >
void initialize (const Eigen::MatrixBase< DerivedQ > &q_in, const Eigen::MatrixBase< DerivedV > &v_in)
 
void checkCachedKinematicsSettings (bool velocity_kinematics_required, bool jdot_times_v_required, const char *method_name) const
 
const Eigen::Matrix< T, Eigen::Dynamic, 1 > & getQ () const
 Returns q, the generalized position vector of the RigidBodyTree that was used to compute this KinematicsCache. More...
 
const Eigen::Matrix< T, Eigen::Dynamic, 1 > & getV () const
 Returns v, the generalized velocity vector of the RigidBodyTree that was used to compute this KinematicsCache. More...
 
Eigen::Matrix< T, Eigen::Dynamic, 1 > getX () const
 Returns x, the state vector of the RigidBodyTree that was used to compute this KinematicsCache. More...
 
bool hasV () const
 Returns true if this KinematicsCache object has a valid v vector. More...
 
void setInertiasCached ()
 
bool areInertiasCached ()
 
void setPositionKinematicsCached ()
 
void setJdotVCached (bool jdotV_cached_in)
 
int get_num_cache_elements () const
 
int get_num_positions () const
 
int getNumPositions () const
 
int get_num_velocities () const
 
int getNumVelocities () const
 

Public Attributes

Preallocated scratch pad variables.

These variables are used to prevent dynamic memory allocation during runtime.

DataInGeometricJacobian geometric_jacobian_temp
 
DataInCalcFrameSpatialVelocityJacobianInWorldFrame spatial_velocity_jacobian_temp
 

Constructor & Destructor Documentation

◆ KinematicsCache()

KinematicsCache ( int  num_positions,
int  num_velocities,
const std::vector< int > &  num_joint_positions,
const std::vector< int > &  num_joint_velocities 
)

Constructor for a KinematicsCache given the number of positions and velocities per body in the vectors num_joint_positions and num_joint_velocities, respectively.

For a RigidBodyTree with nbodies rigid bodies, num_joint_positions and num_joint_velocities are vectors of size nbodies containing in the i-th entry the number of positions and the number of velocities for the i-th RigidBody in the RigidBodyTree.

Note that you will typically not create a KinematicsCache object using this constructor. Instead, you usually obtain a KinematicsCache object by calling RigidBodyTree::CreateKinematicsCache() or RigidBodyTree::CreateKinematicsCacheWithType(). The second option is useful if you need a particular type for your cache like Eigen::AutoDiffScalar.

For examples on how to create and use the KinematicsCache, see rigid_body_tree_dynamics_test.cc and rigid_body_tree_kinematics_test.cc.

Parameters
num_positionsTotal number of positions in the RigidBodyTree.
num_velocitiesTotal number of velocities in the RigidBodyTree.
num_joint_positionsA std::vector<int> containing in the i-th entry the number of positions for the i-th body in the RigidBodyTree.
num_joint_velocitiesA std::vector<int> containing in the i-th entry the number of velocities for the i-th body in the RigidBodyTree.

Member Function Documentation

◆ areInertiasCached()

bool areInertiasCached ( )

◆ checkCachedKinematicsSettings()

void checkCachedKinematicsSettings ( bool  velocity_kinematics_required,
bool  jdot_times_v_required,
const char *  method_name 
) const

◆ CreateCacheElement()

void CreateCacheElement ( int  num_positions,
int  num_velocities 
)

Requests a cache entry for a body mobilized by a joint with num_positions and num_velocities.

◆ get_element()

const KinematicsCacheElement< T > & get_element ( int  body_id) const

Returns constant reference to a cache entry for body body_id.

◆ get_mutable_element()

KinematicsCacheElement< T > * get_mutable_element ( int  body_id)

Returns mutable pointer to a cache entry for body body_id.

◆ get_num_cache_elements()

int get_num_cache_elements ( ) const

◆ get_num_positions()

int get_num_positions ( ) const

◆ get_num_velocities()

int get_num_velocities ( ) const

◆ getNumPositions()

int getNumPositions ( ) const

◆ getNumVelocities()

int getNumVelocities ( ) const

◆ getQ()

const Eigen::Matrix< T, Eigen::Dynamic, 1 > & getQ ( ) const

Returns q, the generalized position vector of the RigidBodyTree that was used to compute this KinematicsCache.

◆ getV()

const Eigen::Matrix< T, Eigen::Dynamic, 1 > & getV ( ) const

Returns v, the generalized velocity vector of the RigidBodyTree that was used to compute this KinematicsCache.

◆ getX()

Eigen::Matrix< T, Eigen::Dynamic, 1 > getX ( ) const

Returns x, the state vector of the RigidBodyTree that was used to compute this KinematicsCache.

This is the concatenation of q, the RigidBodyTree's generalized position vector, and v the RigidBodyTree's generalized velocity vector into a single vector. Within x, q precedes v.

◆ hasV()

bool hasV ( ) const

Returns true if this KinematicsCache object has a valid v vector.

v is the generalized velocity vector of the RigidBodyTree that was used to compute this KinematicsCache.

◆ initialize() [1/2]

void initialize ( const Eigen::MatrixBase< Derived > &  q_in)

◆ initialize() [2/2]

void initialize ( const Eigen::MatrixBase< DerivedQ > &  q_in,
const Eigen::MatrixBase< DerivedV > &  v_in 
)

◆ setInertiasCached()

void setInertiasCached ( )

◆ setJdotVCached()

void setJdotVCached ( bool  jdotV_cached_in)

◆ setPositionKinematicsCached()

void setPositionKinematicsCached ( )

Member Data Documentation

◆ geometric_jacobian_temp

DataInGeometricJacobian geometric_jacobian_temp
mutable

◆ spatial_velocity_jacobian_temp

DataInCalcFrameSpatialVelocityJacobianInWorldFrame spatial_velocity_jacobian_temp
mutable

The documentation for this class was generated from the following files: