Drake
MobilizerImpl< T, compile_time_num_positions, compile_time_num_velocities > Class Template Reference

Base class for specific Mobilizer implementations with the number of generalized positions and velocities resolved at compile time as template parameters. More...

#include <drake/multibody/multibody_tree/mobilizer_impl.h>

Inheritance diagram for MobilizerImpl< T, compile_time_num_positions, compile_time_num_velocities >:
[legend]
Collaboration diagram for MobilizerImpl< T, compile_time_num_positions, compile_time_num_velocities >:
[legend]

Public Member Functions

 MobilizerImpl (const Frame< T > &inboard_frame, const Frame< T > &outboard_frame)
 As with Mobilizer this the only constructor available for this base class. More...
 
int num_positions () const final
 Returns the number of generalized coordinates granted by this mobilizer. More...
 
int num_velocities () const final
 Returns the number of generalized velocities granted by this mobilizer. More...
 
std::unique_ptr< internal::BodyNode< T > > CreateBodyNode (const internal::BodyNode< T > *parent_node, const Body< T > *body, const Mobilizer< T > *mobilizer) const final
 For MultibodyTree internal use only. More...
 
Does not allow copy, move, or assignment
 MobilizerImpl (const MobilizerImpl &)=delete
 
MobilizerImploperator= (const MobilizerImpl &)=delete
 
 MobilizerImpl (MobilizerImpl &&)=delete
 
MobilizerImploperator= (MobilizerImpl &&)=delete
 
- Public Member Functions inherited from Mobilizer< T >
 Mobilizer (const Frame< T > &inboard_frame, const Frame< T > &outboard_frame)
 The minimum amount of information that we need to define a Mobilizer is the knowledge of the inboard and outboard frames it connects. More...
 
const Frame< T > & inboard_frame () const
 Returns a constant reference to the inboard frame. More...
 
const Frame< T > & outboard_frame () const
 Returns a constant reference to the outboard frame. More...
 
const Body< T > & inboard_body () const
 Returns a constant reference to the body associated with this mobilizer's inboard frame. More...
 
const Body< T > & outboard_body () const
 Returns a constant reference to the body associated with this mobilizer's outboard frame. More...
 
const MobilizerTopologyget_topology () const
 Returns the topology information for this mobilizer. More...
 
Eigen::VectorBlock< const Eigen::Ref< const VectorX< T > > > get_positions_from_array (const Eigen::Ref< const VectorX< T >> &q_array) const
 Returns a const Eigen expression of the vector of generalized positions for this mobilizer from a vector q_array of generalized positions for the entire MultibodyTree model. More...
 
Eigen::VectorBlock< Eigen::Ref< VectorX< T > > > get_mutable_positions_from_array (EigenPtr< VectorX< T >> q_array) const
 Mutable version of get_positions_from_array(). More...
 
Eigen::VectorBlock< const Eigen::Ref< const VectorX< T > > > get_velocities_from_array (const Eigen::Ref< const VectorX< T >> &v_array) const
 Returns a const Eigen expression of the vector of generalized velocities for this mobilizer from a vector v_array of generalized velocities for the entire MultibodyTree model. More...
 
Eigen::VectorBlock< Eigen::Ref< VectorX< T > > > get_mutable_velocities_from_array (EigenPtr< VectorX< T >> v_array) const
 Mutable version of get_velocities_from_array(). More...
 
Eigen::VectorBlock< const Eigen::Ref< const VectorX< T > > > get_accelerations_from_array (const Eigen::Ref< const VectorX< T >> &vdot_array) const
 Returns a const Eigen expression of the vector of generalized accelerations for this mobilizer from a vector vdot_array of generalized accelerations for the entire MultibodyTree model. More...
 
Eigen::VectorBlock< Eigen::Ref< VectorX< T > > > get_mutable_accelerations_from_array (EigenPtr< VectorX< T >> vdot_array) const
 Mutable version of get_accelerations_from_array(). More...
 
Eigen::VectorBlock< const Eigen::Ref< const VectorX< T > > > get_generalized_forces_from_array (const Eigen::Ref< const VectorX< T >> &tau_array) const
 Returns a const Eigen expression of the vector of generalized forces for this mobilizer from a vector of generalized forces for the entire MultibodyTree model. More...
 
