Mechanisms
Index
RigidBodyDynamics.MechanismRigidBodyDynamics.MechanismRigidBodyDynamics.attach!RigidBodyDynamics.attach!RigidBodyDynamics.bodiesRigidBodyDynamics.body_fixed_frame_definitionRigidBodyDynamics.body_fixed_frame_to_bodyRigidBodyDynamics.findbodyRigidBodyDynamics.findbodyRigidBodyDynamics.findjointRigidBodyDynamics.findjointRigidBodyDynamics.fixed_transformRigidBodyDynamics.in_jointsRigidBodyDynamics.joint_to_parentRigidBodyDynamics.jointsRigidBodyDynamics.joints_to_childrenRigidBodyDynamics.maximal_coordinatesRigidBodyDynamics.non_tree_jointsRigidBodyDynamics.num_additional_statesRigidBodyDynamics.num_constraintsRigidBodyDynamics.num_positionsRigidBodyDynamics.num_velocitiesRigidBodyDynamics.out_jointsRigidBodyDynamics.pathRigidBodyDynamics.predecessorRigidBodyDynamics.rand_chain_mechanismRigidBodyDynamics.rand_floating_tree_mechanismRigidBodyDynamics.rand_tree_mechanismRigidBodyDynamics.rand_tree_mechanismRigidBodyDynamics.rebuild_spanning_tree!RigidBodyDynamics.remove_fixed_tree_joints!RigidBodyDynamics.remove_joint!RigidBodyDynamics.root_bodyRigidBodyDynamics.root_frameRigidBodyDynamics.submechanismRigidBodyDynamics.successorRigidBodyDynamics.tree_joints
The Mechanism type
RigidBodyDynamics.Mechanism — Typemutable struct Mechanism{T}A Mechanism represents an interconnection of rigid bodies and joints. Mechanisms store the joint layout and inertia parameters, but no state-dependent information.
Creating and modifying Mechanisms
See also URDF parsing and writing for URDF file format support.
RigidBodyDynamics.Mechanism — MethodMechanism(root_body; gravity)
Create a new Mechanism containing only a root body, to which other bodies can be attached with joints.
The gravity keyword argument can be used to set the gravitational acceleration (a 3-vector expressed in the Mechanism's root frame). Default: [0.0, 0.0, -9.81].
RigidBodyDynamics.attach! — Methodattach!(mechanism, parentbody, childmechanism; child_root_pose, bodymap, jointmap)
Attach a copy of childmechanism to mechanism.
Essentially replaces the root body of a copy of childmechanism with parentbody (which belongs to mechanism).
Note: gravitational acceleration for childmechanism is ignored.
Keyword arguments:
child_root_pose: pose of the default frame of the root body ofchildmechanismrelative to that ofparentbody. Default: the identity transformation.bodymap::AbstractDict{RigidBody{T}, RigidBody{T}}: will be populated with the mapping from input mechanism's bodies to output mechanism's bodiesjointmap::AbstractDict{<:Joint{T}, <:Joint{T}}: will be populated with the mapping from input mechanism's joints to output mechanism's joints
where T is the element type of mechanism.
RigidBodyDynamics.attach! — Methodattach!(mechanism, predecessor, successor, joint; joint_pose, successor_pose)
Attach successor to predecessor using joint.
See Joint for definitions of the terms successor and predecessor.
The Transform3Ds joint_pose and successor_pose define where joint is attached to each body. joint_pose should define frame_before(joint) with respect to any frame fixed to predecessor, and likewise successor_pose should define any frame fixed to successor with respect to frame_after(joint).
predecessor is required to already be among the bodies of the Mechanism.
If successor is not yet a part of the Mechanism, it will be added to the Mechanism. Otherwise, the joint will be treated as a non-tree edge in the Mechanism, effectively creating a loop constraint that will be enforced using Lagrange multipliers (as opposed to using recursive algorithms).
RigidBodyDynamics.maximal_coordinates — MethodReturn a dynamically equivalent Mechanism, but with a flat tree structure: all bodies are attached to the root body via a floating joint, and the tree joints of the input Mechanism are transformed into non-tree joints (with joint constraints enforced using Lagrange multipliers in dynamics!).
Keyword arguments:
floating_joint_type::Type{<:JointType{T}}: which floating joint type to use for the joints between each body and the root. Default:QuaternionFloating{T}bodymap::AbstractDict{RigidBody{T}, RigidBody{T}}: will be populated with the mapping from input mechanism's bodies to output mechanism's bodiesjointmap::AbstractDict{<:Joint{T}, <:Joint{T}}: will be populated with the mapping from input mechanism's joints to output mechanism's joints
where T is the element type of mechanism.
RigidBodyDynamics.rand_chain_mechanism — MethodCreate a random chain Mechanism with the given joint types.
RigidBodyDynamics.rand_floating_tree_mechanism — Methodrand_floating_tree_mechanism(_, nonfloatingjointtypes)
Create a random tree Mechanism, with a quaternion floating joint as the first joint (between the root body and the first non-root body).
RigidBodyDynamics.rand_tree_mechanism — Methodrand_tree_mechanism(_, parentselector, jointtypes)
Create a random tree Mechanism with the given joint types. Each new body is attached to a parent selected using the parentselector function.
RigidBodyDynamics.rand_tree_mechanism — MethodCreate a random tree Mechanism.
RigidBodyDynamics.rebuild_spanning_tree! — Methodrebuild_spanning_tree!(mechanism)
rebuild_spanning_tree!(mechanism, flipped_joint_map; next_edge)
Reconstruct the mechanism's spanning tree.
Optionally, the flipped_joint_map keyword argument can be used to pass in an associative container that will be populated with a mapping from original joints to flipped joints, if the rebuilding process required the polarity of some joints to be flipped.
Also optionally, next_edge can be used to select which joints should become part of the new spanning tree.
RigidBodyDynamics.remove_fixed_tree_joints! — MethodRemove any fixed joints present as tree edges in mechanism by merging the rigid bodies that these fixed joints join together into bodies with equivalent inertial properties.
RigidBodyDynamics.remove_joint! — Methodremove_joint!(mechanism, joint; flipped_joint_map, spanning_tree_next_edge)
Remove a joint from the mechanism. Rebuilds the spanning tree if the joint is part of the current spanning tree.
Optionally, the flipped_joint_map keyword argument can be used to pass in an associative container that will be populated with a mapping from original joints to flipped joints, if removing joint requires rebuilding the spanning tree of mechanism and the polarity of some joints needed to be changed in the process.
Also optionally, spanning_tree_next_edge can be used to select which joints should become part of the new spanning tree, if rebuilding the spanning tree is required.
RigidBodyDynamics.submechanism — Methodsubmechanism(mechanism, submechanismroot; bodymap, jointmap)
Create a new Mechanism from the subtree of mechanism rooted at submechanismroot.
Any non-tree joint in mechanism will appear in the returned Mechanism if and only if both its successor and its predecessor are part of the subtree.
Keyword arguments:
bodymap::AbstractDict{RigidBody{T}, RigidBody{T}}: will be populated with the mapping from input mechanism's bodies to output mechanism's bodiesjointmap::AbstractDict{<:Joint{T}, <:Joint{T}}: will be populated with the mapping from input mechanism's joints to output mechanism's joints
where T is the element type of mechanism.
Basic functionality
RigidBodyDynamics.bodies — Methodbodies(mechanism)
Return the RigidBodys that are part of the Mechanism as an iterable collection.
RigidBodyDynamics.body_fixed_frame_definition — Methodbody_fixed_frame_definition(mechanism, frame)
Return the definition of body-fixed frame frame, i.e., the Transform3D from frame to the default frame of the body to which it is attached.
Note: this function is linear in the number of bodies and is not meant to be called in tight loops.
See also default_frame, frame_definition.
RigidBodyDynamics.body_fixed_frame_to_body — Methodbody_fixed_frame_to_body(mechanism, frame)
Return the RigidBody to which frame is attached.
Note: this function is linear in the number of bodies and is not meant to be called in tight loops.
RigidBodyDynamics.findbody — Methodfindbody(mechanism, id)
Return the RigidBody with the given BodyID.
RigidBodyDynamics.findbody — Methodfindbody(mechanism, name)
Return the RigidBody with the given name. Errors if there is no body with the given name, or if there's more than one.
RigidBodyDynamics.findjoint — Methodfindjoint(mechanism, id)
Return the Joint with the given JointID.
RigidBodyDynamics.findjoint — Methodfindjoint(mechanism, name)
Return the Joint with the given name. Errors if there is no joint with the given name, or if there's more than one.
RigidBodyDynamics.fixed_transform — Methodfixed_transform(mechanism, from, to)
Return the transform from CartesianFrame3D from to to, both of which are rigidly attached to the same RigidBody.
Note: this function is linear in the number of bodies and is not meant to be called in tight loops.
RigidBodyDynamics.in_joints — Methodin_joints(body, mechanism)
Return the joints that have body as their successor.
RigidBodyDynamics.joint_to_parent — Methodjoint_to_parent(body, mechanism)
Return the joint that is part of the mechanism's kinematic tree and has body as its successor.
RigidBodyDynamics.joints — Methodjoints(mechanism)
Return the Joints that are part of the Mechanism as an iterable collection.
RigidBodyDynamics.joints_to_children — Methodjoints_to_children(body, mechanism)
Return the joints that are part of the mechanism's kinematic tree and have body as their predecessor.
RigidBodyDynamics.non_tree_joints — Methodnon_tree_joints(mechanism)
Return the Joints that are not part of the Mechanism's spanning tree as an iterable collection.
RigidBodyDynamics.num_additional_states — Methodnum_additional_states(mechanism)
Return the dimension of the vector of additional states $s$ (used for stateful contact models).
RigidBodyDynamics.num_constraints — Methodnum_constraints(mechanism)
Return the number of constraints imposed by the mechanism's non-tree joints (i.e., the number of rows of the constraint Jacobian).
RigidBodyDynamics.num_positions — Methodnum_positions(mechanism)
Return the dimension of the joint configuration vector $q$.
RigidBodyDynamics.num_velocities — Methodnum_velocities(mechanism)
Return the dimension of the joint velocity vector $v$.
RigidBodyDynamics.out_joints — Methodout_joints(body, mechanism)
Return the joints that have body as their predecessor.
RigidBodyDynamics.path — Methodpath(mechanism, from, to)
Return the path from rigid body from to to along edges of the Mechanism's kinematic tree.
RigidBodyDynamics.predecessor — Methodpredecessor(joint, mechanism)
Return the body 'before' the joint, i.e. the 'tail' of the joint interpreted as an arrow in the Mechanism's kinematic graph.
See Joint.
RigidBodyDynamics.root_body — Methodroot_body(mechanism)
Return the root (stationary 'world') body of the Mechanism.
RigidBodyDynamics.root_frame — Methodroot_frame(mechanism)
Return the default frame of the root body.
RigidBodyDynamics.successor — Methodsuccessor(joint, mechanism)
Return the body 'after' the joint, i.e. the 'head' of the joint interpreted as an arrow in the Mechanism's kinematic graph.
See Joint.
RigidBodyDynamics.tree_joints — Methodtree_joints(mechanism)
Return the Joints that are part of the Mechanism's spanning tree as an iterable collection.