8 #error This class is not to be included by the user directly. Use RigidBodyd.h or RigidBodyf.h instead.
27 friend class MCARTICULATED_BODY;
31 enum Compliance { eRigid, eCompliant};
43 bool is_child_link(boost::shared_ptr<const RIGIDBODY> query)
const;
44 bool is_descendant_link(boost::shared_ptr<const RIGIDBODY> query)
const;
79 void add_inner_joint(boost::shared_ptr<JOINT> j);
80 void add_outer_joint(boost::shared_ptr<JOINT> j);
81 void remove_inner_joint(boost::shared_ptr<JOINT> joint);
82 void remove_outer_joint(boost::shared_ptr<JOINT> joint);
83 virtual REAL
calc_kinetic_energy(boost::shared_ptr<const POSE3> P = boost::shared_ptr<const POSE3>());
89 virtual MATRIXN&
calc_jacobian(boost::shared_ptr<const POSE3> source_pose, boost::shared_ptr<const POSE3> target_pose, boost::shared_ptr<DYNAMIC_BODY> body,
MATRIXN& J);
90 virtual MATRIXN& calc_jacobian_dot(boost::shared_ptr<const POSE3> source_pose, boost::shared_ptr<const POSE3> target_pose, boost::shared_ptr<DYNAMIC_BODY> body,
MATRIXN& J);
97 template <
class OutputIterator>
98 OutputIterator get_parent_links(OutputIterator begin)
const;
100 template <
class OutputIterator>
101 OutputIterator get_child_links(OutputIterator begin)
const;
104 boost::shared_ptr<RIGIDBODY>
get_this() {
return boost::dynamic_pointer_cast<
RIGIDBODY>(shared_from_this()); }
107 boost::shared_ptr<const RIGIDBODY>
get_this()
const {
return boost::dynamic_pointer_cast<
const RIGIDBODY>(shared_from_this()); }
110 boost::shared_ptr<const POSE3>
get_pose()
const {
return _F; }
116 boost::shared_ptr<const POSE3> get_mixed_pose()
const {
return _F2; }
132 boost::shared_ptr<ARTICULATED_BODY>
get_articulated_body()
const {
return (
_abody.expired()) ? boost::shared_ptr<ARTICULATED_BODY>() : boost::shared_ptr<ARTICULATED_BODY>(
_abody); }
174 void get_generalized_coordinates_euler_generic(V&
gc);
177 void get_generalized_velocity_generic(DYNAMIC_BODY::GeneralizedCoordinateType gctype, V& gv);
180 void get_generalized_acceleration_generic(V& ga);
183 void set_generalized_coordinates_euler_generic(V&
gc);
186 void set_generalized_velocity_generic(DYNAMIC_BODY::GeneralizedCoordinateType gctype, V& gv);
189 void set_generalized_acceleration_generic(V& ga);
191 void set_force(
const SFORCE& w);
192 void apply_generalized_impulse_single(
const SHAREDVECTORN& gf);
197 unsigned num_generalized_coordinates_single(DYNAMIC_BODY::GeneralizedCoordinateType gctype)
const;
200 boost::shared_ptr<RIGIDBODY>
get_parent_link(boost::shared_ptr<JOINT> j)
const;
201 boost::shared_ptr<RIGIDBODY> get_child_link(boost::shared_ptr<JOINT> j)
const;
297 boost::shared_ptr<POSE3>
_F;
300 boost::shared_ptr<POSE3>
_F2;
303 boost::weak_ptr<ARTICULATED_BODY>
_abody;
314 #include "RigidBody.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 SHAREDMATRIXN & get_generalized_inertia(SHAREDMATRIXN &M)
Gets the generalized inertia of this rigid body.
Definition: RigidBody.cpp:1228
virtual VECTORN & get_generalized_velocity(DYNAMIC_BODY::GeneralizedCoordinateType gctype, VECTORN &gv)
Gets the generalized velocity of this body.
Definition: RigidBody.h:57
virtual SHAREDMATRIXN & solve_generalized_inertia(const SHAREDMATRIXN &B, SHAREDMATRIXN &X)
Solves using the generalized inertia matrix.
Definition: RigidBody.cpp:1076
Abstract class for articulated bodies.
Definition: ArticulatedBody.h:15
const SFORCE & sum_forces()
Gets the current sum of forces on this body.
Definition: RigidBody.cpp:413
void add_force(const SFORCE &w)
Adds a force to the body.
Definition: RigidBody.cpp:695
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.
boost::shared_ptr< POSE3 > _F
reference pose for this body
Definition: RigidBody.h:297
virtual VECTORN & get_generalized_coordinates_euler(VECTORN &gc)
Gets the generalized coordinates of this body (using Euler parameters for any rigid body orientations...
Definition: RigidBody.h:55
bool is_base() const
Determines whether this link is the base.
Definition: RigidBody.cpp:1510
void set_inertia(const SPATIAL_RB_INERTIA &J)
Sets the rigid body inertia for this body.
Definition: RigidBody.cpp:384
virtual SHAREDMATRIXN & transpose_solve_generalized_inertia(const SHAREDMATRIXN &B, SHAREDMATRIXN &X)
Solves using the generalized inertia matrix.
Definition: RigidBody.cpp:1054
void set_velocity(const SVELOCITY &xd)
Sets the velocity of this body.
Definition: RigidBody.cpp:326
virtual boost::shared_ptr< const POSE3 > get_computation_frame() const
Gets the frame in which kinematics and dynamics computations occur.
Definition: RigidBody.cpp:64
virtual VECTORN & get_generalized_forces(VECTORN &f)
Gets the external forces on this body.
Definition: RigidBody.h:69
Quaternion class used for orientation.
Definition: Quat.h:21
virtual SHAREDVECTORN & get_generalized_acceleration(SHAREDVECTORN &ga)
Gets the generalized acceleration of this body.
Definition: RigidBody.cpp:1213
virtual SHAREDVECTORN & get_generalized_velocity(DYNAMIC_BODY::GeneralizedCoordinateType gctype, SHAREDVECTORN &gv)
Gets the generalized velocity of this rigid body.
Definition: RigidBody.cpp:1198
virtual REAL calc_kinetic_energy(boost::shared_ptr< const POSE3 > P=boost::shared_ptr< const POSE3 >())
Calculates the kinetic energy of the body in an arbitrary frame.
SFORCE calc_euler_torques()
Computes the torques (w x Jw) that come from the Euler component of the Newton-Euler equations...
Definition: RigidBody.cpp:566
VECTORN gc
Temporaries for use with integration.
Definition: DynamicBody.h:330
A spatial (six dimensional) momentum.
Definition: SMomentum.h:12
void update_mixed_pose()
Updates the center-of-mass center / global aligned frame.
Definition: RigidBody.cpp:589
virtual SHAREDVECTORN & get_generalized_velocity(GeneralizedCoordinateType gctype, SHAREDVECTORN &gv)=0
Gets the generalized velocity of this body.
bool is_ground() const
Determines whether this link is a "ground" (fixed link)
Definition: RigidBody.cpp:1473
void clear_inner_joints()
Removes all inner joints from this link.
Definition: RigidBody.h:148
Superclass for both rigid and deformable bodies.
Definition: SingleBody.h:14
boost::shared_ptr< POSE3 > _F2
secondary pose for this body
Definition: RigidBody.h:300
virtual SHAREDVECTORN & get_generalized_coordinates_euler(SHAREDVECTORN &gc)=0
Gets the generalized coordinates of this body (using Euler parameters for any rigid body orientations...
boost::shared_ptr< RIGIDBODY > get_this()
Gets the shared pointer for this
Definition: RigidBody.h:104
SFORCE _forcej
Cumulative force on the body (inner joint frame)
Definition: RigidBody.h:291
virtual VECTOR3 calc_point_vel(const VECTOR3 &p) const
Calculates the velocity of a point on this rigid body in the body frame.
Definition: RigidBody.cpp:737
virtual MATRIXN & calc_jacobian(boost::shared_ptr< const POSE3 > source_pose, boost::shared_ptr< const POSE3 > target_pose, boost::shared_ptr< DYNAMIC_BODY > body, MATRIXN &J)
The Jacobian transforms from the generalized coordinate from to the given frame.
SHAREDMATRIXN & transpose_solve_generalized_inertia_single(const SHAREDMATRIXN &B, SHAREDMATRIXN &X)
Solves using the generalized inertia matrix (does not call articulated body version) ...
Definition: RigidBody.cpp:1089
virtual bool is_enabled() const
Gets whether this body is enabled.
Definition: RigidBody.h:125
void apply_impulse(const SMOMENTUM &w)
Applies a impulse to this link.
Definition: RigidBody.cpp:879
virtual void calc_fwd_dyn()
Computes the forward dynamics for this body.
Definition: RigidBody.cpp:231
SACCEL _xddj
Acceleration (inner joint frame)
Definition: RigidBody.h:294
virtual void rotate(const QUAT &q)
Rotates the rigid body.
Definition: RigidBody.cpp:88
Compliance compliance
Compliance value, determines event type.
Definition: RigidBody.h:170
void set_accel(const SACCEL &xdd)
Sets the acceleration of this body.
Definition: RigidBody.cpp:355
void set_enabled(bool flag)
Sets the body to enabled / disabled.
Definition: RigidBody.cpp:304
boost::shared_ptr< ARTICULATED_BODY > get_articulated_body() const
Gets the articulated body corresponding to this body.
Definition: RigidBody.h:132
REAL m
The rigid body mass.
Definition: SpatialRBInertia.h:57
A generic, possibly non-square matrix.
Definition: MatrixN.h:18
virtual void add_generalized_force(const VECTORN &gf)
Adds a generalized force to the body.
Definition: RigidBody.h:60
virtual void set_generalized_acceleration(const SHAREDVECTORN &ga)
Sets the generalized acceleration of this rigid body.
Definition: RigidBody.cpp:1185
REAL calc_mass() const
Synonym for get_mass() (implements SingleBody::calc_mass())
Definition: RigidBody.h:119
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.
const std::set< boost::shared_ptr< JOINT > > & get_inner_joints() const
Gets the set of inner joints for this link.
Definition: RigidBody.h:164
Represents a single rigid body.
Definition: RigidBody.h:23
boost::shared_ptr< const POSE3 > get_pose() const
Gets the current pose of this body.
Definition: RigidBody.h:110
virtual void set_generalized_velocity(DYNAMIC_BODY::GeneralizedCoordinateType gctype, const SHAREDVECTORN &gv)
Sets the generalized velocity of this rigid body.
Definition: RigidBody.cpp:1172
virtual void set_generalized_forces(const VECTORN &gf)
Sets the generalized forces on the body.
Definition: RigidBody.h:51
virtual SHAREDVECTORN & get_generalized_coordinates_euler(SHAREDVECTORN &gc)
Gets the generalized position of this rigid body.
Definition: RigidBody.cpp:1144
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 SHAREDVECTORN & get_generalized_forces(SHAREDVECTORN &f)
Gets the generalized inertia of this rigid body.
Definition: RigidBody.cpp:1298
A spatial velocity (a twist)
Definition: SVelocity.h:15
boost::weak_ptr< ARTICULATED_BODY > _abody
Pointer to articulated body (if this body is a link)
Definition: RigidBody.h:303
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
A rigid body pose.
Definition: Pose3.h:15
VECTORN q
The position of this joint.
Definition: Joint.h:144
virtual const SACCEL & get_accel()
Gets the current body acceleration.
Definition: RigidBody.cpp:512
virtual void apply_generalized_impulse(const SHAREDVECTORN &gf)
Applies a generalized impulse to this rigid body.
Definition: RigidBody.cpp:1005
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: RigidBody.h:71
bool _xddj_valid
Indicates whether inner joint frame acceleration is valid (up-to-date)
Definition: RigidBody.h:282
SVELOCITY _xdj
Velocity (inner joint frame)
Definition: RigidBody.h:288
SPATIAL_RB_INERTIA _Jj
Spatial rigid body inertia matrix (inner joint frame)
Definition: RigidBody.h:285
virtual void apply_generalized_impulse(const VECTORN &gj)
Applies a generalized impulse to the body.
Definition: RigidBody.h:62
boost::shared_ptr< const POSE3 > get_gc_pose() const
Gets the frame for generalized coordinates.
Definition: RigidBody.h:113
bool is_end_effector() const
Gets whether this body is an end-effector (i.e., the number of child links is zero) in an articulated...
Definition: RigidBody.h:145
A 6x6 spatial algebra matrix used for dynamics calculations.
Definition: SpatialRBInertia.h:25
A spatial (six dimensional) acceleration.
Definition: SAccel.h:14
A generic N-dimensional floating point vector.
Definition: VectorN.h:16
unsigned num_child_links() const
Gets the number of child links of this link.
Definition: RigidBody.h:142
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
A three-dimensional floating point vector used for representing points and vectors in 3D with associa...
Definition: Vector3.h:15
const SPATIAL_RB_INERTIA & get_inertia()
Gets the body inertia.
Definition: RigidBody.cpp:479
boost::shared_ptr< JOINT > get_inner_joint_explicit() const
Gets the explicit inner joint of this link; returns NULL if there is no explicit inner joint...
Definition: RigidBody.cpp:1455
Defines a bilateral constraint (a joint)
Definition: Joint.h:14
A spatial force (a wrench)
Definition: SForce.h:14
std::set< boost::shared_ptr< JOINT > > _outer_joints
Outer joints and associated data.
Definition: RigidBody.h:309
A three-dimensional floating point vector used for representing points and vectors in 3D and without ...
Definition: Origin3.h:16
virtual unsigned num_generalized_coordinates(DYNAMIC_BODY::GeneralizedCoordinateType gctype) const
Gets the generalized inertia of this rigid body.
Definition: RigidBody.cpp:934
unsigned get_index() const
Gets the link index (returns std::numeric_limits<unsigned>::max() if not set)
Definition: RigidBody.h:154
std::set< boost::shared_ptr< JOINT > > _inner_joints
Inner joints and associated data.
Definition: RigidBody.h:306
RIGIDBODY()
Default constructor.
Definition: RigidBody.cpp:24
const SVELOCITY & get_velocity()
Gets the current body velocity.
Definition: RigidBody.cpp:446
const std::set< boost::shared_ptr< JOINT > > & get_outer_joints() const
Gets the list of outer joints for this link.
Definition: RigidBody.h:167
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_articulated_body(boost::shared_ptr< ARTICULATED_BODY > body)
Sets the articulated body corresponding to this body.
Definition: RigidBody.h:139
virtual void set_generalized_velocity(DYNAMIC_BODY::GeneralizedCoordinateType gctype, const VECTORN &gv)
Sets the generalized velocity of this body.
Definition: RigidBody.h:67
virtual void add_generalized_force(const SHAREDVECTORN &gf)
Adds a generalized force to this rigid body.
Definition: RigidBody.cpp:976
virtual void set_generalized_velocity(GeneralizedCoordinateType gctype, const SHAREDVECTORN &gv)=0
Sets the generalized velocity of this body.
void set_index(unsigned index)
Sets the link index.
Definition: RigidBody.h:161
boost::shared_ptr< const RIGIDBODY > get_this() const
Gets the shared const pointer for this
Definition: RigidBody.h:107
virtual void translate(const ORIGIN3 &o)
Translates the rigid body.
Definition: RigidBody.cpp:182
virtual void set_generalized_coordinates_euler(const SHAREDVECTORN &gc)
Sets the generalized coordinates of this rigid body.
Definition: RigidBody.cpp:1159
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: RigidBody.h:64
boost::shared_ptr< RIGIDBODY > get_parent_link() const
Gets the first parent link of this link; returns NULL if there is no parent.
Definition: RigidBody.cpp:1433
virtual void set_computation_frame_type(ReferenceFrameType rftype)
(Re)sets the computation frame
Definition: RigidBody.cpp:220
void reset_accumulators()
Resets the force accumulators on this body.
Definition: RigidBody.cpp:551
void invalidate_pose_vectors()
Invalidates pose quantities.
Definition: RigidBody.cpp:621
virtual void set_generalized_forces(const SHAREDVECTORN &gf)
Sets the generalized forces on the body.
virtual REAL get_mass() const
Gets the mass of this body.
Definition: RigidBody.h:122
void set_pose(const POSE3 &pose)
Sets the current 3D pose for this rigid body.
Definition: RigidBody.cpp:607
void clear_outer_joints()
Removes all outer joints from this link.
Definition: RigidBody.h:151