Eigen::VectorBlock< Eigen::Ref< VectorX< T > > > get_mutable_generalized_forces_from_array (EigenPtr< VectorX< T >> tau_array) const
 Mutable version of get_generalized_forces_from_array(). More...
 
template<typename ToScalar >
std::unique_ptr< Mobilizer< ToScalar > > CloneToScalar (const MultibodyTree< ToScalar > &cloned_tree) const
 NVI to DoCloneToScalar() templated on the scalar type of the new clone to be created. More...
 
 Mobilizer (const Mobilizer &)=delete
 
Mobilizeroperator= (const Mobilizer &)=delete
 
 Mobilizer (Mobilizer &&)=delete
 
Mobilizeroperator= (Mobilizer &&)=delete
 
virtual void set_zero_state (const systems::Context< T > &context, systems::State< T > *state) const =0
 Sets the state to what will be considered to be the zero configuration for this mobilizer. More...
 
void set_zero_configuration (systems::Context< T > *context) const
 Sets the state stored in context to a zero configuration as defined by set_zero_state(). More...
 
virtual Isometry3< T > CalcAcrossMobilizerTransform (const MultibodyTreeContext< T > &context) const =0
 Computes the across-mobilizer transform X_FM(q) between the inboard frame F and the outboard frame M as a function of the vector of generalized postions q. More...
 
virtual SpatialVelocity< T > CalcAcrossMobilizerSpatialVelocity (const MultibodyTreeContext< T > &context, const Eigen::Ref< const VectorX< T >> &v) const =0
 Computes the across-mobilizer spatial velocity V_FM(q, v) of the outboard frame M in the inboard frame F. More...
 
virtual SpatialAcceleration< T > CalcAcrossMobilizerSpatialAcceleration (const MultibodyTreeContext< T > &context, const Eigen::Ref< const VectorX< T >> &vdot) const =0
 Computes the across-mobilizer spatial accelerations A_FM(q, v, v̇) of the outboard frame M in the inboard frame F. More...
 
virtual void ProjectSpatialForce (const MultibodyTreeContext< T > &context, const SpatialForce< T > &F_Mo_F, Eigen::Ref< VectorX< T >> tau) const =0
 Projects the spatial force F_Mo on this mobilizer's outboard frame M onto the sub-space of motions spanned by the geometric Jacobian H_FM(q) to obtain the generalized forces tau (i.e. More...
 
virtual void MapVelocityToQDot (const MultibodyTreeContext< T > &context, const Eigen::Ref< const VectorX< T >> &v, EigenPtr< VectorX< T >> qdot) const =0
 Computes the kinematic mapping q̇ = N(q)⋅v between generalized velocities v and time derivatives of the generalized positions qdot. More...
 
virtual void MapQDotToVelocity (const MultibodyTreeContext< T > &context, const Eigen::Ref< const VectorX< T >> &qdot, EigenPtr< VectorX< T >> v) const =0
 Computes the mapping v = N⁺(q)⋅q̇ from time derivatives of the generalized positions qdot to generalized velocities v, where N⁺(q) is the left pseudo-inverse of N(q) defined by MapVelocityToQDot(). More...
 

Protected Types

enum  : int { kNq = compile_time_num_positions, kNv = compile_time_num_velocities }
 

Protected Member Functions

MultibodyTreeContext< T > & GetMutableMultibodyTreeContextOrThrow (systems::Context< T > *context) const
 Helper method to retrieve a mutable pointer to the MultibodyTreeContext object referenced by context. More...
 
void set_default_zero_state (const systems::Context< T > &context, systems::State< T > *state) const
 Helper to set state to a default zero state with all generalized positions and generalized velocities related to this mobilizer to zero. More...
 
Helper methods to retrieve entries from MultibodyTreeContext.
Eigen::VectorBlock< const VectorX< T >, kNqget_positions (const MultibodyTreeContext< T > &context) const
 Helper to return a const fixed-size Eigen::VectorBlock referencing the segment in the state vector corresponding to this mobilizer's state. More...
 
