7 #ifndef RC_ARTICULATED_BODY
8 #error This class is not to be included by the user directly. Use RCArticulatedBodyd.h or RCArticulatedBodyf.h instead.
35 enum ForwardDynamicsAlgorithmType { eFeatherstone, eCRB };
43 boost::shared_ptr<RC_ARTICULATED_BODY> get_this() {
return boost::dynamic_pointer_cast<
RC_ARTICULATED_BODY>(shared_from_this()); }
44 boost::shared_ptr<const RC_ARTICULATED_BODY> get_this()
const {
return boost::dynamic_pointer_cast<
const RC_ARTICULATED_BODY>(shared_from_this()); }
62 virtual void set_links_and_joints(
const std::vector<boost::shared_ptr<RIGIDBODY> >& links,
const std::vector<boost::shared_ptr<JOINT> >& joints);
71 virtual boost::shared_ptr<const POSE3>
get_gc_pose()
const;
103 virtual boost::shared_ptr<RIGIDBODY>
get_base_link()
const {
return (!
_links.empty()) ?
_links.front() : boost::shared_ptr<RIGIDBODY>(); }
139 boost::shared_ptr<LINALG>
_LA;
144 virtual MATRIXN& calc_jacobian_column(boost::shared_ptr<JOINT> joint,
const VECTOR3& point,
MATRIXN& Jc);
148 bool all_children_processed(boost::shared_ptr<RIGIDBODY> link)
const;
150 static REAL sgn(REAL x);
151 bool treat_link_as_leaf(boost::shared_ptr<RIGIDBODY> link)
const;
152 void update_factorized_generalized_inertia();
153 static bool supports(boost::shared_ptr<JOINT> joint, boost::shared_ptr<RIGIDBODY> link);
154 void determine_generalized_forces(
VECTORN& gf)
const;
155 void determine_generalized_accelerations(
VECTORN& xdd)
const;
156 void determine_constraint_force_transform(
MATRIXN& K)
const;
157 void determine_implicit_constraint_movement_jacobian(
MATRIXN& D);
158 void determine_implicit_constraint_jacobian(
MATRIXN& J);
159 void determine_implicit_constraint_jacobian_dot(
MATRIXN& J);
160 void set_implicit_constraint_forces(
const VECTORN& lambda);
163 #include "RCArticulatedBody.inl"
virtual void set_generalized_coordinates_euler(const SHAREDVECTORN &gc)=0
Sets the generalized coordinates of this body (using Euler parameters for any rigid body orientations...
virtual VECTORN & get_generalized_coordinates_euler(VECTORN &gc)
Gets the generalized coordinates of this body (using Euler parameters for any rigid body orientations...
Definition: RCArticulatedBody.h:74
void set_generalized_coordinates_euler_generic(V &gc)
Sets the generalized position of this body.
Definition: RCArticulatedBody.inl:96
virtual void add_generalized_force(const VECTORN &gf)
Adds a generalized force to the body.
Definition: RCArticulatedBody.h:48
Abstract class for articulated bodies.
Definition: ArticulatedBody.h:15
virtual SHAREDVECTORN & convert_to_generalized_force(boost::shared_ptr< SINGLE_BODY > body, const SFORCE &w, SHAREDVECTORN &gf)=0
Converts a force to a generalized force.
RC_ARTICULATED_BODY()
Default constructor.
Definition: RCArticulatedBody.cpp:20
Computes forward dynamics using composite-rigid body method.
Definition: CRBAlgorithm.h:12
virtual unsigned num_generalized_coordinates(DYNAMIC_BODY::GeneralizedCoordinateType gctype) const
Gets the number of generalized coordinates for this body.
Definition: RCArticulatedBody.cpp:82
boost::shared_ptr< LINALG > _LA
Linear algebra object.
Definition: RCArticulatedBody.h:139
ForwardDynamicsAlgorithmType algorithm_type
The forward dynamics algorithm.
Definition: RCArticulatedBody.h:106
virtual void set_computation_frame_type(ReferenceFrameType rftype)
Sets the computation frame type.
Definition: RCArticulatedBody.cpp:54
virtual VECTORN & solve_generalized_inertia(const VECTORN &b, VECTORN &x)
Solves using the inverse generalized inertia.
Definition: RCArticulatedBody.h:67
virtual void update_link_velocities()
Updates the link velocities.
Definition: RCArticulatedBody.cpp:619
void set_generalized_acceleration(const SHAREDVECTORN &a)
Sets the generalized acceleration for this body.
Definition: RCArticulatedBody.cpp:1129
virtual VECTORN & get_generalized_acceleration(VECTORN &ga)
Gets the generalized acceleration of this body.
Definition: RCArticulatedBody.h:79
void get_generalized_velocity_generic(DYNAMIC_BODY::GeneralizedCoordinateType gctype, V &gv)
Gets the generalized velocity of this body.
Definition: RCArticulatedBody.inl:146
VECTORN gc
Temporaries for use with integration.
Definition: DynamicBody.h:330
A spatial (six dimensional) momentum.
Definition: SMomentum.h:12
virtual bool is_floating_base() const
Gets whether the base of this body is fixed or "floating".
Definition: RCArticulatedBody.h:97
virtual SHAREDVECTORN & get_generalized_velocity(DYNAMIC_BODY::GeneralizedCoordinateType gctype, SHAREDVECTORN &gv)
Gets the generalized velocity of this body.
Definition: RCArticulatedBody.cpp:1197
virtual SHAREDMATRIXN & solve_generalized_inertia(const SHAREDMATRIXN &B, SHAREDMATRIXN &X)=0
Solves using the inverse generalized inertia.
virtual SHAREDVECTORN & get_generalized_velocity(GeneralizedCoordinateType gctype, SHAREDVECTORN &gv)=0
Gets the generalized velocity of this body.
virtual const std::vector< boost::shared_ptr< JOINT > > & get_implicit_joints() const
Gets the vector of explicit joint constraints.
Definition: RCArticulatedBody.h:112
virtual SHAREDVECTORN & get_generalized_coordinates_euler(SHAREDVECTORN &gc)=0
Gets the generalized coordinates of this body (using Euler parameters for any rigid body orientations...
virtual SHAREDVECTORN & convert_to_generalized_force(boost::shared_ptr< SINGLE_BODY > body, const SFORCE &w, SHAREDVECTORN &gf)
Converts a force to a generalized force.
virtual void set_generalized_coordinates_euler(const SHAREDVECTORN &gc)
Sets the generalized position of this body.
Definition: RCArticulatedBody.cpp:1185
virtual void calc_fwd_dyn()
Computes the forward dynamics.
Definition: RCArticulatedBody.cpp:907
std::vector< boost::shared_ptr< JOINT > > _ejoints
The vector of explicit joint constraints.
Definition: RCArticulatedBody.h:124
virtual SHAREDMATRIXN & transpose_solve_generalized_inertia(const SHAREDMATRIXN &B, SHAREDMATRIXN &X)
Solves the transpose using a generalized inertia matrix.
Definition: RCArticulatedBody.cpp:155
A generic, possibly non-square matrix.
Definition: MatrixN.h:18
void get_generalized_coordinates_euler_generic(V &gc)
Gets the generalized coordinates of this body.
Definition: RCArticulatedBody.inl:70
virtual SHAREDVECTORN & get_generalized_forces(SHAREDVECTORN &f)=0
Gets the external forces on this body.
virtual void add_generalized_force(const SHAREDVECTORN &gf)=0
Adds a generalized force to the body.
bool _position_invalidated
Indicates when position data has been invalidated.
Definition: RCArticulatedBody.h:130
virtual void validate_position_variables()
Validates position variables.
Definition: RCArticulatedBody.cpp:39
virtual void apply_impulse(const SMOMENTUM &w, boost::shared_ptr< RIGIDBODY > link)
Abstract method for applying an impulse to this articulated body.
virtual SHAREDVECTORN & get_generalized_coordinates_euler(SHAREDVECTORN &gc)
Gets the generalized coordinates of this body.
Definition: RCArticulatedBody.cpp:1178
virtual void set_generalized_forces(const SHAREDVECTORN &gf)=0
Sets the generalized forces on the body.
A generic, possibly non-square matrix using shared data.
Definition: SharedMatrixN.h:59
virtual void set_generalized_forces(const SHAREDVECTORN &gf)
Sets the generalized forces for the articulated body.
Definition: RCArticulatedBody.cpp:262
virtual void apply_generalized_impulse(const VECTORN &gj)
Applies a generalized impulse to the body.
Definition: RCArticulatedBody.h:50
virtual SHAREDVECTORN & get_generalized_forces(SHAREDVECTORN &f)
Gets the generalized forces on this body.
Definition: RCArticulatedBody.cpp:1225
Defines an articulated body for use with reduced-coordinate dynamics algorithms.
Definition: RCArticulatedBody.h:29
A generic N-dimensional floating point vector.
Definition: SharedVectorN.h:15
virtual void set_generalized_coordinates_euler(const VECTORN &gc)
Sets the generalized coordinates of this body (using Euler parameters for any rigid body orientations...
Definition: RCArticulatedBody.h:52
virtual void compile()
Compiles this body (updates the link transforms and velocities)
Definition: RCArticulatedBody.cpp:340
virtual SHAREDVECTORN & get_generalized_acceleration(SHAREDVECTORN &ga)=0
Gets the generalized velocity of this body.
virtual VECTORN & convert_to_generalized_force(boost::shared_ptr< SINGLE_BODY > body, const SFORCE &w, VECTORN &gf)
Converts a force to a generalized force.
Definition: RCArticulatedBody.h:60
virtual void apply_generalized_impulse(const SHAREDVECTORN &gj)
Applies a generalized impulse to the articulated body.
Definition: RCArticulatedBody.cpp:235
virtual SHAREDMATRIXN & get_generalized_inertia(SHAREDMATRIXN &M)
Gets the generalized inertia of this body.
Definition: RCArticulatedBody.cpp:1204
virtual unsigned num_joint_dof_explicit() const
Gets the number of degrees-of-freedom permitted by explicit constraints.
Definition: RCArticulatedBody.h:64
Implements Featherstone's algorithm for forward dynamics.
Definition: FSABAlgorithm.h:35
CRB_ALGORITHM _crb
The CRB algorithm.
Definition: RCArticulatedBody.h:133
virtual void set_generalized_forces(const VECTORN &gf)
Sets the generalized forces on the body.
Definition: RCArticulatedBody.h:46
virtual void add_generalized_force(const SHAREDVECTORN &gf)
Adds a generalized force to the articulated body.
Definition: RCArticulatedBody.cpp:290
A generic N-dimensional floating point vector.
Definition: VectorN.h:16
virtual void apply_generalized_impulse(const SHAREDVECTORN &gj)=0
Applies a generalized impulse to the body.
MATRIXN & get_generalized_inertia(MATRIXN &M)
Gets the generalized inertia of this body.
Definition: DynamicBody.h:168
virtual void reset_accumulators()
Resets the force and torque accumulators for all links and joints in the rigid body.
Definition: RCArticulatedBody.cpp:877
A three-dimensional floating point vector used for representing points and vectors in 3D with associa...
Definition: Vector3.h:15
virtual const std::vector< boost::shared_ptr< JOINT > > & get_explicit_joints() const
Gets the vector of explicit joint constraints.
Definition: RCArticulatedBody.h:109
virtual boost::shared_ptr< const POSE3 > get_gc_pose() const
Gets the frame used for generalized coordinate calculations.
Definition: RCArticulatedBody.cpp:45
unsigned _n_joint_DOF_explicit
The number of DOF of the explicit joint constraints in the body (does not include floating base DOF!)...
Definition: RCArticulatedBody.h:121
Defines a bilateral constraint (a joint)
Definition: Joint.h:14
A spatial force (a wrench)
Definition: SForce.h:14
std::vector< boost::shared_ptr< JOINT > > _ijoints
The vector of implicit joint constraints.
Definition: RCArticulatedBody.h:127
void set_floating_base(bool flag)
Sets whether the base of this body is "floating" (or fixed)
Definition: RCArticulatedBody.cpp:333
virtual VECTORN & get_generalized_velocity(DYNAMIC_BODY::GeneralizedCoordinateType gctype, VECTORN &gv)
Gets the generalized velocity of this body.
Definition: RCArticulatedBody.h:76
bool _floating_base
Whether this body uses a floating base.
Definition: RCArticulatedBody.h:116
void set_generalized_velocity_generic(DYNAMIC_BODY::GeneralizedCoordinateType gctype, V &gv)
Sets the generalized velocity of this body.
Definition: RCArticulatedBody.inl:120
virtual boost::shared_ptr< RIGIDBODY > get_base_link() const
Gets the base link.
Definition: RCArticulatedBody.h:103
virtual void set_generalized_velocity(DYNAMIC_BODY::GeneralizedCoordinateType gctype, const SHAREDVECTORN &gv)
Sets the generalized velocity of this body.
Definition: RCArticulatedBody.cpp:1191
std::vector< boost::shared_ptr< RIGIDBODY > > _links
The set of links for this articulated body.
Definition: ArticulatedBody.h:88
virtual void set_generalized_velocity(DYNAMIC_BODY::GeneralizedCoordinateType gctype, const VECTORN &gv)
Sets the generalized velocity of this body.
Definition: RCArticulatedBody.h:54
virtual void set_generalized_velocity(GeneralizedCoordinateType gctype, const SHAREDVECTORN &gv)=0
Sets the generalized velocity of this body.
virtual unsigned num_joint_dof_implicit() const
Gets the number of degrees of freedom for implicit constraints.
Definition: RCArticulatedBody.cpp:1213
FSAB_ALGORITHM _fsab
The FSAB algorithm.
Definition: RCArticulatedBody.h:136
virtual unsigned num_joint_dof() const
Gets the number of DOF of the explicit joints in the body, not including floating base DOF...
Definition: RCArticulatedBody.h:100
virtual SHAREDVECTORN & get_generalized_acceleration(SHAREDVECTORN &ga)
Gets the derivative of the velocity state vector for this articulated body.
Definition: RCArticulatedBody.cpp:572
virtual VECTORN & get_generalized_forces(VECTORN &f)
Gets the external forces on this body.
Definition: RCArticulatedBody.h:58
virtual void update_link_poses()
Updates the transforms of the links based on the current joint positions.
Definition: RCArticulatedBody.cpp:584
void get_generalized_acceleration_generic(V &ga)
Gets the derivative of the velocity state vector for this articulated body.
Definition: RCArticulatedBody.inl:45