Contains all information about the rigid body model. More...
#include <Model.h>
Public Member Functions | |
unsigned int | addBody (const unsigned int parent_id, const Math::SpatialTransform &joint_frame, const Joint &joint, const Body &body, std::string body_name="") |
Connects a given body to the model. More... | |
unsigned int | addBodyCustomJoint (const unsigned int parent_id, const Math::SpatialTransform &joint_frame, CustomJoint *custom_joint, const Body &body, std::string body_name="") |
unsigned int | addBodySphericalJoint (const unsigned int parent_id, const Math::SpatialTransform &joint_frame, const Joint &joint, const Body &body, std::string body_name="") |
unsigned int | appendBody (const Math::SpatialTransform &joint_frame, const Joint &joint, const Body &body, std::string body_name="") |
Adds a Body to the model such that the previously added Body is the Parent. More... | |
void | crawlChainKinematics (unsigned int b_id, std::atomic< unsigned int > *branch_ends, const Math::VectorNd *Q, const Math::VectorNd *QDot, const Math::VectorNd *QDDot) |
unsigned int | GetBodyId (const char *body_name) const |
Returns the id of a body that was passed to addBody() More... | |
std::string | GetBodyName (unsigned int body_id) const |
Returns the name of a body for a given body id. More... | |
unsigned int | getCommonMovableParentId (unsigned int id_1, unsigned int id_2) const |
Math::SpatialTransform | GetJointFrame (unsigned int id) |
Returns the joint frame transformtion, i.e. the second argument to Model::addBody(). More... | |
unsigned int | GetParentBodyId (unsigned int id) |
Determines id the actual parent body. More... | |
Math::Quaternion | GetQuaternion (unsigned int i, const Math::VectorNd &Q) const |
Gets the quaternion for body i (only valid if body i is connected by a JointTypeSpherical joint) More... | |
ReferenceFramePtr | getReferenceFrame (const std::string &frameName) const |
Get a fixed or moveable body's reference frame. More... | |
bool | IsBodyId (unsigned int id) const |
bool | IsFixedBodyId (unsigned int body_id) const |
Checks whether the body is rigidly attached to another body. More... | |
Model (unsigned int *n_threads=nullptr) | |
Constructor. More... | |
Model (const Model &)=delete | |
void | operator= (const Model &)=delete |
void | SetJointFrame (unsigned int id, const Math::SpatialTransform &transform) |
Sets the joint frame transformtion, i.e. the second argument to Model::addBody(). More... | |
void | SetQuaternion (unsigned int i, const Math::Quaternion &quat, Math::VectorNd &Q) const |
Sets the quaternion for body i (only valid if body i is connected by a JointTypeSpherical joint) More... | |
bool | setThreadParameters (int policy, struct sched_param param) |
~Model () | |
Public Attributes | |
Math::SpatialAccelerationV | a |
The spatial velocity of the bodies. More... | |
std::vector< ReferenceFramePtr > | bodyCenteredFrames |
std::vector< ReferenceFramePtr > | bodyFrames |
std::vector< Math::SpatialVector > | c |
The velocity dependent spatial acceleration. More... | |
std::vector< Math::SpatialVector > | c_J |
ReferenceFramePtr | comFrame |
Math::VectorNd | d |
Temporary variable D_i (RBDA p. 130) More... | |
unsigned int | dof_count |
number of degrees of freedoms of the model More... | |
Math::SpatialForceV | f |
Internal forces on the body (used only InverseDynamics()) More... | |
Math::SpatialForceV | f_b |
unsigned int | fixed_body_discriminator |
Value that is used to discriminate between fixed and movable bodies. More... | |
std::vector< ReferenceFramePtr > | fixedBodyFrames |
Math::MotionVector | gravity |
the cartesian vector of the gravity More... | |
std::vector< Math::Momentum > | hc |
Math::SpatialInertiaV | I |
std::vector< Math::SpatialMatrix > | IA |
The spatial inertia of the bodies. More... | |
Math::SpatialInertiaV | Ib_c |
Math::RigidBodyInertiaV | Ic |
boost::asio::io_service | io_service |
std::vector< unsigned int > | lambda |
std::vector< std::vector< unsigned int > > | lambda_chain |
std::vector< unsigned int > | lambda_q |
double | mass |
std::vector< Body > | mBodies |
All bodies 0 ... N_B, including the base. More... | |
std::map< std::string, unsigned int > | mBodyNameMap |
Human readable names for the bodies. More... | |
std::vector< CustomJoint * > | mCustomJoints |
std::vector< FixedBody > | mFixedBodies |
All bodies that are attached to a body via a fixed joint. More... | |
std::vector< unsigned int > | mFixedJointCount |
The number of fixed joints that have been declared before each joint. More... | |
std::vector< Joint > | mJoints |
All joints. More... | |
std::vector< unsigned int > | mJointUpdateOrder |
std::vector< std::vector< unsigned int > > | mu |
std::vector< Math::Matrix3d > | multdof3_Dinv |
std::vector< Math::Matrix63 > | multdof3_S |
Motion subspace for joints with 3 degrees of freedom. More... | |
std::vector< Math::Matrix63 > | multdof3_S_o |
std::vector< Math::Matrix63 > | multdof3_U |
std::vector< Math::Vector3d > | multdof3_u |
std::vector< unsigned int > | multdof3_w_index |
Math::VectorNd | nbodies0_vec |
Math::MatrixNd | ndof0_mat |
Math::VectorNd | ndof0_vec |
unsigned int | num_branch_ends |
Math::SpatialForceV | pA |
The spatial bias force. More... | |
unsigned int | previously_added_body_id |
Id of the previously added body, required for Model::appendBody() More... | |
Math::VectorNd | q0_vec |
unsigned int | q_size |
The size of the -vector. For models without spherical joints the value is the same as Model::dof_count, otherwise additional values for the w-component of the Quaternion is stored at the end of . More... | |
unsigned int | qdot_size |
The size of the. More... | |
std::map< std::string, ReferenceFramePtr > | referenceFrameMap |
Math::MotionVectorV | S |
Math::MotionVectorV | S_o |
boost::thread_group | thread_pool |
std::vector< boost::thread * > | threads |
Math::MatrixNd | three_x_qd0 |
std::vector< Math::SpatialVector > | U |
Temporary variable U_i (RBDA p. 130) More... | |
Math::VectorNd | u |
Temporary variable u (RBDA p. 130) More... | |
Math::SpatialMotionV | v |
Math::SpatialMotionV | v_J |
std::unique_ptr< boost::asio::io_service::work > | work |
ReferenceFramePtr | worldFrame |
std::vector< Math::SpatialTransform > | X_J |
std::vector< Math::SpatialTransform > | X_lambda |
Transformation from the parent body to the current body
. More... | |
std::vector< Math::SpatialTransform > | X_T |
Transformations from the parent body to the frame of the joint. More... | |
Private Member Functions | |
bool | validateRigidBodyInertia (const Body &body) |
Contains all information about the rigid body model.
This class contains all information required to perform the forward dynamics calculation. The variables in this class are also used for storage of temporary values. It is designed for use of the Articulated Rigid Body Algorithm (which is implemented in ForwardDynamics()) and follows the numbering as described in Featherstones book.
Please note that body 0 is the root body and the moving bodies start at index 1. This numbering scheme is very beneficial in terms of readability of the code as the resulting code is very similar to the pseudo-code in the RBDA book. The generalized variables q, qdot, qddot and tau however start at 0 such that the first entry (e.g. q[0]) always specifies the value for the first moving body.
|
explicit |
Constructor.
n_threads | The number of threads that the model can create for performing parallel tasks such as parallel kinematics. This defaults to nullptr in which case the number of threads created will be equal to std::thread::hardware_concurrency() |
|
delete |
unsigned int Model::addBody | ( | const unsigned int | parent_id, |
const Math::SpatialTransform & | joint_frame, | ||
const Joint & | joint, | ||
const Body & | body, | ||
std::string | body_name = "" |
||
) |
Connects a given body to the model.
When adding a body there are basically informations required:
The first information "what kind of body will be added" is contained in the Body class that is given as a parameter.
The question "where is the new body to be added?" is split up in two parts: first the parent (or successor) body to which it is added and second the transformation to the origin of the joint that connects the two bodies. With these two informations one specifies the relative positions of the bodies when the joint is in neutral position.gk
The last question "by what kind of joint should the body be added?" is again simply contained in the Joint class.
parent_id | id of the parent body |
joint_frame | the transformation from the parent frame to the origin of the joint frame (represents X_T in RBDA) |
joint | specification for the joint that describes the connection |
body | specification of the body itself |
body_name | human readable name for the body (can be used to retrieve its id with GetBodyId()) |
unsigned int Model::addBodyCustomJoint | ( | const unsigned int | parent_id, |
const Math::SpatialTransform & | joint_frame, | ||
CustomJoint * | custom_joint, | ||
const Body & | body, | ||
std::string | body_name = "" |
||
) |
unsigned int RobotDynamics::Model::addBodySphericalJoint | ( | const unsigned int | parent_id, |
const Math::SpatialTransform & | joint_frame, | ||
const Joint & | joint, | ||
const Body & | body, | ||
std::string | body_name = "" |
||
) |
unsigned int Model::appendBody | ( | const Math::SpatialTransform & | joint_frame, |
const Joint & | joint, | ||
const Body & | body, | ||
std::string | body_name = "" |
||
) |
Adds a Body to the model such that the previously added Body is the Parent.
This function is basically the same as Model::addBody() however the most recently added body (or body 0) is taken as parent.
void Model::crawlChainKinematics | ( | unsigned int | b_id, |
std::atomic< unsigned int > * | branch_ends, | ||
const Math::VectorNd * | Q, | ||
const Math::VectorNd * | QDot, | ||
const Math::VectorNd * | QDDot | ||
) |
|
inline |
Returns the id of a body that was passed to addBody()
Bodies can be given a human readable name. This function allows to resolve its name to the numeric id.
|
inline |
|
inline |
|
inline |
Returns the joint frame transformtion, i.e. the second argument to Model::addBody().
|
inline |
|
inline |
Gets the quaternion for body i (only valid if body i is connected by a JointTypeSpherical joint)
See Joint Singularities for details.
|
inline |
|
inline |
|
inline |
|
delete |
|
inline |
Sets the joint frame transformtion, i.e. the second argument to Model::addBody().
|
inline |
Sets the quaternion for body i (only valid if body i is connected by a JointTypeSpherical joint)
See Joint Singularities for details.
|
inline |
|
inlineprivate |
Math::SpatialAccelerationV RobotDynamics::Model::a |
std::vector<ReferenceFramePtr> RobotDynamics::Model::bodyCenteredFrames |
std::vector<ReferenceFramePtr> RobotDynamics::Model::bodyFrames |
std::vector<Math::SpatialVector> RobotDynamics::Model::c |
std::vector<Math::SpatialVector> RobotDynamics::Model::c_J |
ReferenceFramePtr RobotDynamics::Model::comFrame |
Math::VectorNd RobotDynamics::Model::d |
unsigned int RobotDynamics::Model::dof_count |
Math::SpatialForceV RobotDynamics::Model::f |
Math::SpatialForceV RobotDynamics::Model::f_b |
unsigned int RobotDynamics::Model::fixed_body_discriminator |
Value that is used to discriminate between fixed and movable bodies.
Bodies with id 1 .. (fixed_body_discriminator - 1) are moving bodies while bodies with id fixed_body_discriminator .. max (unsigned int) are fixed to a moving body. The value of max(unsigned int) is determined via std::numeric_limits<unsigned int>::max() and the default value of fixed_body_discriminator is max (unsigned int) / 2.
On normal systems max (unsigned int) is 4294967294 which means there could be a total of 2147483646 movable and / or fixed bodies.
std::vector<ReferenceFramePtr> RobotDynamics::Model::fixedBodyFrames |
Math::MotionVector RobotDynamics::Model::gravity |
std::vector<Math::Momentum> RobotDynamics::Model::hc |
Math::SpatialInertiaV RobotDynamics::Model::I |
std::vector<Math::SpatialMatrix> RobotDynamics::Model::IA |
Math::SpatialInertiaV RobotDynamics::Model::Ib_c |
Math::RigidBodyInertiaV RobotDynamics::Model::Ic |
A body inertia. See RobotDynamics::compositeRigidBodyAlgorithm for the uses of this
std::vector<unsigned int> RobotDynamics::Model::lambda |
std::vector<std::vector<unsigned int> > RobotDynamics::Model::lambda_chain |
std::vector<unsigned int> RobotDynamics::Model::lambda_q |
std::vector<Body> RobotDynamics::Model::mBodies |
std::map<std::string, unsigned int> RobotDynamics::Model::mBodyNameMap |
std::vector<CustomJoint*> RobotDynamics::Model::mCustomJoints |
std::vector<FixedBody> RobotDynamics::Model::mFixedBodies |
std::vector<unsigned int> RobotDynamics::Model::mFixedJointCount |
std::vector<Joint> RobotDynamics::Model::mJoints |
std::vector<unsigned int> RobotDynamics::Model::mJointUpdateOrder |
std::vector<std::vector<unsigned int> > RobotDynamics::Model::mu |
std::vector<Math::Matrix3d> RobotDynamics::Model::multdof3_Dinv |
std::vector<Math::Matrix63> RobotDynamics::Model::multdof3_S |
std::vector<Math::Matrix63> RobotDynamics::Model::multdof3_S_o |
std::vector<Math::Matrix63> RobotDynamics::Model::multdof3_U |
std::vector<Math::Vector3d> RobotDynamics::Model::multdof3_u |
std::vector<unsigned int> RobotDynamics::Model::multdof3_w_index |
Math::VectorNd RobotDynamics::Model::nbodies0_vec |
Math::MatrixNd RobotDynamics::Model::ndof0_mat |
Math::VectorNd RobotDynamics::Model::ndof0_vec |
unsigned int RobotDynamics::Model::num_branch_ends |
Math::SpatialForceV RobotDynamics::Model::pA |
unsigned int RobotDynamics::Model::previously_added_body_id |
Id of the previously added body, required for Model::appendBody()
Math::VectorNd RobotDynamics::Model::q0_vec |
unsigned int RobotDynamics::Model::q_size |
The size of the -vector. For models without spherical joints the value is the same as Model::dof_count, otherwise additional values for the w-component of the Quaternion is stored at the end of .
unsigned int RobotDynamics::Model::qdot_size |
std::map<std::string, ReferenceFramePtr> RobotDynamics::Model::referenceFrameMap |
Math::MotionVectorV RobotDynamics::Model::S |
Math::MotionVectorV RobotDynamics::Model::S_o |
Math::MatrixNd RobotDynamics::Model::three_x_qd0 |
std::vector<Math::SpatialVector> RobotDynamics::Model::U |
Math::VectorNd RobotDynamics::Model::u |
Math::SpatialMotionV RobotDynamics::Model::v |
Math::SpatialMotionV RobotDynamics::Model::v_J |
std::unique_ptr<boost::asio::io_service::work> RobotDynamics::Model::work |
ReferenceFramePtr RobotDynamics::Model::worldFrame |
std::vector<Math::SpatialTransform> RobotDynamics::Model::X_J |
std::vector<Math::SpatialTransform> RobotDynamics::Model::X_lambda |
std::vector<Math::SpatialTransform> RobotDynamics::Model::X_T |