Eigen::VectorBlock< VectorX< T >, kNqget_mutable_positions (MultibodyTreeContext< T > *context) const
 Helper to return a mutable fixed-size Eigen::VectorBlock referencing the segment in the state vector corresponding to this mobilizer's state. More...
 
Eigen::VectorBlock< VectorX< T > > get_mutable_state_vector (const systems::Context< T > &context, systems::State< T > *state) const
 Returns a mutable reference to the state vector stored in state as an Eigen::VectorBlock<VectorX<T>>. More...
 
Eigen::VectorBlock< VectorX< T >, kNqget_mutable_positions (const systems::Context< T > &context, systems::State< T > *state) const
 Helper variant to return a const fixed-size Eigen::VectorBlock referencing the segment in the state corresponding to this mobilizer's generalized positions. More...
 
Eigen::VectorBlock< VectorX< T >, kNvget_mutable_velocities (const systems::Context< T > &context, systems::State< T > *state) const
 Helper variant to return a const fixed-size Eigen::VectorBlock referencing the segment in the state corresponding to this mobilizer's generalized velocities. More...
 
Eigen::VectorBlock< const VectorX< T >, kNvget_velocities (const MultibodyTreeContext< T > &context) const
 Helper to return a const fixed-size Eigen::VectorBlock referencing the segment in the state vector corresponding to this mobilizer's state. More...
 
Eigen::VectorBlock< VectorX< T >, kNvget_mutable_velocities (MultibodyTreeContext< T > *context) const
 Helper to return a mutable fixed-size Eigen::VectorBlock referencing the segment in the state vector corresponding to this mobilizer's state. More...
 
- Protected Member Functions inherited from Mobilizer< T >
virtual std::unique_ptr< Mobilizer< double > > DoCloneToScalar (const MultibodyTree< double > &tree_clone) const =0
 Clones this Mobilizer (templated on T) to a mobilizer templated on double. More...
 
virtual std::unique_ptr< Mobilizer< AutoDiffXd > > DoCloneToScalar (const MultibodyTree< AutoDiffXd > &tree_clone) const =0
 Clones this Mobilizer (templated on T) to a mobilizer templated on AutoDiffXd. More...
 

Static Protected Member Functions

static const MultibodyTreeContext< T > & GetMultibodyTreeContextOrThrow (const systems::Context< T > &context)
 Helper method to retrieve a const reference to the MultibodyTreeContext object referenced by context. More...
 

Detailed Description

template<typename T, int compile_time_num_positions, int compile_time_num_velocities>
class drake::multibody::MobilizerImpl< T, compile_time_num_positions, compile_time_num_velocities >

Base class for specific Mobilizer implementations with the number of generalized positions and velocities resolved at compile time as template parameters.

This allows specific mobilizer implementations to only work on fixed-size Eigen expressions therefore allowing for optimized operations on fixed-size matrices. In addition, this layer discourages the proliferation of dynamic-sized Eigen matrices that would otherwise lead to run-time dynamic memory allocations. MobilizerImpl also provides a number of size specific methods to retrieve multibody quantities of interest from caching structures. These are common to all mobilizer implementations and therefore they live in this class. Users should not need to interact with this class directly unless they need to implement a custom Mobilizer class.

Template Parameters
TThe scalar type. Must be a valid Eigen scalar.

Member Enumeration Documentation

anonymous enum : int
protected
Enumerator
kNq 
kNv 

Constructor & Destructor Documentation

MobilizerImpl ( const MobilizerImpl< T, compile_time_num_positions, compile_time_num_velocities > &  )
delete
MobilizerImpl ( MobilizerImpl< T, compile_time_num_positions, compile_time_num_velocities > &&  )
delete
MobilizerImpl ( const Frame< T > &  inboard_frame,
const Frame< T > &  outboard_frame 
)
inline

As with Mobilizer this the only constructor available for this base class.

The minimum amount of information that we need to define a mobilizer is the knowledge of the inboard and outboard frames it connects. Subclasses of MobilizerImpl are therefore forced to provide this information in their respective constructors.

Member Function Documentation

std::unique_ptr< internal::BodyNode< T > > CreateBodyNode ( const internal::BodyNode< T > *  parent_node,
const Body< T > *  body,
const Mobilizer< T > *  mobilizer 
) const
finalvirtual

For MultibodyTree internal use only.

Implements Mobilizer< T >.

Here is the call graph for this function:

Here is the caller graph for this function:

Eigen::VectorBlock<VectorX<T>, kNq> get_mutable_positions ( MultibodyTreeContext< T > *  context) const
inlineprotected

Helper to return a mutable fixed-size Eigen::VectorBlock referencing the segment in the state vector corresponding to this mobilizer's state.

Here is the caller graph for this function:

Eigen::VectorBlock<VectorX<T>, kNq> get_mutable_positions ( const systems::Context< T > &  context,
systems::State< T > *  state 
) const
inlineprotected

Helper variant to return a const fixed-size Eigen::VectorBlock referencing the segment in the state corresponding to this mobilizer's generalized positions.

Eigen::VectorBlock<VectorX<T> > get_mutable_state_vector ( const systems::Context< T > &  context,
systems::State< T > *  state 
) const
inlineprotected

Returns a mutable reference to the state vector stored in state as an Eigen::VectorBlock<VectorX<T>>.

Here is the caller graph for this function:

Eigen::VectorBlock<VectorX<T>, kNv> get_mutable_velocities ( const systems::Context< T > &  context,
systems::State< T > *  state 
) const
inlineprotected

Helper variant to return a const fixed-size Eigen::VectorBlock referencing the segment in the state corresponding to this mobilizer's generalized velocities.

Here is the caller graph for this function:

Eigen::VectorBlock<VectorX<T>, kNv> get_mutable_velocities ( MultibodyTreeContext< T > *  context) const
inlineprotected

Helper to return a mutable fixed-size Eigen::VectorBlock referencing the segment in the state vector corresponding to this mobilizer's state.

Eigen::VectorBlock<const VectorX<T>, kNq> get_positions ( const MultibodyTreeContext< T > &  context) const
inlineprotected

Helper to return a const fixed-size Eigen::VectorBlock referencing the segment in the state vector corresponding to this mobilizer's state.

Eigen::VectorBlock<const VectorX<T>, kNv> get_velocities ( const MultibodyTreeContext< T > &  context) const
inlineprotected

Helper to return a const fixed-size Eigen::VectorBlock referencing the segment in the state vector corresponding to this mobilizer's state.

static const MultibodyTreeContext<T>& GetMultibodyTreeContextOrThrow ( const systems::Context< T > &  context)
inlinestaticprotected

Helper method to retrieve a const reference to the MultibodyTreeContext object referenced by context.

Exceptions
<tt>std::logic_error</tt>if context is not a MultibodyTreeContext object.

Here is the caller graph for this function:

MultibodyTreeContext<T>& GetMutableMultibodyTreeContextOrThrow ( systems::Context< T > *  context) const
inlineprotected

Helper method to retrieve a mutable pointer to the MultibodyTreeContext object referenced by context.

Exceptions
<tt>std::logic_error</tt>if context is not a MultibodyTreeContext object.
int num_positions ( ) const
inlinefinalvirtual

Returns the number of generalized coordinates granted by this mobilizer.

Implements Mobilizer< T >.

int num_velocities ( ) const
inlinefinalvirtual

Returns the number of generalized velocities granted by this mobilizer.

Implements Mobilizer< T >.

MobilizerImpl& operator= ( const MobilizerImpl< T, compile_time_num_positions, compile_time_num_velocities > &  )
delete
MobilizerImpl& operator= ( MobilizerImpl< T, compile_time_num_positions, compile_time_num_velocities > &&  )
delete
void set_default_zero_state ( const systems::Context< T > &  context,
systems::State< T > *  state 
) const
inlineprotected

Helper to set state to a default zero state with all generalized positions and generalized velocities related to this mobilizer to zero.

Be aware however that this default does not apply in general to all mobilizers and specific subclasses (for instance for unit quaternions) must override this method for correctness.


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