pydrake.multibody.tree
Bindings for MultibodyTree and related components.
- class pydrake.multibody.tree.BallRpyJoint
Bases:
pydrake.multibody.tree.Joint
This Joint allows two bodies to rotate freely relative to one another. That is, given a frame F attached to the parent body P and a frame M attached to the child body B (see the Joint class’s documentation), this Joint allows frame M to rotate freely with respect to F, while the origins, Mo and Fo, of frames M and F respectively remain coincident. The orientation of M relative to F is parameterized with space
x-y-z
Euler angles.Note
This class is templated; see
BallRpyJoint_
for the list of instantiations.- __init__(self: pydrake.multibody.tree.BallRpyJoint, name: str, frame_on_parent: pydrake.multibody.tree.Frame, frame_on_child: pydrake.multibody.tree.Frame, damping: float = 0) None
Constructor to create a ball rpy joint between two bodies so that frame F attached to the parent body P and frame M attached to the child body B rotate freely relative to one another. See this class’s documentation for further details on the definition of these frames, get_angles() for an explanation of the angles defining orientation, and get_angular_velocity() for an explanation of the generalized velocities. This constructor signature creates a joint with no joint limits, i.e. the joint position, velocity and acceleration limits are the pair
(-∞, ∞)
. These can be set using the Joint methods set_position_limits(), set_velocity_limits() and set_acceleration_limits(). The first three arguments to this constructor are those of the Joint class constructor. See the Joint class’s documentation for details. The additional parameters are:- Parameter
damping
: Viscous damping coefficient, in N⋅m⋅s, used to model losses within the joint. See documentation of default_damping() for details on modelling of the damping torque.
- Raises
RuntimeError if damping is negative. –
- Parameter
- default_damping(self: pydrake.multibody.tree.BallRpyJoint) float
Returns
this
joint’s default damping constant in N⋅m⋅s. The damping torque (in N⋅m) is modeled asτ = -damping⋅ω
, i.e. opposing motion, with ω the angular velocity of frame M in F (see get_angular_velocity()) and τ the torque on child body B (to which M is rigidly attached).
- get_angles(self: pydrake.multibody.tree.BallRpyJoint, context: pydrake.systems.framework.Context) numpy.ndarray[numpy.float64[3, 1]]
Gets the rotation angles of
this
joint fromcontext
.The orientation
R_FM
of the child frame M in parent frame F is parameterized with spacex-y-z
Euler angles (also known as extrinsic angles). That is, the angles θr, θp, θy, correspond to a sequence of rotations about the x̂, ŷ, ẑ axes of parent frame F, respectively. Mathematically, rotationR_FM
is given in terms of angles θr, θp, θy by:Click to expand C++ code...
R_FM(q) = Rz(θy) * Ry(θp) * Rx(θr)
where
Rx(θ)
, Ry(θ) andRz(θ)
correspond to the elemental rotations in amount of θ about the x, y and z axes respectively. Zero θr, θp, θy angles corresponds to frames F and M being coincident. Angles θr, θp, θy are defined to be positive according to the right-hand-rule with the thumb aligned in the direction of their respective axes.Note
Space
x-y-z
angles (extrinsic) are equivalent to Bodyz-y-x
angles (intrinsic).Note
This particular choice of angles θr, θp, θy for this joint are many times referred to as the roll, pitch and yaw angles by many dynamicists. They are also known as the Tait-Bryan angles or Cardan angles.
- Parameter
context
: The context of the model this joint belongs to.
- Returns
The angle coordinates of
this
joint stored in thecontext
ordered as θr, θp, θy.
- Parameter
- get_angular_velocity(self: pydrake.multibody.tree.BallRpyJoint, context: pydrake.systems.framework.Context) numpy.ndarray[numpy.float64[3, 1]]
Retrieves from
context
the angular velocityw_FM
of the child frame M in the parent frame F, expressed in F.- Parameter
context
: The context of the model this joint belongs to.
- Returns
w_FM
: A vector in ℝ³ with the angular velocity of the child frame M in the parent frame F, expressed in F. Refer to this class’s documentation for further details and definitions of these frames.
- Parameter
- get_default_angles(self: pydrake.multibody.tree.BallRpyJoint) numpy.ndarray[numpy.float64[3, 1]]
Gets the default angles for
this
joint. Wrapper for the more generalJoint::default_positions()
.- Returns
The default angles of
this
stored indefault_positions_
- kTypeName = 'ball_rpy'
- set_angles(self: pydrake.multibody.tree.BallRpyJoint, context: pydrake.systems.framework.Context, angles: numpy.ndarray[numpy.float64[3, 1]]) pydrake.multibody.tree.BallRpyJoint
Sets the
context
so that the generalized coordinates corresponding to the rotation angles ofthis
joint equalsangles
.- Parameter
context
: The context of the model this joint belongs to.
- Parameter
angles
: The desired angles in radians to be stored in
context
ordered as θr, θp, θy. See get_angles() for details.
- Returns
a constant reference to
this
joint.
- Parameter
- set_angular_velocity(self: pydrake.multibody.tree.BallRpyJoint, context: pydrake.systems.framework.Context, w_FM: numpy.ndarray[numpy.float64[3, 1]]) pydrake.multibody.tree.BallRpyJoint
Sets in
context
the state forthis
joint so that the angular velocity of the child frame M in the parent frame F isw_FM
.- Parameter
context
: The context of the model this joint belongs to.
- Parameter
w_FM
: A vector in ℝ³ with the angular velocity of the child frame M in the parent frame F, expressed in F. Refer to this class’s documentation for further details and definitions of these frames.
- Returns
a constant reference to
this
joint.
- Parameter
- set_default_angles(self: pydrake.multibody.tree.BallRpyJoint, angles: numpy.ndarray[numpy.float64[3, 1]]) None
Sets the default angles of this joint.
- Parameter
angles
: The desired default angles of the joint
- Parameter
- set_random_angles_distribution(self: pydrake.multibody.tree.BallRpyJoint, angles: numpy.ndarray[object[3, 1]]) None
Sets the random distribution that angles of this joint will be randomly sampled from. See get_angles() for details on the angle representation.
- template pydrake.multibody.tree.BallRpyJoint_
Instantiations:
BallRpyJoint_[float]
,BallRpyJoint_[AutoDiffXd]
,BallRpyJoint_[Expression]
- class pydrake.multibody.tree.BallRpyJoint_[AutoDiffXd]
Bases:
pydrake.multibody.tree.Joint_[AutoDiffXd]
This Joint allows two bodies to rotate freely relative to one another. That is, given a frame F attached to the parent body P and a frame M attached to the child body B (see the Joint class’s documentation), this Joint allows frame M to rotate freely with respect to F, while the origins, Mo and Fo, of frames M and F respectively remain coincident. The orientation of M relative to F is parameterized with space
x-y-z
Euler angles.- __init__(self: pydrake.multibody.tree.BallRpyJoint_[AutoDiffXd], name: str, frame_on_parent: pydrake.multibody.tree.Frame_[AutoDiffXd], frame_on_child: pydrake.multibody.tree.Frame_[AutoDiffXd], damping: float = 0) None
Constructor to create a ball rpy joint between two bodies so that frame F attached to the parent body P and frame M attached to the child body B rotate freely relative to one another. See this class’s documentation for further details on the definition of these frames, get_angles() for an explanation of the angles defining orientation, and get_angular_velocity() for an explanation of the generalized velocities. This constructor signature creates a joint with no joint limits, i.e. the joint position, velocity and acceleration limits are the pair
(-∞, ∞)
. These can be set using the Joint methods set_position_limits(), set_velocity_limits() and set_acceleration_limits(). The first three arguments to this constructor are those of the Joint class constructor. See the Joint class’s documentation for details. The additional parameters are:- Parameter
damping
: Viscous damping coefficient, in N⋅m⋅s, used to model losses within the joint. See documentation of default_damping() for details on modelling of the damping torque.
- Raises
RuntimeError if damping is negative. –
- Parameter
- default_damping(self: pydrake.multibody.tree.BallRpyJoint_[AutoDiffXd]) float
Returns
this
joint’s default damping constant in N⋅m⋅s. The damping torque (in N⋅m) is modeled asτ = -damping⋅ω
, i.e. opposing motion, with ω the angular velocity of frame M in F (see get_angular_velocity()) and τ the torque on child body B (to which M is rigidly attached).
- get_angles(self: pydrake.multibody.tree.BallRpyJoint_[AutoDiffXd], context: pydrake.systems.framework.Context_[AutoDiffXd]) numpy.ndarray[object[3, 1]]
Gets the rotation angles of
this
joint fromcontext
.The orientation
R_FM
of the child frame M in parent frame F is parameterized with spacex-y-z
Euler angles (also known as extrinsic angles). That is, the angles θr, θp, θy, correspond to a sequence of rotations about the x̂, ŷ, ẑ axes of parent frame F, respectively. Mathematically, rotationR_FM
is given in terms of angles θr, θp, θy by:Click to expand C++ code...
R_FM(q) = Rz(θy) * Ry(θp) * Rx(θr)
where
Rx(θ)
, Ry(θ) andRz(θ)
correspond to the elemental rotations in amount of θ about the x, y and z axes respectively. Zero θr, θp, θy angles corresponds to frames F and M being coincident. Angles θr, θp, θy are defined to be positive according to the right-hand-rule with the thumb aligned in the direction of their respective axes.Note
Space
x-y-z
angles (extrinsic) are equivalent to Bodyz-y-x
angles (intrinsic).Note
This particular choice of angles θr, θp, θy for this joint are many times referred to as the roll, pitch and yaw angles by many dynamicists. They are also known as the Tait-Bryan angles or Cardan angles.
- Parameter
context
: The context of the model this joint belongs to.
- Returns
The angle coordinates of
this
joint stored in thecontext
ordered as θr, θp, θy.
- Parameter
- get_angular_velocity(self: pydrake.multibody.tree.BallRpyJoint_[AutoDiffXd], context: pydrake.systems.framework.Context_[AutoDiffXd]) numpy.ndarray[object[3, 1]]
Retrieves from
context
the angular velocityw_FM
of the child frame M in the parent frame F, expressed in F.- Parameter
context
: The context of the model this joint belongs to.
- Returns
w_FM
: A vector in ℝ³ with the angular velocity of the child frame M in the parent frame F, expressed in F. Refer to this class’s documentation for further details and definitions of these frames.
- Parameter
- get_default_angles(self: pydrake.multibody.tree.BallRpyJoint_[AutoDiffXd]) numpy.ndarray[numpy.float64[3, 1]]
Gets the default angles for
this
joint. Wrapper for the more generalJoint::default_positions()
.- Returns
The default angles of
this
stored indefault_positions_
- kTypeName = 'ball_rpy'
- set_angles(self: pydrake.multibody.tree.BallRpyJoint_[AutoDiffXd], context: pydrake.systems.framework.Context_[AutoDiffXd], angles: numpy.ndarray[object[3, 1]]) pydrake.multibody.tree.BallRpyJoint_[AutoDiffXd]
Sets the
context
so that the generalized coordinates corresponding to the rotation angles ofthis
joint equalsangles
.- Parameter
context
: The context of the model this joint belongs to.
- Parameter
angles
: The desired angles in radians to be stored in
context
ordered as θr, θp, θy. See get_angles() for details.
- Returns
a constant reference to
this
joint.
- Parameter
- set_angular_velocity(self: pydrake.multibody.tree.BallRpyJoint_[AutoDiffXd], context: pydrake.systems.framework.Context_[AutoDiffXd], w_FM: numpy.ndarray[object[3, 1]]) pydrake.multibody.tree.BallRpyJoint_[AutoDiffXd]
Sets in
context
the state forthis
joint so that the angular velocity of the child frame M in the parent frame F isw_FM
.- Parameter
context
: The context of the model this joint belongs to.
- Parameter
w_FM
: A vector in ℝ³ with the angular velocity of the child frame M in the parent frame F, expressed in F. Refer to this class’s documentation for further details and definitions of these frames.
- Returns
a constant reference to
this
joint.
- Parameter
- set_default_angles(self: pydrake.multibody.tree.BallRpyJoint_[AutoDiffXd], angles: numpy.ndarray[numpy.float64[3, 1]]) None
Sets the default angles of this joint.
- Parameter
angles
: The desired default angles of the joint
- Parameter
- set_random_angles_distribution(self: pydrake.multibody.tree.BallRpyJoint_[AutoDiffXd], angles: numpy.ndarray[object[3, 1]]) None
Sets the random distribution that angles of this joint will be randomly sampled from. See get_angles() for details on the angle representation.
- class pydrake.multibody.tree.BallRpyJoint_[Expression]
Bases:
pydrake.multibody.tree.Joint_[Expression]
This Joint allows two bodies to rotate freely relative to one another. That is, given a frame F attached to the parent body P and a frame M attached to the child body B (see the Joint class’s documentation), this Joint allows frame M to rotate freely with respect to F, while the origins, Mo and Fo, of frames M and F respectively remain coincident. The orientation of M relative to F is parameterized with space
x-y-z
Euler angles.- __init__(self: pydrake.multibody.tree.BallRpyJoint_[Expression], name: str, frame_on_parent: pydrake.multibody.tree.Frame_[Expression], frame_on_child: pydrake.multibody.tree.Frame_[Expression], damping: float = 0) None
Constructor to create a ball rpy joint between two bodies so that frame F attached to the parent body P and frame M attached to the child body B rotate freely relative to one another. See this class’s documentation for further details on the definition of these frames, get_angles() for an explanation of the angles defining orientation, and get_angular_velocity() for an explanation of the generalized velocities. This constructor signature creates a joint with no joint limits, i.e. the joint position, velocity and acceleration limits are the pair
(-∞, ∞)
. These can be set using the Joint methods set_position_limits(), set_velocity_limits() and set_acceleration_limits(). The first three arguments to this constructor are those of the Joint class constructor. See the Joint class’s documentation for details. The additional parameters are:- Parameter
damping
: Viscous damping coefficient, in N⋅m⋅s, used to model losses within the joint. See documentation of default_damping() for details on modelling of the damping torque.
- Raises
RuntimeError if damping is negative. –
- Parameter
- default_damping(self: pydrake.multibody.tree.BallRpyJoint_[Expression]) float
Returns
this
joint’s default damping constant in N⋅m⋅s. The damping torque (in N⋅m) is modeled asτ = -damping⋅ω
, i.e. opposing motion, with ω the angular velocity of frame M in F (see get_angular_velocity()) and τ the torque on child body B (to which M is rigidly attached).
- get_angles(self: pydrake.multibody.tree.BallRpyJoint_[Expression], context: pydrake.systems.framework.Context_[Expression]) numpy.ndarray[object[3, 1]]
Gets the rotation angles of
this
joint fromcontext
.The orientation
R_FM
of the child frame M in parent frame F is parameterized with spacex-y-z
Euler angles (also known as extrinsic angles). That is, the angles θr, θp, θy, correspond to a sequence of rotations about the x̂, ŷ, ẑ axes of parent frame F, respectively. Mathematically, rotationR_FM
is given in terms of angles θr, θp, θy by:Click to expand C++ code...
R_FM(q) = Rz(θy) * Ry(θp) * Rx(θr)
where
Rx(θ)
, Ry(θ) andRz(θ)
correspond to the elemental rotations in amount of θ about the x, y and z axes respectively. Zero θr, θp, θy angles corresponds to frames F and M being coincident. Angles θr, θp, θy are defined to be positive according to the right-hand-rule with the thumb aligned in the direction of their respective axes.Note
Space
x-y-z
angles (extrinsic) are equivalent to Bodyz-y-x
angles (intrinsic).Note
This particular choice of angles θr, θp, θy for this joint are many times referred to as the roll, pitch and yaw angles by many dynamicists. They are also known as the Tait-Bryan angles or Cardan angles.
- Parameter
context
: The context of the model this joint belongs to.
- Returns
The angle coordinates of
this
joint stored in thecontext
ordered as θr, θp, θy.
- Parameter
- get_angular_velocity(self: pydrake.multibody.tree.BallRpyJoint_[Expression], context: pydrake.systems.framework.Context_[Expression]) numpy.ndarray[object[3, 1]]
Retrieves from
context
the angular velocityw_FM
of the child frame M in the parent frame F, expressed in F.- Parameter
context
: The context of the model this joint belongs to.
- Returns
w_FM
: A vector in ℝ³ with the angular velocity of the child frame M in the parent frame F, expressed in F. Refer to this class’s documentation for further details and definitions of these frames.
- Parameter
- get_default_angles(self: pydrake.multibody.tree.BallRpyJoint_[Expression]) numpy.ndarray[numpy.float64[3, 1]]
Gets the default angles for
this
joint. Wrapper for the more generalJoint::default_positions()
.- Returns
The default angles of
this
stored indefault_positions_
- kTypeName = 'ball_rpy'
- set_angles(self: pydrake.multibody.tree.BallRpyJoint_[Expression], context: pydrake.systems.framework.Context_[Expression], angles: numpy.ndarray[object[3, 1]]) pydrake.multibody.tree.BallRpyJoint_[Expression]
Sets the
context
so that the generalized coordinates corresponding to the rotation angles ofthis
joint equalsangles
.- Parameter
context
: The context of the model this joint belongs to.
- Parameter
angles
: The desired angles in radians to be stored in
context
ordered as θr, θp, θy. See get_angles() for details.
- Returns
a constant reference to
this
joint.
- Parameter
- set_angular_velocity(self: pydrake.multibody.tree.BallRpyJoint_[Expression], context: pydrake.systems.framework.Context_[Expression], w_FM: numpy.ndarray[object[3, 1]]) pydrake.multibody.tree.BallRpyJoint_[Expression]
Sets in
context
the state forthis
joint so that the angular velocity of the child frame M in the parent frame F isw_FM
.- Parameter
context
: The context of the model this joint belongs to.
- Parameter
w_FM
: A vector in ℝ³ with the angular velocity of the child frame M in the parent frame F, expressed in F. Refer to this class’s documentation for further details and definitions of these frames.
- Returns
a constant reference to
this
joint.
- Parameter
- set_default_angles(self: pydrake.multibody.tree.BallRpyJoint_[Expression], angles: numpy.ndarray[numpy.float64[3, 1]]) None
Sets the default angles of this joint.
- Parameter
angles
: The desired default angles of the joint
- Parameter
- set_random_angles_distribution(self: pydrake.multibody.tree.BallRpyJoint_[Expression], angles: numpy.ndarray[object[3, 1]]) None
Sets the random distribution that angles of this joint will be randomly sampled from. See get_angles() for details on the angle representation.
- pydrake.multibody.tree.Body
alias of
pydrake.multibody.tree.RigidBody
- template pydrake.multibody.tree.Body_
Instantiations:
RigidBody_[float]
,RigidBody_[AutoDiffXd]
,RigidBody_[Expression]
- class pydrake.multibody.tree.BodyIndex
Type used to identify RigidBodies (a.k.a. Links) by index in a multibody plant. Interchangeable with LinkIndex.
- __init__(*args, **kwargs)
Overloaded function.
__init__(self: pydrake.multibody.tree.BodyIndex) -> None
Default constructor; the result is an invalid index. This only exists to serve applications which require a default constructor.
__init__(self: pydrake.multibody.tree.BodyIndex, arg0: int) -> None
Construction from a non-negative
int
value. The value must lie in the range of [0, 2³¹). Constructor only promises to test validity in Debug build.
- is_valid(self: pydrake.multibody.tree.BodyIndex) bool
Reports if the index is valid–the only operation on an invalid index that doesn’t throw an exception in Debug builds.
- pydrake.multibody.tree.CalcSpatialInertia(*args, **kwargs)
Overloaded function.
CalcSpatialInertia(shape: drake::geometry::Shape, density: float) -> drake::multibody::SpatialInertia<double>
Computes the SpatialInertia of a body made up of a homogeneous material (of given
density
in kg/m³) uniformly distributed in the volume of the givenshape
.The
shape
is defined in its canonical frame S and the body in frame B. The two frames are coincident and aligned (i.e., X_SB = I).Most shapes are defined such that their center of mass is coincident with So (and, therefore, Bo). These are the shapes that have symmetry across So along each of the axes Sx, Sy, Sz (e.g., geometry::Box, geometry::Sphere, etc.) For meshes, it depends on how the mesh is defined. For more discussion on the nuances of geometry::Mesh and geometry::Convex calculations CalcSpatialInertia(const geometry::TriangleSurfaceMesh<double>&,double) “see below”.
- Returns
M_BBo_B
: The spatial inertia of the hypothetical body implied by the given
shape
.
- Raises
RuntimeError if shape is an instance of geometry::HalfSpace or –
geometry::MeshcatCone. –
CalcSpatialInertia(mesh: drake::geometry::TriangleSurfaceMesh<double>, density: float) -> drake::multibody::SpatialInertia<double>
Computes the SpatialInertia of a body made up of a homogeneous material (of given
density
in kg/m³) uniformly distributed in the volume of the givenmesh
.The
mesh
is defined in its canonical frame M and the body in frame B. The two frames are coincident and aligned (i.e., X_MB = I).For the resultant spatial inertia to be meaningful, the
mesh
must satisfy certain requirements:The mesh must fully enclose a volume (no cracks, no open manifolds,
etc.). - All triangles must be “wound” such that their normals point outward (according to the right-hand rule based on vertex winding).
Drake currently doesn’t validate these requirements on the mesh. Instead, it does a best-faith effort to compute a spatial inertia. For some “bad” meshes, the SpatialInertia will be objectively physically invalid. For others, the SpatialInertia will appear physically valid, but be meaningless because it does not accurately represent the mesh.
- Raises
RuntimeError if the resulting spatial inertia is obviously –
physically invalid. See –
multibody::SpatialInertia::IsPhysicallyValid() –
- pydrake.multibody.tree.default_model_instance() pydrake.multibody.tree.ModelInstanceIndex
Returns the model instance which contains all tree elements with no explicit model instance specified.
- class pydrake.multibody.tree.DoorHinge
Bases:
pydrake.multibody.tree.ForceElement
This ForceElement models a revolute DoorHinge joint that could exhibit different force/torque characteristics at different states due to the existence of different type of torques on the joint. This class implements a “christmas tree” accumulation of these different torques in an empirical and unprincipled way. Specifically, different curves are assigned to different torques to mimic their evolution based on the joint state and some prespecified parameters.
Torques considered in this implementation include: * torsional spring torque (τ_ts) – position dependent * catch torque (τ_c) – position dependent * dynamic friction torque (τ_df) – velocity dependent * static friction torque (τ_sf) – velocity dependent * viscous friction torque (τ_vf) – velocity dependent
We then implement two curves to approximate the progression of different torques. A curve
s(t, x) = tanh(x/t)
uses thetanh
function to approximate a step curve ({x<0: -1 ;x>0
: 1}) outside of-t < x < t
. The curvedoublet(t, x) = 2 * s * (1 − s²)
is the second derivative ofs
scaled by-t²
, which yields a lump at negativex
that integrates to -1 and a lump at positivex
that integrates to 1. Finally, the total external torque on the hinge joint would be:τ = τ_ts + τ_c + τ_df + τ_sf + τ_vf
.where
τ_ts = -k_ts * (q − qs₀)
, τ_c = k_c * doublet(qc₀/2, q − qc₀/2)`, τ_df = -k_df * s(k_q̇₀, q̇)`, τ_sf = -k_sf * doublet(k_q̇₀, q̇) andτ_vf = -k_vf * q̇
. The door is assumed to be closed atq=0
, opening in the positive-q direction. Note that, the sign of the torques depends on two elements: one is the sign of the torque related constants and another one is the sign of the assigned curves. For example, as defined above, the static friction torqueτ_sf
should be opposite to the direction of the velocity q̇. The catch torqueτ_c
should be negative whenq < qc₀/2
and positive otherwise. This class applies all hinge-originating forces, so it can be used instead of the SDF viscous damping. The users could change the values of these different elements to obtain different characteristics for the DoorHinge joint that the users want to model. A jupyter notebook tool is also provided to help the users visualize the curves and design parameters. Runbazel run //bindings/pydrake/multibody:examples/door_hinge_inspector
to bring up the notebook.To give an example, a common dishwasher door has a frictional torque sufficient for it to rest motionless at any angle, a catch at the top to hold it in place, a dashpot (viscous friction source) to prevent it from swinging too fast, and a spring to counteract some of its mass. Two figures are provided to illustrate the dishwasher DoorHinge torque with the given default parameters. Figure 1 shows the static characteristic of the dishwasher door. At q = 0, there exists a negative catch torque to prevent the door from moving. After that, the torsional spring torque will dominate to compensate part of the door gravity. Figure 2 shows the dynamic feature of the dishwasher door at q = 30 deg. It shows the door can be closed easily since the torque is small when the velocity is negative. However, whenever the door intends to open further, there will be a counter torque to prevent that movement, which therefore keeps the door at rest. Note that, due to the gravity, the dishwasher door will be fully open eventually. This process can be really slow because of the default
motion_threshold
is set to be very small. You can change themotion_threshold
parameter to adjust the time. @image html drake/multibody/tree/images/torque_vs_angle.svg “Figure 1” @image html drake/multibody/tree/images/torque_vs_velocity.svg “Figure 2”Note
This class is templated; see
DoorHinge_
for the list of instantiations.- __init__(self: pydrake.multibody.tree.DoorHinge, joint: pydrake.multibody.tree.RevoluteJoint, config: pydrake.multibody.tree.DoorHingeConfig) None
Constructs a hinge force element with parameters
config
applied to the specifiedjoint
. It will throw an exception if the DoorHingeConfig is invalid.
- CalcHingeFrictionalTorque(self: pydrake.multibody.tree.DoorHinge, angular_rate: float) float
Calculates the total frictional torque with the given
angular_rate
and the internal DoorHingeConfig.
- CalcHingeSpringTorque(self: pydrake.multibody.tree.DoorHinge, angle: float) float
Calculate the total spring related torque with the given
angle
and the internal DoorHingeConfig.
- CalcHingeTorque(self: pydrake.multibody.tree.DoorHinge, angle: float, angular_rate: float) float
Calculate the total torque with the given
angle
andangular_rate
and the internal DoorHingeConfig.
- template pydrake.multibody.tree.DoorHinge_
Instantiations:
DoorHinge_[float]
,DoorHinge_[AutoDiffXd]
,DoorHinge_[Expression]
- class pydrake.multibody.tree.DoorHinge_[AutoDiffXd]
Bases:
pydrake.multibody.tree.ForceElement_[AutoDiffXd]
This ForceElement models a revolute DoorHinge joint that could exhibit different force/torque characteristics at different states due to the existence of different type of torques on the joint. This class implements a “christmas tree” accumulation of these different torques in an empirical and unprincipled way. Specifically, different curves are assigned to different torques to mimic their evolution based on the joint state and some prespecified parameters.
Torques considered in this implementation include: * torsional spring torque (τ_ts) – position dependent * catch torque (τ_c) – position dependent * dynamic friction torque (τ_df) – velocity dependent * static friction torque (τ_sf) – velocity dependent * viscous friction torque (τ_vf) – velocity dependent
We then implement two curves to approximate the progression of different torques. A curve
s(t, x) = tanh(x/t)
uses thetanh
function to approximate a step curve ({x<0: -1 ;x>0
: 1}) outside of-t < x < t
. The curvedoublet(t, x) = 2 * s * (1 − s²)
is the second derivative ofs
scaled by-t²
, which yields a lump at negativex
that integrates to -1 and a lump at positivex
that integrates to 1. Finally, the total external torque on the hinge joint would be:τ = τ_ts + τ_c + τ_df + τ_sf + τ_vf
.where
τ_ts = -k_ts * (q − qs₀)
, τ_c = k_c * doublet(qc₀/2, q − qc₀/2)`, τ_df = -k_df * s(k_q̇₀, q̇)`, τ_sf = -k_sf * doublet(k_q̇₀, q̇) andτ_vf = -k_vf * q̇
. The door is assumed to be closed atq=0
, opening in the positive-q direction. Note that, the sign of the torques depends on two elements: one is the sign of the torque related constants and another one is the sign of the assigned curves. For example, as defined above, the static friction torqueτ_sf
should be opposite to the direction of the velocity q̇. The catch torqueτ_c
should be negative whenq < qc₀/2
and positive otherwise. This class applies all hinge-originating forces, so it can be used instead of the SDF viscous damping. The users could change the values of these different elements to obtain different characteristics for the DoorHinge joint that the users want to model. A jupyter notebook tool is also provided to help the users visualize the curves and design parameters. Runbazel run //bindings/pydrake/multibody:examples/door_hinge_inspector
to bring up the notebook.To give an example, a common dishwasher door has a frictional torque sufficient for it to rest motionless at any angle, a catch at the top to hold it in place, a dashpot (viscous friction source) to prevent it from swinging too fast, and a spring to counteract some of its mass. Two figures are provided to illustrate the dishwasher DoorHinge torque with the given default parameters. Figure 1 shows the static characteristic of the dishwasher door. At q = 0, there exists a negative catch torque to prevent the door from moving. After that, the torsional spring torque will dominate to compensate part of the door gravity. Figure 2 shows the dynamic feature of the dishwasher door at q = 30 deg. It shows the door can be closed easily since the torque is small when the velocity is negative. However, whenever the door intends to open further, there will be a counter torque to prevent that movement, which therefore keeps the door at rest. Note that, due to the gravity, the dishwasher door will be fully open eventually. This process can be really slow because of the default
motion_threshold
is set to be very small. You can change themotion_threshold
parameter to adjust the time. @image html drake/multibody/tree/images/torque_vs_angle.svg “Figure 1” @image html drake/multibody/tree/images/torque_vs_velocity.svg “Figure 2”- __init__(self: pydrake.multibody.tree.DoorHinge_[AutoDiffXd], joint: pydrake.multibody.tree.RevoluteJoint_[AutoDiffXd], config: pydrake.multibody.tree.DoorHingeConfig) None
Constructs a hinge force element with parameters
config
applied to the specifiedjoint
. It will throw an exception if the DoorHingeConfig is invalid.
- CalcHingeFrictionalTorque(self: pydrake.multibody.tree.DoorHinge_[AutoDiffXd], angular_rate: pydrake.autodiffutils.AutoDiffXd) pydrake.autodiffutils.AutoDiffXd
Calculates the total frictional torque with the given
angular_rate
and the internal DoorHingeConfig.
- CalcHingeSpringTorque(self: pydrake.multibody.tree.DoorHinge_[AutoDiffXd], angle: pydrake.autodiffutils.AutoDiffXd) pydrake.autodiffutils.AutoDiffXd
Calculate the total spring related torque with the given
angle
and the internal DoorHingeConfig.
- CalcHingeTorque(self: pydrake.multibody.tree.DoorHinge_[AutoDiffXd], angle: pydrake.autodiffutils.AutoDiffXd, angular_rate: pydrake.autodiffutils.AutoDiffXd) pydrake.autodiffutils.AutoDiffXd
Calculate the total torque with the given
angle
andangular_rate
and the internal DoorHingeConfig.
- config(self: pydrake.multibody.tree.DoorHinge_[AutoDiffXd]) pydrake.multibody.tree.DoorHingeConfig
- joint(self: pydrake.multibody.tree.DoorHinge_[AutoDiffXd]) pydrake.multibody.tree.RevoluteJoint_[AutoDiffXd]
- class pydrake.multibody.tree.DoorHinge_[Expression]
Bases:
pydrake.multibody.tree.ForceElement_[Expression]
This ForceElement models a revolute DoorHinge joint that could exhibit different force/torque characteristics at different states due to the existence of different type of torques on the joint. This class implements a “christmas tree” accumulation of these different torques in an empirical and unprincipled way. Specifically, different curves are assigned to different torques to mimic their evolution based on the joint state and some prespecified parameters.
Torques considered in this implementation include: * torsional spring torque (τ_ts) – position dependent * catch torque (τ_c) – position dependent * dynamic friction torque (τ_df) – velocity dependent * static friction torque (τ_sf) – velocity dependent * viscous friction torque (τ_vf) – velocity dependent
We then implement two curves to approximate the progression of different torques. A curve
s(t, x) = tanh(x/t)
uses thetanh
function to approximate a step curve ({x<0: -1 ;x>0
: 1}) outside of-t < x < t
. The curvedoublet(t, x) = 2 * s * (1 − s²)
is the second derivative ofs
scaled by-t²
, which yields a lump at negativex
that integrates to -1 and a lump at positivex
that integrates to 1. Finally, the total external torque on the hinge joint would be:τ = τ_ts + τ_c + τ_df + τ_sf + τ_vf
.where
τ_ts = -k_ts * (q − qs₀)
, τ_c = k_c * doublet(qc₀/2, q − qc₀/2)`, τ_df = -k_df * s(k_q̇₀, q̇)`, τ_sf = -k_sf * doublet(k_q̇₀, q̇) andτ_vf = -k_vf * q̇
. The door is assumed to be closed atq=0
, opening in the positive-q direction. Note that, the sign of the torques depends on two elements: one is the sign of the torque related constants and another one is the sign of the assigned curves. For example, as defined above, the static friction torqueτ_sf
should be opposite to the direction of the velocity q̇. The catch torqueτ_c
should be negative whenq < qc₀/2
and positive otherwise. This class applies all hinge-originating forces, so it can be used instead of the SDF viscous damping. The users could change the values of these different elements to obtain different characteristics for the DoorHinge joint that the users want to model. A jupyter notebook tool is also provided to help the users visualize the curves and design parameters. Runbazel run //bindings/pydrake/multibody:examples/door_hinge_inspector
to bring up the notebook.To give an example, a common dishwasher door has a frictional torque sufficient for it to rest motionless at any angle, a catch at the top to hold it in place, a dashpot (viscous friction source) to prevent it from swinging too fast, and a spring to counteract some of its mass. Two figures are provided to illustrate the dishwasher DoorHinge torque with the given default parameters. Figure 1 shows the static characteristic of the dishwasher door. At q = 0, there exists a negative catch torque to prevent the door from moving. After that, the torsional spring torque will dominate to compensate part of the door gravity. Figure 2 shows the dynamic feature of the dishwasher door at q = 30 deg. It shows the door can be closed easily since the torque is small when the velocity is negative. However, whenever the door intends to open further, there will be a counter torque to prevent that movement, which therefore keeps the door at rest. Note that, due to the gravity, the dishwasher door will be fully open eventually. This process can be really slow because of the default
motion_threshold
is set to be very small. You can change themotion_threshold
parameter to adjust the time. @image html drake/multibody/tree/images/torque_vs_angle.svg “Figure 1” @image html drake/multibody/tree/images/torque_vs_velocity.svg “Figure 2”- __init__(self: pydrake.multibody.tree.DoorHinge_[Expression], joint: pydrake.multibody.tree.RevoluteJoint_[Expression], config: pydrake.multibody.tree.DoorHingeConfig) None
Constructs a hinge force element with parameters
config
applied to the specifiedjoint
. It will throw an exception if the DoorHingeConfig is invalid.
- CalcHingeFrictionalTorque(self: pydrake.multibody.tree.DoorHinge_[Expression], angular_rate: pydrake.symbolic.Expression) pydrake.symbolic.Expression
Calculates the total frictional torque with the given
angular_rate
and the internal DoorHingeConfig.
- CalcHingeSpringTorque(self: pydrake.multibody.tree.DoorHinge_[Expression], angle: pydrake.symbolic.Expression) pydrake.symbolic.Expression
Calculate the total spring related torque with the given
angle
and the internal DoorHingeConfig.
- CalcHingeTorque(self: pydrake.multibody.tree.DoorHinge_[Expression], angle: pydrake.symbolic.Expression, angular_rate: pydrake.symbolic.Expression) pydrake.symbolic.Expression
Calculate the total torque with the given
angle
andangular_rate
and the internal DoorHingeConfig.
- config(self: pydrake.multibody.tree.DoorHinge_[Expression]) pydrake.multibody.tree.DoorHingeConfig
- joint(self: pydrake.multibody.tree.DoorHinge_[Expression]) pydrake.multibody.tree.RevoluteJoint_[Expression]
- class pydrake.multibody.tree.DoorHingeConfig
Configuration structure for the DoorHinge.
- __init__(self: pydrake.multibody.tree.DoorHingeConfig, **kwargs) None
Initialize to empirically reasonable values measured approximately by banging on the door of a dishwasher with a force gauge.
- property catch_torque
k_c maximum catch torque applied over
catch_width
[Nm]. It should be non-negative.
- property catch_width
qc₀ measured from closed (q=0) position [radian]. It should be non-negative.
- property dynamic_friction_torque
k_df maximum dynamic friction torque measured opposite direction of motion [Nm]. It should be non-negative.
- property motion_threshold
k_q̇₀ motion threshold to start to apply friction torques [rad/s]. It should be non-negative. Realistic frictional force is very stiff, reversing entirely over zero change in position or velocity, which kills integrators. We approximate it with a continuous function. This constant [rad/s] is the scaling factor on that function – very approximately the rad/s at which half of the full frictional force is applied. This number is nonphysical; make it small but not so small that the simulation vibrates or explodes.
- property spring_constant
k_ts torsional spring constant measured toward the spring zero angle [Nm/rad]. It should be non-negative.
- property spring_zero_angle_rad
qs₀ measured outward from the closed position [radian].
- property static_friction_torque
k_sf maximum static friction measured opposite direction of motion [Nm]. It should be non-negative.
- property viscous_friction
k_vf viscous friction measured opposite direction of motion [Nm]. It should be non-negative.
- class pydrake.multibody.tree.FixedOffsetFrame
Bases:
pydrake.multibody.tree.Frame
%FixedOffsetFrame represents a material frame F whose pose is fixed with respect to a parent material frame P. The pose offset is given by a spatial transform
X_PF
, which is constant after construction. For instance, we could rigidly attach a frame F to move with a rigid body B at a fixed poseX_BF
, where B is the RigidBodyFrame associated with body B. Thus, the World frame poseX_WF
of a FixedOffsetFrame F depends only on the World frame poseX_WP
of its parent P, and the constant poseX_PF
, withX_WF=X_WP*X_PF
.For more information about spatial transforms, see multibody_spatial_pose.
Note
This class is templated; see
FixedOffsetFrame_
for the list of instantiations.- __init__(*args, **kwargs)
Overloaded function.
__init__(self: pydrake.multibody.tree.FixedOffsetFrame, name: str, P: pydrake.multibody.tree.Frame, X_PF: pydrake.math.RigidTransform, model_instance: Optional[pydrake.multibody.tree.ModelInstanceIndex] = None) -> None
Creates a material Frame F whose pose is fixed with respect to its parent material Frame P. The pose is given by a spatial transform
X_PF
; see class documentation for more information.- Parameter
name
: The name of this frame. Cannot be empty.
- Parameter
P
: The frame to which this frame is attached with a fixed pose.
- Parameter
X_PF
: The default transform giving the pose of F in P, therefore only the value (as a RigidTransform<double>) is provided.
- Parameter
model_instance
: The model instance to which this frame belongs to. If unspecified, will use P.body().model_instance().
__init__(self: pydrake.multibody.tree.FixedOffsetFrame, name: str, bodyB: drake::multibody::RigidBody<double>, X_BF: pydrake.math.RigidTransform) -> None
Creates a material Frame F whose pose is fixed with respect to the RigidBodyFrame B of the given RigidBody, which serves as F’s parent frame. The pose is given by a RigidTransform
X_BF
; see class documentation for more information.- Parameter
name
: The name of this frame. Cannot be empty.
- Parameter
bodyB
: The body whose RigidBodyFrame B is to be F’s parent frame.
- Parameter
X_BF
: The transform giving the pose of F in B.
- GetPoseInParentFrame(self: pydrake.multibody.tree.FixedOffsetFrame, context: pydrake.systems.framework.Context) pydrake.math.RigidTransform
Returns the rigid transform X_PF that characterizes
this
frame F’s pose in its parent frame P.- Parameter
context
: of the multibody plant associated with this frame.
- Parameter
- SetPoseInParentFrame(self: pydrake.multibody.tree.FixedOffsetFrame, context: pydrake.systems.framework.Context, X_PF: pydrake.math.RigidTransform) None
Sets the pose of
this
frame F in its parent frame P.- Parameter
context
: of the multibody plant associated with this frame.
- Parameter
X_PF
: Rigid transform that characterizes
this
frame F’s pose (orientation and position) in its parent frame P.
- Parameter
- template pydrake.multibody.tree.FixedOffsetFrame_
Instantiations:
FixedOffsetFrame_[float]
,FixedOffsetFrame_[AutoDiffXd]
,FixedOffsetFrame_[Expression]
- class pydrake.multibody.tree.FixedOffsetFrame_[AutoDiffXd]
Bases:
pydrake.multibody.tree.Frame_[AutoDiffXd]
%FixedOffsetFrame represents a material frame F whose pose is fixed with respect to a parent material frame P. The pose offset is given by a spatial transform
X_PF
, which is constant after construction. For instance, we could rigidly attach a frame F to move with a rigid body B at a fixed poseX_BF
, where B is the RigidBodyFrame associated with body B. Thus, the World frame poseX_WF
of a FixedOffsetFrame F depends only on the World frame poseX_WP
of its parent P, and the constant poseX_PF
, withX_WF=X_WP*X_PF
.For more information about spatial transforms, see multibody_spatial_pose.
- __init__(*args, **kwargs)
Overloaded function.
__init__(self: pydrake.multibody.tree.FixedOffsetFrame_[AutoDiffXd], name: str, P: pydrake.multibody.tree.Frame_[AutoDiffXd], X_PF: pydrake.math.RigidTransform, model_instance: Optional[pydrake.multibody.tree.ModelInstanceIndex] = None) -> None
Creates a material Frame F whose pose is fixed with respect to its parent material Frame P. The pose is given by a spatial transform
X_PF
; see class documentation for more information.- Parameter
name
: The name of this frame. Cannot be empty.
- Parameter
P
: The frame to which this frame is attached with a fixed pose.
- Parameter
X_PF
: The default transform giving the pose of F in P, therefore only the value (as a RigidTransform<double>) is provided.
- Parameter
model_instance
: The model instance to which this frame belongs to. If unspecified, will use P.body().model_instance().
__init__(self: pydrake.multibody.tree.FixedOffsetFrame_[AutoDiffXd], name: str, bodyB: drake::multibody::RigidBody<Eigen::AutoDiffScalar<Eigen::Matrix<double, -1, 1, 0, -1, 1> > >, X_BF: pydrake.math.RigidTransform) -> None
Creates a material Frame F whose pose is fixed with respect to the RigidBodyFrame B of the given RigidBody, which serves as F’s parent frame. The pose is given by a RigidTransform
X_BF
; see class documentation for more information.- Parameter
name
: The name of this frame. Cannot be empty.
- Parameter
bodyB
: The body whose RigidBodyFrame B is to be F’s parent frame.
- Parameter
X_BF
: The transform giving the pose of F in B.
- GetPoseInParentFrame(self: pydrake.multibody.tree.FixedOffsetFrame_[AutoDiffXd], context: pydrake.systems.framework.Context_[AutoDiffXd]) pydrake.math.RigidTransform_[AutoDiffXd]
Returns the rigid transform X_PF that characterizes
this
frame F’s pose in its parent frame P.- Parameter
context
: of the multibody plant associated with this frame.
- Parameter
- SetPoseInParentFrame(self: pydrake.multibody.tree.FixedOffsetFrame_[AutoDiffXd], context: pydrake.systems.framework.Context_[AutoDiffXd], X_PF: pydrake.math.RigidTransform_[AutoDiffXd]) None
Sets the pose of
this
frame F in its parent frame P.- Parameter
context
: of the multibody plant associated with this frame.
- Parameter
X_PF
: Rigid transform that characterizes
this
frame F’s pose (orientation and position) in its parent frame P.
- Parameter
- class pydrake.multibody.tree.FixedOffsetFrame_[Expression]
Bases:
pydrake.multibody.tree.Frame_[Expression]
%FixedOffsetFrame represents a material frame F whose pose is fixed with respect to a parent material frame P. The pose offset is given by a spatial transform
X_PF
, which is constant after construction. For instance, we could rigidly attach a frame F to move with a rigid body B at a fixed poseX_BF
, where B is the RigidBodyFrame associated with body B. Thus, the World frame poseX_WF
of a FixedOffsetFrame F depends only on the World frame poseX_WP
of its parent P, and the constant poseX_PF
, withX_WF=X_WP*X_PF
.For more information about spatial transforms, see multibody_spatial_pose.
- __init__(*args, **kwargs)
Overloaded function.
__init__(self: pydrake.multibody.tree.FixedOffsetFrame_[Expression], name: str, P: pydrake.multibody.tree.Frame_[Expression], X_PF: pydrake.math.RigidTransform, model_instance: Optional[pydrake.multibody.tree.ModelInstanceIndex] = None) -> None
Creates a material Frame F whose pose is fixed with respect to its parent material Frame P. The pose is given by a spatial transform
X_PF
; see class documentation for more information.- Parameter
name
: The name of this frame. Cannot be empty.
- Parameter
P
: The frame to which this frame is attached with a fixed pose.
- Parameter
X_PF
: The default transform giving the pose of F in P, therefore only the value (as a RigidTransform<double>) is provided.
- Parameter
model_instance
: The model instance to which this frame belongs to. If unspecified, will use P.body().model_instance().
__init__(self: pydrake.multibody.tree.FixedOffsetFrame_[Expression], name: str, bodyB: drake::multibody::RigidBody<drake::symbolic::Expression>, X_BF: pydrake.math.RigidTransform) -> None
Creates a material Frame F whose pose is fixed with respect to the RigidBodyFrame B of the given RigidBody, which serves as F’s parent frame. The pose is given by a RigidTransform
X_BF
; see class documentation for more information.- Parameter
name
: The name of this frame. Cannot be empty.
- Parameter
bodyB
: The body whose RigidBodyFrame B is to be F’s parent frame.
- Parameter
X_BF
: The transform giving the pose of F in B.
- GetPoseInParentFrame(self: pydrake.multibody.tree.FixedOffsetFrame_[Expression], context: pydrake.systems.framework.Context_[Expression]) pydrake.math.RigidTransform_[Expression]
Returns the rigid transform X_PF that characterizes
this
frame F’s pose in its parent frame P.- Parameter
context
: of the multibody plant associated with this frame.
- Parameter
- SetPoseInParentFrame(self: pydrake.multibody.tree.FixedOffsetFrame_[Expression], context: pydrake.systems.framework.Context_[Expression], X_PF: pydrake.math.RigidTransform_[Expression]) None
Sets the pose of
this
frame F in its parent frame P.- Parameter
context
: of the multibody plant associated with this frame.
- Parameter
X_PF
: Rigid transform that characterizes
this
frame F’s pose (orientation and position) in its parent frame P.
- Parameter
- class pydrake.multibody.tree.ForceElement
A ForceElement allows modeling state and time dependent forces in a MultibodyTree model. Examples of such forces are springs, dampers, drag and gravity. Forces that depend on accelerations such as virtual mass cannot be modeled with a ForceElement. This abstract class provides an API that all force elements subclasses must implement in order to be fully defined. These are:
CalcAndAddForceContribution(): computes the force contribution of a force element in a MultibodyTree model.
CalcPotentialEnergy(): computes a force element potential energy contribution.
CalcConservativePower(): computes the power generated by conservative forces.
CalcNonConservativePower(): computes the power dissipated by non-conservative forces.
Note
This class is templated; see
ForceElement_
for the list of instantiations.- __init__(*args, **kwargs)
- GetParentPlant(self: pydrake.multibody.tree.ForceElement) drake::multibody::MultibodyPlant<double>
- model_instance(self: pydrake.multibody.tree.ForceElement) pydrake.multibody.tree.ModelInstanceIndex
- template pydrake.multibody.tree.ForceElement_
Instantiations:
ForceElement_[float]
,ForceElement_[AutoDiffXd]
,ForceElement_[Expression]
- class pydrake.multibody.tree.ForceElement_[AutoDiffXd]
A ForceElement allows modeling state and time dependent forces in a MultibodyTree model. Examples of such forces are springs, dampers, drag and gravity. Forces that depend on accelerations such as virtual mass cannot be modeled with a ForceElement. This abstract class provides an API that all force elements subclasses must implement in order to be fully defined. These are:
CalcAndAddForceContribution(): computes the force contribution of a force element in a MultibodyTree model.
CalcPotentialEnergy(): computes a force element potential energy contribution.
CalcConservativePower(): computes the power generated by conservative forces.
CalcNonConservativePower(): computes the power dissipated by non-conservative forces.
- __init__(*args, **kwargs)
- GetParentPlant(self: pydrake.multibody.tree.ForceElement_[AutoDiffXd]) drake::multibody::MultibodyPlant<Eigen::AutoDiffScalar<Eigen::Matrix<double, -1, 1, 0, -1, 1> > >
- index(self: pydrake.multibody.tree.ForceElement_[AutoDiffXd]) pydrake.multibody.tree.ForceElementIndex
- model_instance(self: pydrake.multibody.tree.ForceElement_[AutoDiffXd]) pydrake.multibody.tree.ModelInstanceIndex
- class pydrake.multibody.tree.ForceElement_[Expression]
A ForceElement allows modeling state and time dependent forces in a MultibodyTree model. Examples of such forces are springs, dampers, drag and gravity. Forces that depend on accelerations such as virtual mass cannot be modeled with a ForceElement. This abstract class provides an API that all force elements subclasses must implement in order to be fully defined. These are:
CalcAndAddForceContribution(): computes the force contribution of a force element in a MultibodyTree model.
CalcPotentialEnergy(): computes a force element potential energy contribution.
CalcConservativePower(): computes the power generated by conservative forces.
CalcNonConservativePower(): computes the power dissipated by non-conservative forces.
- __init__(*args, **kwargs)
- GetParentPlant(self: pydrake.multibody.tree.ForceElement_[Expression]) drake::multibody::MultibodyPlant<drake::symbolic::Expression>
- index(self: pydrake.multibody.tree.ForceElement_[Expression]) pydrake.multibody.tree.ForceElementIndex
- model_instance(self: pydrake.multibody.tree.ForceElement_[Expression]) pydrake.multibody.tree.ModelInstanceIndex
- class pydrake.multibody.tree.ForceElementIndex
Type used to identify force elements by index within a multibody plant.
- __init__(*args, **kwargs)
Overloaded function.
__init__(self: pydrake.multibody.tree.ForceElementIndex) -> None
Default constructor; the result is an invalid index. This only exists to serve applications which require a default constructor.
__init__(self: pydrake.multibody.tree.ForceElementIndex, arg0: int) -> None
Construction from a non-negative
int
value. The value must lie in the range of [0, 2³¹). Constructor only promises to test validity in Debug build.
- is_valid(self: pydrake.multibody.tree.ForceElementIndex) bool
Reports if the index is valid–the only operation on an invalid index that doesn’t throw an exception in Debug builds.
- class pydrake.multibody.tree.Frame
%Frame is an abstract class representing a material frame (also called a physical frame) of its underlying RigidBody. The Frame’s origin is a material point of its RigidBody, and its axes have fixed directions in that body. A Frame’s pose (position and orientation) with respect to its RigidBodyFrame may be parameterized, but is fixed (not time or state dependent) once parameters have been set.
An important characteristic of a Frame is that forces or torques applied to a Frame are applied to the Frame’s underlying RigidBody. Force-producing elements like joints, actuators, and constraints usually employ two Frames, with one Frame connected to one body and the other connected to a different body. Every Frame F can report the RigidBody B to which it is attached and its pose X_BF with respect to B’s RigidBodyFrame.
A Frame’s pose in World (or relative to other frames) is always calculated starting with its pose relative to its underlying RigidBodyFrame. Subclasses derived from Frame differ in how kinematic calculations are performed. For example, the angular velocity of a FixedOffsetFrame or RigidBodyFrame is identical to the angular velocity of its underlying body, whereas the translational velocity of a FixedOffsetFrame differs from that of a RigidBodyFrame.
Frame provides methods for obtaining its current orientation, position, motion, etc. from a Context passed to those methods.
Note
This class is templated; see
Frame_
for the list of instantiations.- __init__(*args, **kwargs)
- body(self: pydrake.multibody.tree.Frame) drake::multibody::RigidBody<double>
Returns a const reference to the body associated to this Frame.
- CalcAngularVelocity(self: pydrake.multibody.tree.Frame, context: pydrake.systems.framework.Context, measured_in_frame: pydrake.multibody.tree.Frame, expressed_in_frame: pydrake.multibody.tree.Frame) numpy.ndarray[numpy.float64[3, 1]]
Calculates
this
frame F’s angular velocity measured in a frame M, expressed in a frame E.- Parameter
context
: contains the state of the multibody system.
- Parameter
measured_in_frame
: which is frame M (the frame in which
this
angular velocity is to be measured).- Parameter
expressed_in_frame
: which is frame E (the frame in which the returned angular velocity is to be expressed).
- Returns
ω_MF_E,
this
frame F’s angular velocity ω measured in frame M, expressed in frame E.
See also
EvalAngularVelocityInWorld() to evaluate ω_WF_W (
this
frame F’s angular velocity ω measured and expressed in the world frame W).- Parameter
- CalcOffsetPoseInBody(self: pydrake.multibody.tree.Frame, context: pydrake.systems.framework.Context, X_FQ: pydrake.math.RigidTransform) pydrake.math.RigidTransform
Given the offset pose
X_FQ
of a frame Q inthis
frame F, this method computes the poseX_BQ
of frame Q in the body frame B to which this frame is attached. In other words, if the pose ofthis
frame F in the body frame B isX_BF
, this method computes the poseX_BQ
of frame Q in the body frame B asX_BQ = X_BF * X_FQ
. In particular, ifthis
**is**` the body frame B, i.e.X_BF
is the identity transformation, this method directly returnsX_FQ
. Specific frame subclasses can override this method to provide faster implementations if needed.
- CalcOffsetRotationMatrixInBody(self: pydrake.multibody.tree.Frame, context: pydrake.systems.framework.Context, R_FQ: pydrake.math.RotationMatrix) pydrake.math.RotationMatrix
Calculates and returns the rotation matrix
R_BQ
that relates body frame B to frame Q viathis
intermediate frame F, i.e.,R_BQ = R_BF * R_FQ
(B is the body frame to whichthis
frame F is attached).- Parameter
R_FQ
: rotation matrix that relates frame F to frame Q.
- Parameter
- CalcPose(self: pydrake.multibody.tree.Frame, context: pydrake.systems.framework.Context, frame_M: pydrake.multibody.tree.Frame) pydrake.math.RigidTransform
Computes and returns the pose
X_MF
ofthis
frame F in measured inframe_M
as a function of the state of the model stored incontext
.See also
CalcPoseInWorld().
- CalcPoseInBodyFrame(self: pydrake.multibody.tree.Frame, context: pydrake.systems.framework.Context) pydrake.math.RigidTransform
Returns the pose
X_BF
ofthis
frame F in the body frame B associated with this frame. In particular, ifthis
is the body frame B, this method directly returns the identity transformation. Note that this ONLY depends on the Parameters in the context; it does not depend on time, input, state, etc.
- CalcPoseInWorld(self: pydrake.multibody.tree.Frame, context: pydrake.systems.framework.Context) pydrake.math.RigidTransform
Computes and returns the pose
X_WF
ofthis
frame F in the world frame W as a function of the state of the model stored incontext
.Note
RigidBody::EvalPoseInWorld() provides a more efficient way to obtain the pose for a body frame.
- CalcRelativeSpatialAcceleration(self: pydrake.multibody.tree.Frame, context: pydrake.systems.framework.Context, other_frame: pydrake.multibody.tree.Frame, measured_in_frame: pydrake.multibody.tree.Frame, expressed_in_frame: pydrake.multibody.tree.Frame) pydrake.multibody.math.SpatialAcceleration
Calculates
this
frame C’s spatial acceleration relative to another frame B, measured in a frame M, expressed in a frame E.- Parameter
context
: contains the state of the multibody system.
- Parameter
other_frame
: which is frame B.
- Parameter
measured_in_frame
: which is frame M.
- Parameter
expressed_in_frame
: which is frame E.
- Returns
A_M_BC_E = A_MC_E - A_MB_E, frame C’s spatial acceleration relative to frame B, measured in frame M, expressed in frame E.
In general, A_M_BC = DtW(V_M_BC), the time-derivative in frame M of frame C’s spatial velocity relative to frame B. The rotational part of the returned quantity is α_MC_E - α_MB_E = DtM(ω_BC)_E. Note: For 3D analysis, DtM(ω_BC) ≠ α_BC. The translational part of the returned quantity is a_M_BoCo_E (Co’s translational acceleration relative to Bo, measured in frame M, expressed in frame E).
Click to expand C++ code...
α_MC_E - α_MB_E = DtM(ω_MC)_E - DtM(ω_MB)_E = DtM(ω_BC)_E a_M_BoCo_E = a_MCo_E - a_MBo_E = DtM(v_MCo) - DtM(v_MBo) = Dt²M(p_BoCo)_E
where Dt²M(p_BoCo)_E is the 2ⁿᵈ time-derivative in frame M of p_BoCo (the position vector from Bo to Co), and this result is expressed in frame E.
Note
The calculation of the 2ⁿᵈ time-derivative of the distance between Bo and Co can be done with relative translational acceleration, but this calculation does not depend on the measured-in-frame, hence in this case, consider CalcRelativeSpatialAccelerationInWorld() since it is faster.
See also
CalcSpatialAccelerationInWorld(), CalcSpatialAcceleration(), and CalcRelativeSpatialAccelerationInWorld().
- Parameter
- CalcRelativeSpatialAccelerationInWorld(self: pydrake.multibody.tree.Frame, context: pydrake.systems.framework.Context, other_frame: pydrake.multibody.tree.Frame) pydrake.multibody.math.SpatialAcceleration
Calculates
this
frame C’s spatial acceleration relative to another frame B, measured and expressed in the world frame W.- Parameter
context
: contains the state of the multibody system.
- Parameter
other_frame
: which is frame B.
- Returns
A_W_BC_W = A_WC_W - A_WB_W, frame C’s spatial acceleration relative to frame B, measured and expressed in the world frame W.
In general, A_W_BC = DtW(V_W_BC), the time-derivative in the world frame W of frame C’s spatial velocity relative to frame B. The rotational part of the returned quantity is α_WC_W - α_WB_W = DtW(ω_BC)_W. For 3D analysis, DtW(ω_BC) ≠ α_BC. The translational part of the returned quantity is a_W_BoCo_W (Co’s translational acceleration relative to Bo, measured and expressed in world frame W).
Click to expand C++ code...
α_WC_W - α_WB_W = DtW(ω_WC)_W - DtW(ω_WB)_W = DtW(ω_BC)_W a_W_BoCo_W = a_WCo_W - a_WBo_W = DtW(v_WCo) - DtW(v_WBo) = Dt²W(p_BoCo)_W
where Dt²W(p_BoCo)_W is the 2ⁿᵈ time-derivative in frame W of p_BoCo (the position vector from Bo to Co), and this result is expressed in frame W.
Note
The method CalcSpatialAccelerationInWorld() is more efficient and coherent if any of
this
, other_frame, or the world frame W are the same.See also
CalcSpatialAccelerationInWorld(), CalcRelativeSpatialAcceleration().
- Parameter
- CalcRelativeSpatialVelocity(self: pydrake.multibody.tree.Frame, context: pydrake.systems.framework.Context, other_frame: pydrake.multibody.tree.Frame, measured_in_frame: pydrake.multibody.tree.Frame, expressed_in_frame: pydrake.multibody.tree.Frame) pydrake.multibody.math.SpatialVelocity
Calculates
this
frame C’s spatial velocity relative to another frame B, measured in a frame M, expressed in a frame E.- Parameter
context
: contains the state of the multibody system.
- Parameter
other_frame
: which is frame B.
- Parameter
measured_in_frame
: which is frame M.
- Parameter
expressed_in_frame
: which is frame E.
- Returns
V_M_BC_E = V_MC_E - V_MB_E, frame C’s spatial velocity relative to frame B, measured in frame M, expressed in frame E. The rotational part of the returned quantity is ω_BC_E (C’s angular velocity measured in B and expressed in E). The translational part is v_M_BoCo_E (Co’s translational velocity relative to Bo, measured in M, and expressed in E).
Click to expand C++ code...
ω_BC_E = ω_MC_E - ω_MB_E v_M_BoCo_E = v_MCo_E - v_MBo_E = DtM(p_BoCo)
where DtM(p_BoCo) is the time-derivative in frame M of p_BoCo (position vector from Bo to Co), and this vector is expressed in frame E.
Note
The method CalcSpatialVelocity() is more efficient and coherent if any of
this
, other_frame, or measured_in_frame are the same. Also, the value of V_M_BoCo does not depend on the measured_in_frame if Bo and Co are coincident (i.e., p_BoCo = 0), in which case consider the more efficient method CalcRelativeSpatialVelocityInWorld(). Lastly, the calculation of elongation between Bo and Co can be done with relative translational velocity, but elongation does not depend on the measured-in-frame (hence consider CalcRelativeSpatialVelocityInWorld()).See also
CalcSpatialVelocityInWorld(), CalcSpatialVelocity(), and CalcRelativeSpatialVelocityInWorld().
- Parameter
- CalcRelativeSpatialVelocityInWorld(self: pydrake.multibody.tree.Frame, context: pydrake.systems.framework.Context, other_frame: pydrake.multibody.tree.Frame) pydrake.multibody.math.SpatialVelocity
Calculates
this
frame C’s spatial velocity relative to another frame B, measured and expressed in the world frame W.- Parameter
context
: contains the state of the multibody system.
- Parameter
other_frame
: which is frame B.
- Returns
V_W_BC_W = V_WC_W - V_WB_W, frame C’s spatial velocity relative to frame B, measured and expressed in the world frame W. The rotational part of the returned quantity is ω_BC_W (C’s angular velocity measured in B and expressed in W). The translational part is v_W_BoCo_W (Co’s translational velocity relative to Bo, measured and expressed in world frame W).
Click to expand C++ code...
ω_BC_W = ω_WC_W - ω_WB_W v_W_BoCo_W = v_WCo_W - v_WBo_W = DtW(p_BoCo)
where DtW(p_BoCo) is the time-derivative in frame W of p_BoCo (position vector from Bo to Co), and this vector is expressed in frame W.
Note
The method CalcSpatialVelocityInWorld() is more efficient and coherent if any of
this
, other_frame, or the world frame W are the same.See also
CalcSpatialVelocityInWorld() and CalcRelativeSpatialVelocity().
- Parameter
- CalcRotationMatrix(self: pydrake.multibody.tree.Frame, context: pydrake.systems.framework.Context, frame_M: pydrake.multibody.tree.Frame) pydrake.math.RotationMatrix
Calculates and returns the rotation matrix
R_MF
that relatesframe_M
andthis
frame F as a function of the state stored incontext
.
- CalcRotationMatrixInBodyFrame(self: pydrake.multibody.tree.Frame, context: pydrake.systems.framework.Context) pydrake.math.RotationMatrix
Returns the rotation matrix
R_BF
that relates body frame B tothis
frame F (B is the body frame to whichthis
frame F is attached).Note
If
this
is B, this method returns the identity RotationMatrix. Note that this ONLY depends on the Parameters in the context; it does not depend on time, input, state, etc.
- CalcRotationMatrixInWorld(self: pydrake.multibody.tree.Frame, context: pydrake.systems.framework.Context) pydrake.math.RotationMatrix
Calculates and returns the rotation matrix
R_WF
that relates the world frame W andthis
frame F as a function of the state stored incontext
.
- CalcSpatialAcceleration(self: pydrake.multibody.tree.Frame, context: pydrake.systems.framework.Context, measured_in_frame: pydrake.multibody.tree.Frame, expressed_in_frame: pydrake.multibody.tree.Frame) pydrake.multibody.math.SpatialAcceleration
Calculates
this
frame F’s spatial acceleration measured in a frame M, expressed in a frame E.- Parameter
context
: contains the state of the multibody system.
- Parameter
measured_in_frame
: which is frame M.
- Parameter
expressed_in_frame
: which is frame E.
- Returns
A_MF_E,
this
frame F’s spatial acceleration measured in frame M, expressed in frame E. The rotational part of the returned quantity is α_MF_E (frame F’s angular acceleration α measured in frame M, expressed in frame E). The translational part is a_MFo_E (translational acceleration of frame F’s origin point Fo, measured in frame M, expressed in frame E). Although α_MF is defined below in terms of DtM(ω_MF), the time-derivative in frame M of ω_MF, the actual calculation of α_MF avoids differentiation. Similarly for the definition vs. calculation for a_MFo.
Click to expand C++ code...
α_MF = DtM(ω_MF) ω_MF is frame F's angular velocity in frame M. a_MFo = DtM(v_MFo) v_MF is Fo's translational acceleration in frame M.
See also
CalcSpatialAccelerationInWorld() and CalcSpatialVelocity().
- Parameter
- CalcSpatialAccelerationInWorld(self: pydrake.multibody.tree.Frame, context: pydrake.systems.framework.Context) pydrake.multibody.math.SpatialAcceleration
Calculates
this
frame F’s spatial acceleration measured and expressed in the world frame W.- Parameter
context
: contains the state of the multibody system.
- Returns
A_WF_W,
this
frame F’s spatial acceleration measured and expressed in the world frame W. The rotational part of the returned quantity is α_WF_E (frame F’s angular acceleration α measured and expressed in the world frame W). The translational part is a_WFo_W (translational acceleration of frame F’s origin point Fo, measured and expressed in the world frame W).
Note
RigidBody::EvalSpatialAccelerationInWorld() provides a more efficient way to obtain a body frame’s spatial acceleration measured in the world frame.
Note
When cached values are out of sync with the state stored in context, this method performs an expensive forward dynamics computation, whereas once evaluated, successive calls to this method are inexpensive.
See also
CalcSpatialAcceleration() and CalcSpatialVelocityInWorld().
- Parameter
- CalcSpatialVelocity(self: pydrake.multibody.tree.Frame, context: pydrake.systems.framework.Context, frame_M: pydrake.multibody.tree.Frame, frame_E: pydrake.multibody.tree.Frame) pydrake.multibody.math.SpatialVelocity
Calculates
this
frame F’s spatial velocity measured in a frame M, expressed in a frame E.- Parameter
context
: contains the state of the multibody system.
- Parameter
frame_M
: which is the measured_in_frame.
- Parameter
frame_E
: which is the expressed_in_frame.
- Returns
V_MF_E,
this
frame F’s spatial velocity measured in frame M, expressed in frame E. The rotational part of the returned quantity is ω_MF_E (frame F’s angular velocity ω measured in frame M, expressed in frame E). The translational part is v_MFo_E (translational velocity v of frame F’s origin point Fo, measured in frame M, expressed in frame E).
See also
CalcSpatialVelocityInWorld(), CalcRelativeSpatialVelocity(), and CalcSpatialAcceleration().
- Parameter
- CalcSpatialVelocityInWorld(self: pydrake.multibody.tree.Frame, context: pydrake.systems.framework.Context) pydrake.multibody.math.SpatialVelocity
Calculates
this
frame F’s spatial velocity measured and expressed in the world frame W.- Parameter
context
: contains the state of the multibody system.
- Returns
V_WF_W,
this
frame F’s spatial velocity measured and expressed in the world frame W. The rotational part of the returned quantity is ω_WF_W (frame F’s angular velocity ω measured and expressed in the world frame W). The translational part is v_WFo_W (translational velocity v of frame F’s origin point Fo, measured and expressed in the world frame W).
Note
RigidBody::EvalSpatialVelocityInWorld() provides a more efficient way to obtain a body frame’s spatial velocity measured in the world frame.
See also
CalcSpatialVelocity(), CalcRelativeSpatialVelocityInWorld(), and CalcSpatialAccelerationInWorld().
- Parameter
- EvalAngularVelocityInWorld(self: pydrake.multibody.tree.Frame, context: pydrake.systems.framework.Context) numpy.ndarray[numpy.float64[3, 1]]
Evaluates
this
frame F’s angular velocity measured and expressed in the world frame W.- Parameter
context
: contains the state of the multibody system.
- Returns
ω_WF_W (frame F’s angular velocity ω measured and expressed in the world frame W).
See also
CalcAngularVelocity() to calculate ω_MF_E (
this
frame F’s angular velocity ω measured in a frame M and expressed in a frame E).- Parameter
- GetFixedOffsetPoseInBody(self: pydrake.multibody.tree.Frame, X_FQ: pydrake.math.RigidTransform) pydrake.math.RigidTransform
Variant of CalcOffsetPoseInBody() that given the offset pose
X_FQ
of a frame Q inthis
frame F, returns the poseX_BQ
of frame Q in the body frame B to which this frame is attached.- Raises
RuntimeError if called on a Frame that does not have a fixed –
offset in the body frame. –
- GetFixedPoseInBodyFrame(*args, **kwargs)
Overloaded function.
GetFixedPoseInBodyFrame(self: pydrake.multibody.tree.Frame) -> pydrake.math.RigidTransform
Variant of CalcPoseInBodyFrame() that returns the fixed pose
X_BF
ofthis
frame F in the body frame B associated with this frame.- Raises
RuntimeError if called on a Frame that does not have a fixed –
offset in the body frame. –
GetFixedPoseInBodyFrame(self: pydrake.multibody.tree.Frame) -> pydrake.math.RigidTransform
Variant of CalcPoseInBodyFrame() that returns the fixed pose
X_BF
ofthis
frame F in the body frame B associated with this frame.- Raises
RuntimeError if called on a Frame that does not have a fixed –
offset in the body frame. –
- GetFixedRotationMatrixInBody(self: pydrake.multibody.tree.Frame, R_FQ: pydrake.math.RotationMatrix) pydrake.math.RotationMatrix
Calculates and returns the rotation matrix
R_BQ
that relates body frame B to frame Q viathis
intermediate frame F, i.e.,R_BQ = R_BF * R_FQ
(B is the body frame to whichthis
frame F is attached).- Parameter
R_FQ
: rotation matrix that relates frame F to frame Q.
- Raises
RuntimeError if this frame F is a Frame that does not have a –
fixed offset in the body frame B (i.e., R_BF is not constant) –
- Parameter
- GetFixedRotationMatrixInBodyFrame(self: pydrake.multibody.tree.Frame) pydrake.math.RotationMatrix
Returns the rotation matrix
R_BF
that relates body frame B tothis
frame F (B is the body frame to whichthis
frame F is attached).- Raises
RuntimeError if this frame F is a Frame that does not have a –
fixed offset in the body frame B (i.e., R_BF is not constant) –
Frame sub-classes that have a constant R_BF must override this –
method. An example of a frame sub-class not implementing this –
method would be that of a frame on a soft body, for which its pose –
in the body frame depends on the state of deformation of the body. –
- GetParentPlant(self: pydrake.multibody.tree.Frame) drake::multibody::MultibodyPlant<double>
- is_body_frame(self: pydrake.multibody.tree.Frame) bool
Returns true if
this
is the body frame.
- is_world_frame(self: pydrake.multibody.tree.Frame) bool
Returns true if
this
is the world frame.
- model_instance(self: pydrake.multibody.tree.Frame) pydrake.multibody.tree.ModelInstanceIndex
- name(self: pydrake.multibody.tree.Frame) str
Returns the name of this frame. The name will never be empty.
- scoped_name(self: pydrake.multibody.tree.Frame) pydrake.multibody.tree.ScopedName
Returns scoped name of this frame. Neither of the two pieces of the name will be empty (the scope name and the element name).
- template pydrake.multibody.tree.Frame_
Instantiations:
Frame_[float]
,Frame_[AutoDiffXd]
,Frame_[Expression]
- class pydrake.multibody.tree.Frame_[AutoDiffXd]
%Frame is an abstract class representing a material frame (also called a physical frame) of its underlying RigidBody. The Frame’s origin is a material point of its RigidBody, and its axes have fixed directions in that body. A Frame’s pose (position and orientation) with respect to its RigidBodyFrame may be parameterized, but is fixed (not time or state dependent) once parameters have been set.
An important characteristic of a Frame is that forces or torques applied to a Frame are applied to the Frame’s underlying RigidBody. Force-producing elements like joints, actuators, and constraints usually employ two Frames, with one Frame connected to one body and the other connected to a different body. Every Frame F can report the RigidBody B to which it is attached and its pose X_BF with respect to B’s RigidBodyFrame.
A Frame’s pose in World (or relative to other frames) is always calculated starting with its pose relative to its underlying RigidBodyFrame. Subclasses derived from Frame differ in how kinematic calculations are performed. For example, the angular velocity of a FixedOffsetFrame or RigidBodyFrame is identical to the angular velocity of its underlying body, whereas the translational velocity of a FixedOffsetFrame differs from that of a RigidBodyFrame.
Frame provides methods for obtaining its current orientation, position, motion, etc. from a Context passed to those methods.
- __init__(*args, **kwargs)
- body(self: pydrake.multibody.tree.Frame_[AutoDiffXd]) drake::multibody::RigidBody<Eigen::AutoDiffScalar<Eigen::Matrix<double, -1, 1, 0, -1, 1> > >
Returns a const reference to the body associated to this Frame.
- CalcAngularVelocity(self: pydrake.multibody.tree.Frame_[AutoDiffXd], context: pydrake.systems.framework.Context_[AutoDiffXd], measured_in_frame: pydrake.multibody.tree.Frame_[AutoDiffXd], expressed_in_frame: pydrake.multibody.tree.Frame_[AutoDiffXd]) numpy.ndarray[object[3, 1]]
Calculates
this
frame F’s angular velocity measured in a frame M, expressed in a frame E.- Parameter
context
: contains the state of the multibody system.
- Parameter
measured_in_frame
: which is frame M (the frame in which
this
angular velocity is to be measured).- Parameter
expressed_in_frame
: which is frame E (the frame in which the returned angular velocity is to be expressed).
- Returns
ω_MF_E,
this
frame F’s angular velocity ω measured in frame M, expressed in frame E.
See also
EvalAngularVelocityInWorld() to evaluate ω_WF_W (
this
frame F’s angular velocity ω measured and expressed in the world frame W).- Parameter
- CalcOffsetPoseInBody(self: pydrake.multibody.tree.Frame_[AutoDiffXd], context: pydrake.systems.framework.Context_[AutoDiffXd], X_FQ: pydrake.math.RigidTransform_[AutoDiffXd]) pydrake.math.RigidTransform_[AutoDiffXd]
Given the offset pose
X_FQ
of a frame Q inthis
frame F, this method computes the poseX_BQ
of frame Q in the body frame B to which this frame is attached. In other words, if the pose ofthis
frame F in the body frame B isX_BF
, this method computes the poseX_BQ
of frame Q in the body frame B asX_BQ = X_BF * X_FQ
. In particular, ifthis
**is**` the body frame B, i.e.X_BF
is the identity transformation, this method directly returnsX_FQ
. Specific frame subclasses can override this method to provide faster implementations if needed.
- CalcOffsetRotationMatrixInBody(self: pydrake.multibody.tree.Frame_[AutoDiffXd], context: pydrake.systems.framework.Context_[AutoDiffXd], R_FQ: pydrake.math.RotationMatrix_[AutoDiffXd]) pydrake.math.RotationMatrix_[AutoDiffXd]
Calculates and returns the rotation matrix
R_BQ
that relates body frame B to frame Q viathis
intermediate frame F, i.e.,R_BQ = R_BF * R_FQ
(B is the body frame to whichthis
frame F is attached).- Parameter
R_FQ
: rotation matrix that relates frame F to frame Q.
- Parameter
- CalcPose(self: pydrake.multibody.tree.Frame_[AutoDiffXd], context: pydrake.systems.framework.Context_[AutoDiffXd], frame_M: pydrake.multibody.tree.Frame_[AutoDiffXd]) pydrake.math.RigidTransform_[AutoDiffXd]
Computes and returns the pose
X_MF
ofthis
frame F in measured inframe_M
as a function of the state of the model stored incontext
.See also
CalcPoseInWorld().
- CalcPoseInBodyFrame(self: pydrake.multibody.tree.Frame_[AutoDiffXd], context: pydrake.systems.framework.Context_[AutoDiffXd]) pydrake.math.RigidTransform_[AutoDiffXd]
Returns the pose
X_BF
ofthis
frame F in the body frame B associated with this frame. In particular, ifthis
is the body frame B, this method directly returns the identity transformation. Note that this ONLY depends on the Parameters in the context; it does not depend on time, input, state, etc.
- CalcPoseInWorld(self: pydrake.multibody.tree.Frame_[AutoDiffXd], context: pydrake.systems.framework.Context_[AutoDiffXd]) pydrake.math.RigidTransform_[AutoDiffXd]
Computes and returns the pose
X_WF
ofthis
frame F in the world frame W as a function of the state of the model stored incontext
.Note
RigidBody::EvalPoseInWorld() provides a more efficient way to obtain the pose for a body frame.
- CalcRelativeSpatialAcceleration(self: pydrake.multibody.tree.Frame_[AutoDiffXd], context: pydrake.systems.framework.Context_[AutoDiffXd], other_frame: pydrake.multibody.tree.Frame_[AutoDiffXd], measured_in_frame: pydrake.multibody.tree.Frame_[AutoDiffXd], expressed_in_frame: pydrake.multibody.tree.Frame_[AutoDiffXd]) pydrake.multibody.math.SpatialAcceleration_[AutoDiffXd]
Calculates
this
frame C’s spatial acceleration relative to another frame B, measured in a frame M, expressed in a frame E.- Parameter
context
: contains the state of the multibody system.
- Parameter
other_frame
: which is frame B.
- Parameter
measured_in_frame
: which is frame M.
- Parameter
expressed_in_frame
: which is frame E.
- Returns
A_M_BC_E = A_MC_E - A_MB_E, frame C’s spatial acceleration relative to frame B, measured in frame M, expressed in frame E.
In general, A_M_BC = DtW(V_M_BC), the time-derivative in frame M of frame C’s spatial velocity relative to frame B. The rotational part of the returned quantity is α_MC_E - α_MB_E = DtM(ω_BC)_E. Note: For 3D analysis, DtM(ω_BC) ≠ α_BC. The translational part of the returned quantity is a_M_BoCo_E (Co’s translational acceleration relative to Bo, measured in frame M, expressed in frame E).
Click to expand C++ code...
α_MC_E - α_MB_E = DtM(ω_MC)_E - DtM(ω_MB)_E = DtM(ω_BC)_E a_M_BoCo_E = a_MCo_E - a_MBo_E = DtM(v_MCo) - DtM(v_MBo) = Dt²M(p_BoCo)_E
where Dt²M(p_BoCo)_E is the 2ⁿᵈ time-derivative in frame M of p_BoCo (the position vector from Bo to Co), and this result is expressed in frame E.
Note
The calculation of the 2ⁿᵈ time-derivative of the distance between Bo and Co can be done with relative translational acceleration, but this calculation does not depend on the measured-in-frame, hence in this case, consider CalcRelativeSpatialAccelerationInWorld() since it is faster.
See also
CalcSpatialAccelerationInWorld(), CalcSpatialAcceleration(), and CalcRelativeSpatialAccelerationInWorld().
- Parameter
- CalcRelativeSpatialAccelerationInWorld(self: pydrake.multibody.tree.Frame_[AutoDiffXd], context: pydrake.systems.framework.Context_[AutoDiffXd], other_frame: pydrake.multibody.tree.Frame_[AutoDiffXd]) pydrake.multibody.math.SpatialAcceleration_[AutoDiffXd]
Calculates
this
frame C’s spatial acceleration relative to another frame B, measured and expressed in the world frame W.- Parameter
context
: contains the state of the multibody system.
- Parameter
other_frame
: which is frame B.
- Returns
A_W_BC_W = A_WC_W - A_WB_W, frame C’s spatial acceleration relative to frame B, measured and expressed in the world frame W.
In general, A_W_BC = DtW(V_W_BC), the time-derivative in the world frame W of frame C’s spatial velocity relative to frame B. The rotational part of the returned quantity is α_WC_W - α_WB_W = DtW(ω_BC)_W. For 3D analysis, DtW(ω_BC) ≠ α_BC. The translational part of the returned quantity is a_W_BoCo_W (Co’s translational acceleration relative to Bo, measured and expressed in world frame W).
Click to expand C++ code...
α_WC_W - α_WB_W = DtW(ω_WC)_W - DtW(ω_WB)_W = DtW(ω_BC)_W a_W_BoCo_W = a_WCo_W - a_WBo_W = DtW(v_WCo) - DtW(v_WBo) = Dt²W(p_BoCo)_W
where Dt²W(p_BoCo)_W is the 2ⁿᵈ time-derivative in frame W of p_BoCo (the position vector from Bo to Co), and this result is expressed in frame W.
Note
The method CalcSpatialAccelerationInWorld() is more efficient and coherent if any of
this
, other_frame, or the world frame W are the same.See also
CalcSpatialAccelerationInWorld(), CalcRelativeSpatialAcceleration().
- Parameter
- CalcRelativeSpatialVelocity(self: pydrake.multibody.tree.Frame_[AutoDiffXd], context: pydrake.systems.framework.Context_[AutoDiffXd], other_frame: pydrake.multibody.tree.Frame_[AutoDiffXd], measured_in_frame: pydrake.multibody.tree.Frame_[AutoDiffXd], expressed_in_frame: pydrake.multibody.tree.Frame_[AutoDiffXd]) pydrake.multibody.math.SpatialVelocity_[AutoDiffXd]
Calculates
this
frame C’s spatial velocity relative to another frame B, measured in a frame M, expressed in a frame E.- Parameter
context
: contains the state of the multibody system.
- Parameter
other_frame
: which is frame B.
- Parameter
measured_in_frame
: which is frame M.
- Parameter
expressed_in_frame
: which is frame E.
- Returns
V_M_BC_E = V_MC_E - V_MB_E, frame C’s spatial velocity relative to frame B, measured in frame M, expressed in frame E. The rotational part of the returned quantity is ω_BC_E (C’s angular velocity measured in B and expressed in E). The translational part is v_M_BoCo_E (Co’s translational velocity relative to Bo, measured in M, and expressed in E).
Click to expand C++ code...
ω_BC_E = ω_MC_E - ω_MB_E v_M_BoCo_E = v_MCo_E - v_MBo_E = DtM(p_BoCo)
where DtM(p_BoCo) is the time-derivative in frame M of p_BoCo (position vector from Bo to Co), and this vector is expressed in frame E.
Note
The method CalcSpatialVelocity() is more efficient and coherent if any of
this
, other_frame, or measured_in_frame are the same. Also, the value of V_M_BoCo does not depend on the measured_in_frame if Bo and Co are coincident (i.e., p_BoCo = 0), in which case consider the more efficient method CalcRelativeSpatialVelocityInWorld(). Lastly, the calculation of elongation between Bo and Co can be done with relative translational velocity, but elongation does not depend on the measured-in-frame (hence consider CalcRelativeSpatialVelocityInWorld()).See also
CalcSpatialVelocityInWorld(), CalcSpatialVelocity(), and CalcRelativeSpatialVelocityInWorld().
- Parameter
- CalcRelativeSpatialVelocityInWorld(self: pydrake.multibody.tree.Frame_[AutoDiffXd], context: pydrake.systems.framework.Context_[AutoDiffXd], other_frame: pydrake.multibody.tree.Frame_[AutoDiffXd]) pydrake.multibody.math.SpatialVelocity_[AutoDiffXd]
Calculates
this
frame C’s spatial velocity relative to another frame B, measured and expressed in the world frame W.- Parameter
context
: contains the state of the multibody system.
- Parameter
other_frame
: which is frame B.
- Returns
V_W_BC_W = V_WC_W - V_WB_W, frame C’s spatial velocity relative to frame B, measured and expressed in the world frame W. The rotational part of the returned quantity is ω_BC_W (C’s angular velocity measured in B and expressed in W). The translational part is v_W_BoCo_W (Co’s translational velocity relative to Bo, measured and expressed in world frame W).
Click to expand C++ code...
ω_BC_W = ω_WC_W - ω_WB_W v_W_BoCo_W = v_WCo_W - v_WBo_W = DtW(p_BoCo)
where DtW(p_BoCo) is the time-derivative in frame W of p_BoCo (position vector from Bo to Co), and this vector is expressed in frame W.
Note
The method CalcSpatialVelocityInWorld() is more efficient and coherent if any of
this
, other_frame, or the world frame W are the same.See also
CalcSpatialVelocityInWorld() and CalcRelativeSpatialVelocity().
- Parameter
- CalcRotationMatrix(self: pydrake.multibody.tree.Frame_[AutoDiffXd], context: pydrake.systems.framework.Context_[AutoDiffXd], frame_M: pydrake.multibody.tree.Frame_[AutoDiffXd]) pydrake.math.RotationMatrix_[AutoDiffXd]
Calculates and returns the rotation matrix
R_MF
that relatesframe_M
andthis
frame F as a function of the state stored incontext
.
- CalcRotationMatrixInBodyFrame(self: pydrake.multibody.tree.Frame_[AutoDiffXd], context: pydrake.systems.framework.Context_[AutoDiffXd]) pydrake.math.RotationMatrix_[AutoDiffXd]
Returns the rotation matrix
R_BF
that relates body frame B tothis
frame F (B is the body frame to whichthis
frame F is attached).Note
If
this
is B, this method returns the identity RotationMatrix. Note that this ONLY depends on the Parameters in the context; it does not depend on time, input, state, etc.
- CalcRotationMatrixInWorld(self: pydrake.multibody.tree.Frame_[AutoDiffXd], context: pydrake.systems.framework.Context_[AutoDiffXd]) pydrake.math.RotationMatrix_[AutoDiffXd]
Calculates and returns the rotation matrix
R_WF
that relates the world frame W andthis
frame F as a function of the state stored incontext
.
- CalcSpatialAcceleration(self: pydrake.multibody.tree.Frame_[AutoDiffXd], context: pydrake.systems.framework.Context_[AutoDiffXd], measured_in_frame: pydrake.multibody.tree.Frame_[AutoDiffXd], expressed_in_frame: pydrake.multibody.tree.Frame_[AutoDiffXd]) pydrake.multibody.math.SpatialAcceleration_[AutoDiffXd]
Calculates
this
frame F’s spatial acceleration measured in a frame M, expressed in a frame E.- Parameter
context
: contains the state of the multibody system.
- Parameter
measured_in_frame
: which is frame M.
- Parameter
expressed_in_frame
: which is frame E.
- Returns
A_MF_E,
this
frame F’s spatial acceleration measured in frame M, expressed in frame E. The rotational part of the returned quantity is α_MF_E (frame F’s angular acceleration α measured in frame M, expressed in frame E). The translational part is a_MFo_E (translational acceleration of frame F’s origin point Fo, measured in frame M, expressed in frame E). Although α_MF is defined below in terms of DtM(ω_MF), the time-derivative in frame M of ω_MF, the actual calculation of α_MF avoids differentiation. Similarly for the definition vs. calculation for a_MFo.
Click to expand C++ code...
α_MF = DtM(ω_MF) ω_MF is frame F's angular velocity in frame M. a_MFo = DtM(v_MFo) v_MF is Fo's translational acceleration in frame M.
See also
CalcSpatialAccelerationInWorld() and CalcSpatialVelocity().
- Parameter
- CalcSpatialAccelerationInWorld(self: pydrake.multibody.tree.Frame_[AutoDiffXd], context: pydrake.systems.framework.Context_[AutoDiffXd]) pydrake.multibody.math.SpatialAcceleration_[AutoDiffXd]
Calculates
this
frame F’s spatial acceleration measured and expressed in the world frame W.- Parameter
context
: contains the state of the multibody system.
- Returns
A_WF_W,
this
frame F’s spatial acceleration measured and expressed in the world frame W. The rotational part of the returned quantity is α_WF_E (frame F’s angular acceleration α measured and expressed in the world frame W). The translational part is a_WFo_W (translational acceleration of frame F’s origin point Fo, measured and expressed in the world frame W).
Note
RigidBody::EvalSpatialAccelerationInWorld() provides a more efficient way to obtain a body frame’s spatial acceleration measured in the world frame.
Note
When cached values are out of sync with the state stored in context, this method performs an expensive forward dynamics computation, whereas once evaluated, successive calls to this method are inexpensive.
See also
CalcSpatialAcceleration() and CalcSpatialVelocityInWorld().
- Parameter
- CalcSpatialVelocity(self: pydrake.multibody.tree.Frame_[AutoDiffXd], context: pydrake.systems.framework.Context_[AutoDiffXd], frame_M: pydrake.multibody.tree.Frame_[AutoDiffXd], frame_E: pydrake.multibody.tree.Frame_[AutoDiffXd]) pydrake.multibody.math.SpatialVelocity_[AutoDiffXd]
Calculates
this
frame F’s spatial velocity measured in a frame M, expressed in a frame E.- Parameter
context
: contains the state of the multibody system.
- Parameter
frame_M
: which is the measured_in_frame.
- Parameter
frame_E
: which is the expressed_in_frame.
- Returns
V_MF_E,
this
frame F’s spatial velocity measured in frame M, expressed in frame E. The rotational part of the returned quantity is ω_MF_E (frame F’s angular velocity ω measured in frame M, expressed in frame E). The translational part is v_MFo_E (translational velocity v of frame F’s origin point Fo, measured in frame M, expressed in frame E).
See also
CalcSpatialVelocityInWorld(), CalcRelativeSpatialVelocity(), and CalcSpatialAcceleration().
- Parameter
- CalcSpatialVelocityInWorld(self: pydrake.multibody.tree.Frame_[AutoDiffXd], context: pydrake.systems.framework.Context_[AutoDiffXd]) pydrake.multibody.math.SpatialVelocity_[AutoDiffXd]
Calculates
this
frame F’s spatial velocity measured and expressed in the world frame W.- Parameter
context
: contains the state of the multibody system.
- Returns
V_WF_W,
this
frame F’s spatial velocity measured and expressed in the world frame W. The rotational part of the returned quantity is ω_WF_W (frame F’s angular velocity ω measured and expressed in the world frame W). The translational part is v_WFo_W (translational velocity v of frame F’s origin point Fo, measured and expressed in the world frame W).
Note
RigidBody::EvalSpatialVelocityInWorld() provides a more efficient way to obtain a body frame’s spatial velocity measured in the world frame.
See also
CalcSpatialVelocity(), CalcRelativeSpatialVelocityInWorld(), and CalcSpatialAccelerationInWorld().
- Parameter
- EvalAngularVelocityInWorld(self: pydrake.multibody.tree.Frame_[AutoDiffXd], context: pydrake.systems.framework.Context_[AutoDiffXd]) numpy.ndarray[object[3, 1]]
Evaluates
this
frame F’s angular velocity measured and expressed in the world frame W.- Parameter
context
: contains the state of the multibody system.
- Returns
ω_WF_W (frame F’s angular velocity ω measured and expressed in the world frame W).
See also
CalcAngularVelocity() to calculate ω_MF_E (
this
frame F’s angular velocity ω measured in a frame M and expressed in a frame E).- Parameter
- GetFixedOffsetPoseInBody(self: pydrake.multibody.tree.Frame_[AutoDiffXd], X_FQ: pydrake.math.RigidTransform_[AutoDiffXd]) pydrake.math.RigidTransform_[AutoDiffXd]
Variant of CalcOffsetPoseInBody() that given the offset pose
X_FQ
of a frame Q inthis
frame F, returns the poseX_BQ
of frame Q in the body frame B to which this frame is attached.- Raises
RuntimeError if called on a Frame that does not have a fixed –
offset in the body frame. –
- GetFixedPoseInBodyFrame(*args, **kwargs)
Overloaded function.
GetFixedPoseInBodyFrame(self: pydrake.multibody.tree.Frame_[AutoDiffXd]) -> pydrake.math.RigidTransform_[AutoDiffXd]
Variant of CalcPoseInBodyFrame() that returns the fixed pose
X_BF
ofthis
frame F in the body frame B associated with this frame.- Raises
RuntimeError if called on a Frame that does not have a fixed –
offset in the body frame. –
GetFixedPoseInBodyFrame(self: pydrake.multibody.tree.Frame_[AutoDiffXd]) -> pydrake.math.RigidTransform_[AutoDiffXd]
Variant of CalcPoseInBodyFrame() that returns the fixed pose
X_BF
ofthis
frame F in the body frame B associated with this frame.- Raises
RuntimeError if called on a Frame that does not have a fixed –
offset in the body frame. –
- GetFixedRotationMatrixInBody(self: pydrake.multibody.tree.Frame_[AutoDiffXd], R_FQ: pydrake.math.RotationMatrix_[AutoDiffXd]) pydrake.math.RotationMatrix_[AutoDiffXd]
Calculates and returns the rotation matrix
R_BQ
that relates body frame B to frame Q viathis
intermediate frame F, i.e.,R_BQ = R_BF * R_FQ
(B is the body frame to whichthis
frame F is attached).- Parameter
R_FQ
: rotation matrix that relates frame F to frame Q.
- Raises
RuntimeError if this frame F is a Frame that does not have a –
fixed offset in the body frame B (i.e., R_BF is not constant) –
- Parameter
- GetFixedRotationMatrixInBodyFrame(self: pydrake.multibody.tree.Frame_[AutoDiffXd]) pydrake.math.RotationMatrix_[AutoDiffXd]
Returns the rotation matrix
R_BF
that relates body frame B tothis
frame F (B is the body frame to whichthis
frame F is attached).- Raises
RuntimeError if this frame F is a Frame that does not have a –
fixed offset in the body frame B (i.e., R_BF is not constant) –
Frame sub-classes that have a constant R_BF must override this –
method. An example of a frame sub-class not implementing this –
method would be that of a frame on a soft body, for which its pose –
in the body frame depends on the state of deformation of the body. –
- GetParentPlant(self: pydrake.multibody.tree.Frame_[AutoDiffXd]) drake::multibody::MultibodyPlant<Eigen::AutoDiffScalar<Eigen::Matrix<double, -1, 1, 0, -1, 1> > >
- index(self: pydrake.multibody.tree.Frame_[AutoDiffXd]) pydrake.multibody.tree.FrameIndex
- is_body_frame(self: pydrake.multibody.tree.Frame_[AutoDiffXd]) bool
Returns true if
this
is the body frame.
- is_world_frame(self: pydrake.multibody.tree.Frame_[AutoDiffXd]) bool
Returns true if
this
is the world frame.
- model_instance(self: pydrake.multibody.tree.Frame_[AutoDiffXd]) pydrake.multibody.tree.ModelInstanceIndex
- name(self: pydrake.multibody.tree.Frame_[AutoDiffXd]) str
Returns the name of this frame. The name will never be empty.
- scoped_name(self: pydrake.multibody.tree.Frame_[AutoDiffXd]) pydrake.multibody.tree.ScopedName
Returns scoped name of this frame. Neither of the two pieces of the name will be empty (the scope name and the element name).
- class pydrake.multibody.tree.Frame_[Expression]
%Frame is an abstract class representing a material frame (also called a physical frame) of its underlying RigidBody. The Frame’s origin is a material point of its RigidBody, and its axes have fixed directions in that body. A Frame’s pose (position and orientation) with respect to its RigidBodyFrame may be parameterized, but is fixed (not time or state dependent) once parameters have been set.
An important characteristic of a Frame is that forces or torques applied to a Frame are applied to the Frame’s underlying RigidBody. Force-producing elements like joints, actuators, and constraints usually employ two Frames, with one Frame connected to one body and the other connected to a different body. Every Frame F can report the RigidBody B to which it is attached and its pose X_BF with respect to B’s RigidBodyFrame.
A Frame’s pose in World (or relative to other frames) is always calculated starting with its pose relative to its underlying RigidBodyFrame. Subclasses derived from Frame differ in how kinematic calculations are performed. For example, the angular velocity of a FixedOffsetFrame or RigidBodyFrame is identical to the angular velocity of its underlying body, whereas the translational velocity of a FixedOffsetFrame differs from that of a RigidBodyFrame.
Frame provides methods for obtaining its current orientation, position, motion, etc. from a Context passed to those methods.
- __init__(*args, **kwargs)
- body(self: pydrake.multibody.tree.Frame_[Expression]) drake::multibody::RigidBody<drake::symbolic::Expression>
Returns a const reference to the body associated to this Frame.
- CalcAngularVelocity(self: pydrake.multibody.tree.Frame_[Expression], context: pydrake.systems.framework.Context_[Expression], measured_in_frame: pydrake.multibody.tree.Frame_[Expression], expressed_in_frame: pydrake.multibody.tree.Frame_[Expression]) numpy.ndarray[object[3, 1]]
Calculates
this
frame F’s angular velocity measured in a frame M, expressed in a frame E.- Parameter
context
: contains the state of the multibody system.
- Parameter
measured_in_frame
: which is frame M (the frame in which
this
angular velocity is to be measured).- Parameter
expressed_in_frame
: which is frame E (the frame in which the returned angular velocity is to be expressed).
- Returns
ω_MF_E,
this
frame F’s angular velocity ω measured in frame M, expressed in frame E.
See also
EvalAngularVelocityInWorld() to evaluate ω_WF_W (
this
frame F’s angular velocity ω measured and expressed in the world frame W).- Parameter
- CalcOffsetPoseInBody(self: pydrake.multibody.tree.Frame_[Expression], context: pydrake.systems.framework.Context_[Expression], X_FQ: pydrake.math.RigidTransform_[Expression]) pydrake.math.RigidTransform_[Expression]
Given the offset pose
X_FQ
of a frame Q inthis
frame F, this method computes the poseX_BQ
of frame Q in the body frame B to which this frame is attached. In other words, if the pose ofthis
frame F in the body frame B isX_BF
, this method computes the poseX_BQ
of frame Q in the body frame B asX_BQ = X_BF * X_FQ
. In particular, ifthis
**is**` the body frame B, i.e.X_BF
is the identity transformation, this method directly returnsX_FQ
. Specific frame subclasses can override this method to provide faster implementations if needed.
- CalcOffsetRotationMatrixInBody(self: pydrake.multibody.tree.Frame_[Expression], context: pydrake.systems.framework.Context_[Expression], R_FQ: pydrake.math.RotationMatrix_[Expression]) pydrake.math.RotationMatrix_[Expression]
Calculates and returns the rotation matrix
R_BQ
that relates body frame B to frame Q viathis
intermediate frame F, i.e.,R_BQ = R_BF * R_FQ
(B is the body frame to whichthis
frame F is attached).- Parameter
R_FQ
: rotation matrix that relates frame F to frame Q.
- Parameter
- CalcPose(self: pydrake.multibody.tree.Frame_[Expression], context: pydrake.systems.framework.Context_[Expression], frame_M: pydrake.multibody.tree.Frame_[Expression]) pydrake.math.RigidTransform_[Expression]
Computes and returns the pose
X_MF
ofthis
frame F in measured inframe_M
as a function of the state of the model stored incontext
.See also
CalcPoseInWorld().
- CalcPoseInBodyFrame(self: pydrake.multibody.tree.Frame_[Expression], context: pydrake.systems.framework.Context_[Expression]) pydrake.math.RigidTransform_[Expression]
Returns the pose
X_BF
ofthis
frame F in the body frame B associated with this frame. In particular, ifthis
is the body frame B, this method directly returns the identity transformation. Note that this ONLY depends on the Parameters in the context; it does not depend on time, input, state, etc.
- CalcPoseInWorld(self: pydrake.multibody.tree.Frame_[Expression], context: pydrake.systems.framework.Context_[Expression]) pydrake.math.RigidTransform_[Expression]
Computes and returns the pose
X_WF
ofthis
frame F in the world frame W as a function of the state of the model stored incontext
.Note
RigidBody::EvalPoseInWorld() provides a more efficient way to obtain the pose for a body frame.
- CalcRelativeSpatialAcceleration(self: pydrake.multibody.tree.Frame_[Expression], context: pydrake.systems.framework.Context_[Expression], other_frame: pydrake.multibody.tree.Frame_[Expression], measured_in_frame: pydrake.multibody.tree.Frame_[Expression], expressed_in_frame: pydrake.multibody.tree.Frame_[Expression]) pydrake.multibody.math.SpatialAcceleration_[Expression]
Calculates
this
frame C’s spatial acceleration relative to another frame B, measured in a frame M, expressed in a frame E.- Parameter
context
: contains the state of the multibody system.
- Parameter
other_frame
: which is frame B.
- Parameter
measured_in_frame
: which is frame M.
- Parameter
expressed_in_frame
: which is frame E.
- Returns
A_M_BC_E = A_MC_E - A_MB_E, frame C’s spatial acceleration relative to frame B, measured in frame M, expressed in frame E.
In general, A_M_BC = DtW(V_M_BC), the time-derivative in frame M of frame C’s spatial velocity relative to frame B. The rotational part of the returned quantity is α_MC_E - α_MB_E = DtM(ω_BC)_E. Note: For 3D analysis, DtM(ω_BC) ≠ α_BC. The translational part of the returned quantity is a_M_BoCo_E (Co’s translational acceleration relative to Bo, measured in frame M, expressed in frame E).
Click to expand C++ code...
α_MC_E - α_MB_E = DtM(ω_MC)_E - DtM(ω_MB)_E = DtM(ω_BC)_E a_M_BoCo_E = a_MCo_E - a_MBo_E = DtM(v_MCo) - DtM(v_MBo) = Dt²M(p_BoCo)_E
where Dt²M(p_BoCo)_E is the 2ⁿᵈ time-derivative in frame M of p_BoCo (the position vector from Bo to Co), and this result is expressed in frame E.
Note
The calculation of the 2ⁿᵈ time-derivative of the distance between Bo and Co can be done with relative translational acceleration, but this calculation does not depend on the measured-in-frame, hence in this case, consider CalcRelativeSpatialAccelerationInWorld() since it is faster.
See also
CalcSpatialAccelerationInWorld(), CalcSpatialAcceleration(), and CalcRelativeSpatialAccelerationInWorld().
- Parameter
- CalcRelativeSpatialAccelerationInWorld(self: pydrake.multibody.tree.Frame_[Expression], context: pydrake.systems.framework.Context_[Expression], other_frame: pydrake.multibody.tree.Frame_[Expression]) pydrake.multibody.math.SpatialAcceleration_[Expression]
Calculates
this
frame C’s spatial acceleration relative to another frame B, measured and expressed in the world frame W.- Parameter
context
: contains the state of the multibody system.
- Parameter
other_frame
: which is frame B.
- Returns
A_W_BC_W = A_WC_W - A_WB_W, frame C’s spatial acceleration relative to frame B, measured and expressed in the world frame W.
In general, A_W_BC = DtW(V_W_BC), the time-derivative in the world frame W of frame C’s spatial velocity relative to frame B. The rotational part of the returned quantity is α_WC_W - α_WB_W = DtW(ω_BC)_W. For 3D analysis, DtW(ω_BC) ≠ α_BC. The translational part of the returned quantity is a_W_BoCo_W (Co’s translational acceleration relative to Bo, measured and expressed in world frame W).
Click to expand C++ code...
α_WC_W - α_WB_W = DtW(ω_WC)_W - DtW(ω_WB)_W = DtW(ω_BC)_W a_W_BoCo_W = a_WCo_W - a_WBo_W = DtW(v_WCo) - DtW(v_WBo) = Dt²W(p_BoCo)_W
where Dt²W(p_BoCo)_W is the 2ⁿᵈ time-derivative in frame W of p_BoCo (the position vector from Bo to Co), and this result is expressed in frame W.
Note
The method CalcSpatialAccelerationInWorld() is more efficient and coherent if any of
this
, other_frame, or the world frame W are the same.See also
CalcSpatialAccelerationInWorld(), CalcRelativeSpatialAcceleration().
- Parameter
- CalcRelativeSpatialVelocity(self: pydrake.multibody.tree.Frame_[Expression], context: pydrake.systems.framework.Context_[Expression], other_frame: pydrake.multibody.tree.Frame_[Expression], measured_in_frame: pydrake.multibody.tree.Frame_[Expression], expressed_in_frame: pydrake.multibody.tree.Frame_[Expression]) pydrake.multibody.math.SpatialVelocity_[Expression]
Calculates
this
frame C’s spatial velocity relative to another frame B, measured in a frame M, expressed in a frame E.- Parameter
context
: contains the state of the multibody system.
- Parameter
other_frame
: which is frame B.
- Parameter
measured_in_frame
: which is frame M.
- Parameter
expressed_in_frame
: which is frame E.
- Returns
V_M_BC_E = V_MC_E - V_MB_E, frame C’s spatial velocity relative to frame B, measured in frame M, expressed in frame E. The rotational part of the returned quantity is ω_BC_E (C’s angular velocity measured in B and expressed in E). The translational part is v_M_BoCo_E (Co’s translational velocity relative to Bo, measured in M, and expressed in E).
Click to expand C++ code...
ω_BC_E = ω_MC_E - ω_MB_E v_M_BoCo_E = v_MCo_E - v_MBo_E = DtM(p_BoCo)
where DtM(p_BoCo) is the time-derivative in frame M of p_BoCo (position vector from Bo to Co), and this vector is expressed in frame E.
Note
The method CalcSpatialVelocity() is more efficient and coherent if any of
this
, other_frame, or measured_in_frame are the same. Also, the value of V_M_BoCo does not depend on the measured_in_frame if Bo and Co are coincident (i.e., p_BoCo = 0), in which case consider the more efficient method CalcRelativeSpatialVelocityInWorld(). Lastly, the calculation of elongation between Bo and Co can be done with relative translational velocity, but elongation does not depend on the measured-in-frame (hence consider CalcRelativeSpatialVelocityInWorld()).See also
CalcSpatialVelocityInWorld(), CalcSpatialVelocity(), and CalcRelativeSpatialVelocityInWorld().
- Parameter
- CalcRelativeSpatialVelocityInWorld(self: pydrake.multibody.tree.Frame_[Expression], context: pydrake.systems.framework.Context_[Expression], other_frame: pydrake.multibody.tree.Frame_[Expression]) pydrake.multibody.math.SpatialVelocity_[Expression]
Calculates
this
frame C’s spatial velocity relative to another frame B, measured and expressed in the world frame W.- Parameter
context
: contains the state of the multibody system.
- Parameter
other_frame
: which is frame B.
- Returns
V_W_BC_W = V_WC_W - V_WB_W, frame C’s spatial velocity relative to frame B, measured and expressed in the world frame W. The rotational part of the returned quantity is ω_BC_W (C’s angular velocity measured in B and expressed in W). The translational part is v_W_BoCo_W (Co’s translational velocity relative to Bo, measured and expressed in world frame W).
Click to expand C++ code...
ω_BC_W = ω_WC_W - ω_WB_W v_W_BoCo_W = v_WCo_W - v_WBo_W = DtW(p_BoCo)
where DtW(p_BoCo) is the time-derivative in frame W of p_BoCo (position vector from Bo to Co), and this vector is expressed in frame W.
Note
The method CalcSpatialVelocityInWorld() is more efficient and coherent if any of
this
, other_frame, or the world frame W are the same.See also
CalcSpatialVelocityInWorld() and CalcRelativeSpatialVelocity().
- Parameter
- CalcRotationMatrix(self: pydrake.multibody.tree.Frame_[Expression], context: pydrake.systems.framework.Context_[Expression], frame_M: pydrake.multibody.tree.Frame_[Expression]) pydrake.math.RotationMatrix_[Expression]
Calculates and returns the rotation matrix
R_MF
that relatesframe_M
andthis
frame F as a function of the state stored incontext
.
- CalcRotationMatrixInBodyFrame(self: pydrake.multibody.tree.Frame_[Expression], context: pydrake.systems.framework.Context_[Expression]) pydrake.math.RotationMatrix_[Expression]
Returns the rotation matrix
R_BF
that relates body frame B tothis
frame F (B is the body frame to whichthis
frame F is attached).Note
If
this
is B, this method returns the identity RotationMatrix. Note that this ONLY depends on the Parameters in the context; it does not depend on time, input, state, etc.
- CalcRotationMatrixInWorld(self: pydrake.multibody.tree.Frame_[Expression], context: pydrake.systems.framework.Context_[Expression]) pydrake.math.RotationMatrix_[Expression]
Calculates and returns the rotation matrix
R_WF
that relates the world frame W andthis
frame F as a function of the state stored incontext
.
- CalcSpatialAcceleration(self: pydrake.multibody.tree.Frame_[Expression], context: pydrake.systems.framework.Context_[Expression], measured_in_frame: pydrake.multibody.tree.Frame_[Expression], expressed_in_frame: pydrake.multibody.tree.Frame_[Expression]) pydrake.multibody.math.SpatialAcceleration_[Expression]
Calculates
this
frame F’s spatial acceleration measured in a frame M, expressed in a frame E.- Parameter
context
: contains the state of the multibody system.
- Parameter
measured_in_frame
: which is frame M.
- Parameter
expressed_in_frame
: which is frame E.
- Returns
A_MF_E,
this
frame F’s spatial acceleration measured in frame M, expressed in frame E. The rotational part of the returned quantity is α_MF_E (frame F’s angular acceleration α measured in frame M, expressed in frame E). The translational part is a_MFo_E (translational acceleration of frame F’s origin point Fo, measured in frame M, expressed in frame E). Although α_MF is defined below in terms of DtM(ω_MF), the time-derivative in frame M of ω_MF, the actual calculation of α_MF avoids differentiation. Similarly for the definition vs. calculation for a_MFo.
Click to expand C++ code...
α_MF = DtM(ω_MF) ω_MF is frame F's angular velocity in frame M. a_MFo = DtM(v_MFo) v_MF is Fo's translational acceleration in frame M.
See also
CalcSpatialAccelerationInWorld() and CalcSpatialVelocity().
- Parameter
- CalcSpatialAccelerationInWorld(self: pydrake.multibody.tree.Frame_[Expression], context: pydrake.systems.framework.Context_[Expression]) pydrake.multibody.math.SpatialAcceleration_[Expression]
Calculates
this
frame F’s spatial acceleration measured and expressed in the world frame W.- Parameter
context
: contains the state of the multibody system.
- Returns
A_WF_W,
this
frame F’s spatial acceleration measured and expressed in the world frame W. The rotational part of the returned quantity is α_WF_E (frame F’s angular acceleration α measured and expressed in the world frame W). The translational part is a_WFo_W (translational acceleration of frame F’s origin point Fo, measured and expressed in the world frame W).
Note
RigidBody::EvalSpatialAccelerationInWorld() provides a more efficient way to obtain a body frame’s spatial acceleration measured in the world frame.
Note
When cached values are out of sync with the state stored in context, this method performs an expensive forward dynamics computation, whereas once evaluated, successive calls to this method are inexpensive.
See also
CalcSpatialAcceleration() and CalcSpatialVelocityInWorld().
- Parameter
- CalcSpatialVelocity(self: pydrake.multibody.tree.Frame_[Expression], context: pydrake.systems.framework.Context_[Expression], frame_M: pydrake.multibody.tree.Frame_[Expression], frame_E: pydrake.multibody.tree.Frame_[Expression]) pydrake.multibody.math.SpatialVelocity_[Expression]
Calculates
this
frame F’s spatial velocity measured in a frame M, expressed in a frame E.- Parameter
context
: contains the state of the multibody system.
- Parameter
frame_M
: which is the measured_in_frame.
- Parameter
frame_E
: which is the expressed_in_frame.
- Returns
V_MF_E,
this
frame F’s spatial velocity measured in frame M, expressed in frame E. The rotational part of the returned quantity is ω_MF_E (frame F’s angular velocity ω measured in frame M, expressed in frame E). The translational part is v_MFo_E (translational velocity v of frame F’s origin point Fo, measured in frame M, expressed in frame E).
See also
CalcSpatialVelocityInWorld(), CalcRelativeSpatialVelocity(), and CalcSpatialAcceleration().
- Parameter
- CalcSpatialVelocityInWorld(self: pydrake.multibody.tree.Frame_[Expression], context: pydrake.systems.framework.Context_[Expression]) pydrake.multibody.math.SpatialVelocity_[Expression]
Calculates
this
frame F’s spatial velocity measured and expressed in the world frame W.- Parameter
context
: contains the state of the multibody system.
- Returns
V_WF_W,
this
frame F’s spatial velocity measured and expressed in the world frame W. The rotational part of the returned quantity is ω_WF_W (frame F’s angular velocity ω measured and expressed in the world frame W). The translational part is v_WFo_W (translational velocity v of frame F’s origin point Fo, measured and expressed in the world frame W).
Note
RigidBody::EvalSpatialVelocityInWorld() provides a more efficient way to obtain a body frame’s spatial velocity measured in the world frame.
See also
CalcSpatialVelocity(), CalcRelativeSpatialVelocityInWorld(), and CalcSpatialAccelerationInWorld().
- Parameter
- EvalAngularVelocityInWorld(self: pydrake.multibody.tree.Frame_[Expression], context: pydrake.systems.framework.Context_[Expression]) numpy.ndarray[object[3, 1]]
Evaluates
this
frame F’s angular velocity measured and expressed in the world frame W.- Parameter
context
: contains the state of the multibody system.
- Returns
ω_WF_W (frame F’s angular velocity ω measured and expressed in the world frame W).
See also
CalcAngularVelocity() to calculate ω_MF_E (
this
frame F’s angular velocity ω measured in a frame M and expressed in a frame E).- Parameter
- GetFixedOffsetPoseInBody(self: pydrake.multibody.tree.Frame_[Expression], X_FQ: pydrake.math.RigidTransform_[Expression]) pydrake.math.RigidTransform_[Expression]
Variant of CalcOffsetPoseInBody() that given the offset pose
X_FQ
of a frame Q inthis
frame F, returns the poseX_BQ
of frame Q in the body frame B to which this frame is attached.- Raises
RuntimeError if called on a Frame that does not have a fixed –
offset in the body frame. –
- GetFixedPoseInBodyFrame(*args, **kwargs)
Overloaded function.
GetFixedPoseInBodyFrame(self: pydrake.multibody.tree.Frame_[Expression]) -> pydrake.math.RigidTransform_[Expression]
Variant of CalcPoseInBodyFrame() that returns the fixed pose
X_BF
ofthis
frame F in the body frame B associated with this frame.- Raises
RuntimeError if called on a Frame that does not have a fixed –
offset in the body frame. –
GetFixedPoseInBodyFrame(self: pydrake.multibody.tree.Frame_[Expression]) -> pydrake.math.RigidTransform_[Expression]
Variant of CalcPoseInBodyFrame() that returns the fixed pose
X_BF
ofthis
frame F in the body frame B associated with this frame.- Raises
RuntimeError if called on a Frame that does not have a fixed –
offset in the body frame. –
- GetFixedRotationMatrixInBody(self: pydrake.multibody.tree.Frame_[Expression], R_FQ: pydrake.math.RotationMatrix_[Expression]) pydrake.math.RotationMatrix_[Expression]
Calculates and returns the rotation matrix
R_BQ
that relates body frame B to frame Q viathis
intermediate frame F, i.e.,R_BQ = R_BF * R_FQ
(B is the body frame to whichthis
frame F is attached).- Parameter
R_FQ
: rotation matrix that relates frame F to frame Q.
- Raises
RuntimeError if this frame F is a Frame that does not have a –
fixed offset in the body frame B (i.e., R_BF is not constant) –
- Parameter
- GetFixedRotationMatrixInBodyFrame(self: pydrake.multibody.tree.Frame_[Expression]) pydrake.math.RotationMatrix_[Expression]
Returns the rotation matrix
R_BF
that relates body frame B tothis
frame F (B is the body frame to whichthis
frame F is attached).- Raises
RuntimeError if this frame F is a Frame that does not have a –
fixed offset in the body frame B (i.e., R_BF is not constant) –
Frame sub-classes that have a constant R_BF must override this –
method. An example of a frame sub-class not implementing this –
method would be that of a frame on a soft body, for which its pose –
in the body frame depends on the state of deformation of the body. –
- GetParentPlant(self: pydrake.multibody.tree.Frame_[Expression]) drake::multibody::MultibodyPlant<drake::symbolic::Expression>
- index(self: pydrake.multibody.tree.Frame_[Expression]) pydrake.multibody.tree.FrameIndex
- is_body_frame(self: pydrake.multibody.tree.Frame_[Expression]) bool
Returns true if
this
is the body frame.
- is_world_frame(self: pydrake.multibody.tree.Frame_[Expression]) bool
Returns true if
this
is the world frame.
- model_instance(self: pydrake.multibody.tree.Frame_[Expression]) pydrake.multibody.tree.ModelInstanceIndex
- name(self: pydrake.multibody.tree.Frame_[Expression]) str
Returns the name of this frame. The name will never be empty.
- scoped_name(self: pydrake.multibody.tree.Frame_[Expression]) pydrake.multibody.tree.ScopedName
Returns scoped name of this frame. Neither of the two pieces of the name will be empty (the scope name and the element name).
- class pydrake.multibody.tree.FrameIndex
Type used to identify frames by index in a multibody plant.
- __init__(*args, **kwargs)
Overloaded function.
__init__(self: pydrake.multibody.tree.FrameIndex) -> None
Default constructor; the result is an invalid index. This only exists to serve applications which require a default constructor.
__init__(self: pydrake.multibody.tree.FrameIndex, arg0: int) -> None
Construction from a non-negative
int
value. The value must lie in the range of [0, 2³¹). Constructor only promises to test validity in Debug build.
- is_valid(self: pydrake.multibody.tree.FrameIndex) bool
Reports if the index is valid–the only operation on an invalid index that doesn’t throw an exception in Debug builds.
- class pydrake.multibody.tree.JacobianWrtVariable
Enumeration that indicates whether the Jacobian is partial differentiation with respect to q̇ (time-derivatives of generalized positions) or with respect to v (generalized velocities).
Members:
kQDot : J = ∂V/∂q̇
kV : J = ∂V/∂v
- __init__(self: pydrake.multibody.tree.JacobianWrtVariable, value: int) None
- kQDot = <JacobianWrtVariable.kQDot: 0>
- kV = <JacobianWrtVariable.kV: 1>
- property name
- property value
- class pydrake.multibody.tree.Joint
A Joint models the kinematical relationship which characterizes the possible relative motion between two bodies. The two bodies connected by this Joint object are referred to as parent and child bodies. The parent/child ordering defines the sign conventions for the generalized coordinates and the coordinate ordering for multi-DOF joints. A Joint is a model of a physical kinematic constraint between two bodies, a constraint that in the real physical system does not specify a tree ordering. @image html drake/multibody/plant/images/BodyParentChildJoint.png width=50%
In Drake we define a frame F rigidly attached to the parent body P with pose
X_PF
and a frame M rigidly attached to the child body B with poseX_BM
. A Joint object specifies a kinematic relation between frames F and M, which in turn imposes a kinematic relation between bodies P and B.Typical joints include the ball joint, to allow unrestricted rotations about a given point, the revolute joint, that constraints two bodies to rotate about a given common axis, etc.
Consider the following example to build a simple pendulum system:
Click to expand C++ code...
MultibodyPlant<double> plant(0.0); // ... Code here to setup quantities below as mass, com, etc. ... const RigidBody<double>& pendulum = plant.AddRigidBody(SpatialInertia<double>(mass, com, unit_inertia)); // We will connect the pendulum body to the world using a RevoluteJoint. // In this simple case the parent body P is the model's world body and frame // F IS the world frame. // Additionally, we need to specify the pose of frame M on the pendulum's // body frame B. // Say we declared and initialized X_BM... const RevoluteJoint<double>& elbow = plant.AddJoint<RevoluteJoint>( "Elbow", /* joint name plant.world_body(), /* parent body {}, /* frame F IS the world frame W pendulum, /* child body, the pendulum X_BM, /* pose of frame M in the body frame B Vector3d::UnitZ()); /* revolute axis in this case
Warning
Do not ever attempt to instantiate and manipulate Joint objects on the stack; it will fail. Add joints to your plant using the provided API MultibodyPlant::AddJoint() as in the example above.
Note
This class is templated; see
Joint_
for the list of instantiations.- __init__(*args, **kwargs)
- acceleration_lower_limits(self: pydrake.multibody.tree.Joint) numpy.ndarray[numpy.float64[m, 1]]
Returns the acceleration lower limits.
- acceleration_upper_limits(self: pydrake.multibody.tree.Joint) numpy.ndarray[numpy.float64[m, 1]]
Returns the acceleration upper limits.
- AddInDamping(self: pydrake.multibody.tree.Joint, context: pydrake.systems.framework.Context, forces: pydrake.multibody.tree.MultibodyForces) None
Adds into
forces
the force due to damping withinthis
joint.- Parameter
context
: The context storing the state and parameters for the model to which
this
joint belongs.- Parameter
forces
: On return, this method will add the force due to damping within
this
joint. This method aborts ifforces
isnullptr
or ifforces
does not have the right sizes to accommodate a set of forces for the model to which this joint belongs.
- Parameter
- AddInOneForce(self: pydrake.multibody.tree.Joint, context: pydrake.systems.framework.Context, joint_dof: int, joint_tau: float, forces: pydrake.multibody.tree.MultibodyForces) None
Adds into
forces
a force along the one of the joint’s degrees of freedom indicated by indexjoint_dof
. The meaning for this degree of freedom and even its dimensional units depend on the specific joint sub-class. For a RevoluteJoint for instance,joint_dof
can only be 0 since revolute joints’s motion subspace only has one degree of freedom, while the units ofjoint_tau
are those of torque (N⋅m in the MKS system of units). For multi-dof joints please refer to the documentation provided by specific joint sub-classes regarding the meaning ofjoint_dof
.- Parameter
context
: The context storing the state and parameters for the model to which
this
joint belongs.- Parameter
joint_dof
: Index specifying one of the degrees of freedom for this joint. The index must be in the range
0 <= joint_dof < num_velocities()
or otherwise this method will abort.- Parameter
joint_tau
: Generalized force corresponding to the degree of freedom indicated by
joint_dof
to be added intoforces
.- Parameter
forces
: On return, this method will add force
joint_tau
for the degree of freedomjoint_dof
into the outputforces
. This method aborts ifforces
isnullptr
or ifforces
doest not have the right sizes to accommodate a set of forces for the model to which this joint belongs.
- Parameter
- can_rotate(self: pydrake.multibody.tree.Joint) bool
Returns true if this joint’s mobility allows relative rotation of the two frames associated with this joint.
- Precondition:
the MultibodyPlant must be finalized.
See also
can_translate()
- can_translate(self: pydrake.multibody.tree.Joint) bool
Returns true if this joint’s mobility allows relative translation of the two frames associated with this joint.
- Precondition:
the MultibodyPlant must be finalized.
See also
can_rotate()
- child_body(self: pydrake.multibody.tree.Joint) pydrake.multibody.tree.RigidBody
Returns a const reference to the child body B.
- default_damping_vector(self: pydrake.multibody.tree.Joint) numpy.ndarray[numpy.float64[m, 1]]
Returns all default damping coefficients for joints that model viscous damping, of size num_velocities(). Joints that do not model damping return a zero vector of size num_velocities(). If vj is the vector of generalized velocities for this joint, of size num_velocities(), viscous damping models a generalized force at the joint of the form tau = -diag(dj)⋅vj, with dj the vector returned by this function. The units of the coefficients will depend on the specific joint type. For instance, for a revolute joint where vj is an angular velocity with units of rad/s and tau having units of N⋅m, the coefficient of viscous damping has units of N⋅m⋅s. Refer to each joint’s documentation for further details.
- default_positions(self: pydrake.multibody.tree.Joint) numpy.ndarray[numpy.float64[m, 1]]
Returns the default generalized position coordinates q₀. These will be the values set with set_default_positions() if any; otherwise, they will be the “zero configuration” for this joint type (as defined by the particular joint type).
Note
The default generalized velocities v₀ are zero for every joint.
- frame_on_child(self: pydrake.multibody.tree.Joint) pydrake.multibody.tree.Frame
Returns a const reference to the frame M attached on the child body B.
- frame_on_parent(self: pydrake.multibody.tree.Joint) pydrake.multibody.tree.Frame
Returns a const reference to the frame F attached on the parent body P.
- GetDampingVector(self: pydrake.multibody.tree.Joint, context: pydrake.systems.framework.Context) numpy.ndarray[numpy.float64[m, 1]]
Returns the Context dependent damping coefficients stored as parameters in
context
. Refer to default_damping_vector() for details.- Parameter
context
: The context storing the state and parameters for the model to which
this
joint belongs.
- Parameter
- GetDefaultPose(self: pydrake.multibody.tree.Joint) pydrake.math.RigidTransform
Returns this joint’s default pose as a RigidTransform X_FM.
Note
Currently this is implemented only for floating (6 dof) joints which can represent any pose.
- Raises
RuntimeError if called for any joint type that does not implement –
this function. –
- Returns
X_FM
: The default pose as a rigid transform.
See also
default_positions() to see the generalized positions q₀ that this joint used to generate the returned transform.
See also
GetDefaultPosePair() for an alternative using a quaternion
- GetDefaultPosePair(self: pydrake.multibody.tree.Joint) tuple[pydrake.common.eigen_geometry.Quaternion, numpy.ndarray[numpy.float64[3, 1]]]
(Advanced) This is the same as GetDefaultPose() except it returns this joint’s default pose as a (quaternion, translation vector) pair.
Note
Currently this is implemented only for floating (6 dof) joints which can represent any pose.
Note
For a QuaternionFloatingJoint the return will be bit-identical to the pose provided to SetDefaultPosePair(). For any other floating (6 dof) joint the pose will be numerically equivalent (i.e. within roundoff) but not identical. For other joint types it will be some approximation.
- Returns
q_FM
: ,p_FM The default pose as a (quaternion, translation) pair.
- Raises
RuntimeError if called for any joint type that does not implement –
this function. –
See also
GetDefaultPose()
- Returns
- GetOnePosition(self: pydrake.multibody.tree.Joint, context: pydrake.systems.framework.Context) float
Returns the position coordinate for joints with a single degree of freedom.
- Raises
RuntimeError if the joint does not have a single degree of –
freedom. –
- GetOneVelocity(self: pydrake.multibody.tree.Joint, context: pydrake.systems.framework.Context) float
Returns the velocity coordinate for joints with a single degree of freedom.
- Raises
RuntimeError if the joint does not have a single degree of –
freedom. –
- GetParentPlant(self: pydrake.multibody.tree.Joint) drake::multibody::MultibodyPlant<double>
- index(*args, **kwargs)
Overloaded function.
index(self: pydrake.multibody.tree.Joint) -> pydrake.multibody.tree.JointIndex
index(self: pydrake.multibody.tree.Joint) -> pydrake.multibody.tree.JointIndex
Returns this element’s unique index.
- is_locked(self: pydrake.multibody.tree.Joint, context: pydrake.systems.framework.Context) bool
- Returns
true if the joint is locked, false otherwise.
- Lock(self: pydrake.multibody.tree.Joint, context: pydrake.systems.framework.Context) None
Lock the joint. Its generalized velocities will be 0 until it is unlocked.
- model_instance(self: pydrake.multibody.tree.Joint) pydrake.multibody.tree.ModelInstanceIndex
- name(self: pydrake.multibody.tree.Joint) str
Returns the name of this joint.
- num_positions(self: pydrake.multibody.tree.Joint) int
Returns the number of generalized positions describing this joint.
- num_velocities(self: pydrake.multibody.tree.Joint) int
Returns the number of generalized velocities describing this joint.
- parent_body(self: pydrake.multibody.tree.Joint) pydrake.multibody.tree.RigidBody
Returns a const reference to the parent body P.
- position_lower_limits(self: pydrake.multibody.tree.Joint) numpy.ndarray[numpy.float64[m, 1]]
Returns the position lower limits.
- position_start(self: pydrake.multibody.tree.Joint) int
Returns the index to the first generalized position for this joint within the vector q of generalized positions for the full multibody system.
- position_suffix(self: pydrake.multibody.tree.Joint, arg0: int) str
Returns a string suffix (e.g. to be appended to the name()) to identify the k`th position in this joint. ``position_index_in_joint` must be in [0, num_positions()).
- Precondition:
the MultibodyPlant must be finalized.
- position_upper_limits(self: pydrake.multibody.tree.Joint) numpy.ndarray[numpy.float64[m, 1]]
Returns the position upper limits.
- set_acceleration_limits(self: pydrake.multibody.tree.Joint, lower_limits: numpy.ndarray[numpy.float64[m, 1]], upper_limits: numpy.ndarray[numpy.float64[m, 1]]) None
Sets the acceleration limits to
lower_limits
andupper_limits
.- Raises
RuntimeError if the dimension of lower_limits or –
upper_limits` does not match num_velocities() –
RuntimeError if any of lower_limits is larger than the –
corresponding term in upper_limits. –
- set_default_damping_vector(self: pydrake.multibody.tree.Joint, damping: numpy.ndarray[numpy.float64[m, 1]]) None
Sets the default value of the viscous damping coefficients for this joint. Refer to default_damping_vector() for details.
- Raises
RuntimeError if damping.size() != num_velocities() –
RuntimeError if any of the damping coefficients is negative. –
- Precondition:
the MultibodyPlant must not be finalized.
- set_default_positions(self: pydrake.multibody.tree.Joint, default_positions: numpy.ndarray[numpy.float64[m, 1]]) None
Sets the default generalized position coordinates q₀ to
default_positions
.Note
The values in
default_positions
are NOT constrained to be within position_lower_limits() and position_upper_limits().Note
The default generalized velocities v₀ are zero for every joint.
- Raises
RuntimeError if the dimension of default_positions does not –
match num_positions() –
- set_position_limits(self: pydrake.multibody.tree.Joint, lower_limits: numpy.ndarray[numpy.float64[m, 1]], upper_limits: numpy.ndarray[numpy.float64[m, 1]]) None
Sets the position limits to
lower_limits
andupper_limits
.- Raises
RuntimeError if the dimension of lower_limits or –
upper_limits` does not match num_positions() –
RuntimeError if any of lower_limits is larger than the –
corresponding term in upper_limits. –
Note
Setting the position limits does not affect the
default_positions()
, regardless of whether the currentdefault_positions()
satisfy the new position limits.
- set_velocity_limits(self: pydrake.multibody.tree.Joint, lower_limits: numpy.ndarray[numpy.float64[m, 1]], upper_limits: numpy.ndarray[numpy.float64[m, 1]]) None
Sets the velocity limits to
lower_limits
andupper_limits
.- Raises
RuntimeError if the dimension of lower_limits or –
upper_limits` does not match num_velocities() –
RuntimeError if any of lower_limits is larger than the –
corresponding term in upper_limits. –
- SetDampingVector(self: pydrake.multibody.tree.Joint, context: pydrake.systems.framework.Context, damping: numpy.ndarray[numpy.float64[m, 1]]) None
Sets the value of the viscous damping coefficients for this joint, stored as parameters in
context
. Refer to default_damping_vector() for details.- Parameter
context
: The context storing the state and parameters for the model to which
this
joint belongs.- Parameter
damping
: The vector of damping values.
- Raises
RuntimeError if damping.size() != num_velocities() –
RuntimeError if any of the damping coefficients is negative. –
Note
Some multi-dof joints may have specific semantics for their damping vector that are not enforced here. For instance, QuaternionFloatingJoint assumes identical damping values for all 3 angular velocity components and identical damping values for all 3 translational velocity components. It will thus use
angular_damping = damping[0]
andtranslational_damping = damping[3]
. Refer to the particular subclass for more semantic information.- Parameter
- SetDefaultPose(self: pydrake.multibody.tree.Joint, X_FM: pydrake.math.RigidTransform) None
Sets this joint’s default generalized positions q₀ such that the pose of the child frame M in the parent frame F best matches the given pose. The pose is given by a RigidTransform
X_FM
, but a joint will represent pose differently.Note
Currently this is implemented only for floating (6 dof) joints which can represent any pose.
- Raises
RuntimeError if called for any joint type that does not implement –
this function. –
See also
default_positions() to see the resulting q₀ after this call.
See also
SetDefaultPosePair() for an alternative using a quaternion
- SetDefaultPosePair(self: pydrake.multibody.tree.Joint, q_FM: pydrake.common.eigen_geometry.Quaternion, p_FM: numpy.ndarray[numpy.float64[3, 1]]) None
(Advanced) This is the same as SetDefaultPose() except it takes the pose as a (quaternion, translation vector) pair. A QuaternionFloatingJoint will store this pose bit-identically; an RpyFloatingJoint will store it to within floating point precision; any other joint will approximate it consistent with that joint’s mobility.
Note
Currently this is implemented only for floating (6 dof) joints which can represent any pose.
- Raises
RuntimeError if called for any joint type that does not implement –
this function. –
See also
SetDefaultPose()
- type_name(self: pydrake.multibody.tree.Joint) str
Returns a string identifying the type of
this
joint, such as “revolute” or “prismatic”.
- Unlock(self: pydrake.multibody.tree.Joint, context: pydrake.systems.framework.Context) None
Unlock the joint.
- velocity_lower_limits(self: pydrake.multibody.tree.Joint) numpy.ndarray[numpy.float64[m, 1]]
Returns the velocity lower limits.
- velocity_start(self: pydrake.multibody.tree.Joint) int
Returns the index to the first generalized velocity for this joint within the vector v of generalized velocities for the full multibody system.
- velocity_suffix(self: pydrake.multibody.tree.Joint, arg0: int) str
Returns a string suffix (e.g. to be appended to the name()) to identify the k`th velocity in this joint. ``velocity_index_in_joint` must be in [0, num_velocities()).
- Precondition:
the MultibodyPlant must be finalized.
- velocity_upper_limits(self: pydrake.multibody.tree.Joint) numpy.ndarray[numpy.float64[m, 1]]
Returns the velocity upper limits.
- template pydrake.multibody.tree.Joint_
Instantiations:
Joint_[float]
,Joint_[AutoDiffXd]
,Joint_[Expression]
- class pydrake.multibody.tree.Joint_[AutoDiffXd]
A Joint models the kinematical relationship which characterizes the possible relative motion between two bodies. The two bodies connected by this Joint object are referred to as parent and child bodies. The parent/child ordering defines the sign conventions for the generalized coordinates and the coordinate ordering for multi-DOF joints. A Joint is a model of a physical kinematic constraint between two bodies, a constraint that in the real physical system does not specify a tree ordering. @image html drake/multibody/plant/images/BodyParentChildJoint.png width=50%
In Drake we define a frame F rigidly attached to the parent body P with pose
X_PF
and a frame M rigidly attached to the child body B with poseX_BM
. A Joint object specifies a kinematic relation between frames F and M, which in turn imposes a kinematic relation between bodies P and B.Typical joints include the ball joint, to allow unrestricted rotations about a given point, the revolute joint, that constraints two bodies to rotate about a given common axis, etc.
Consider the following example to build a simple pendulum system:
Click to expand C++ code...
MultibodyPlant<double> plant(0.0); // ... Code here to setup quantities below as mass, com, etc. ... const RigidBody<double>& pendulum = plant.AddRigidBody(SpatialInertia<double>(mass, com, unit_inertia)); // We will connect the pendulum body to the world using a RevoluteJoint. // In this simple case the parent body P is the model's world body and frame // F IS the world frame. // Additionally, we need to specify the pose of frame M on the pendulum's // body frame B. // Say we declared and initialized X_BM... const RevoluteJoint<double>& elbow = plant.AddJoint<RevoluteJoint>( "Elbow", /* joint name plant.world_body(), /* parent body {}, /* frame F IS the world frame W pendulum, /* child body, the pendulum X_BM, /* pose of frame M in the body frame B Vector3d::UnitZ()); /* revolute axis in this case
Warning
Do not ever attempt to instantiate and manipulate Joint objects on the stack; it will fail. Add joints to your plant using the provided API MultibodyPlant::AddJoint() as in the example above.
- __init__(*args, **kwargs)
- acceleration_lower_limits(self: pydrake.multibody.tree.Joint_[AutoDiffXd]) numpy.ndarray[numpy.float64[m, 1]]
Returns the acceleration lower limits.
- acceleration_upper_limits(self: pydrake.multibody.tree.Joint_[AutoDiffXd]) numpy.ndarray[numpy.float64[m, 1]]
Returns the acceleration upper limits.
- AddInDamping(self: pydrake.multibody.tree.Joint_[AutoDiffXd], context: pydrake.systems.framework.Context_[AutoDiffXd], forces: pydrake.multibody.tree.MultibodyForces_[AutoDiffXd]) None
Adds into
forces
the force due to damping withinthis
joint.- Parameter
context
: The context storing the state and parameters for the model to which
this
joint belongs.- Parameter
forces
: On return, this method will add the force due to damping within
this
joint. This method aborts ifforces
isnullptr
or ifforces
does not have the right sizes to accommodate a set of forces for the model to which this joint belongs.
- Parameter
- AddInOneForce(self: pydrake.multibody.tree.Joint_[AutoDiffXd], context: pydrake.systems.framework.Context_[AutoDiffXd], joint_dof: int, joint_tau: pydrake.autodiffutils.AutoDiffXd, forces: pydrake.multibody.tree.MultibodyForces_[AutoDiffXd]) None
Adds into
forces
a force along the one of the joint’s degrees of freedom indicated by indexjoint_dof
. The meaning for this degree of freedom and even its dimensional units depend on the specific joint sub-class. For a RevoluteJoint for instance,joint_dof
can only be 0 since revolute joints’s motion subspace only has one degree of freedom, while the units ofjoint_tau
are those of torque (N⋅m in the MKS system of units). For multi-dof joints please refer to the documentation provided by specific joint sub-classes regarding the meaning ofjoint_dof
.- Parameter
context
: The context storing the state and parameters for the model to which
this
joint belongs.- Parameter
joint_dof
: Index specifying one of the degrees of freedom for this joint. The index must be in the range
0 <= joint_dof < num_velocities()
or otherwise this method will abort.- Parameter
joint_tau
: Generalized force corresponding to the degree of freedom indicated by
joint_dof
to be added intoforces
.- Parameter
forces
: On return, this method will add force
joint_tau
for the degree of freedomjoint_dof
into the outputforces
. This method aborts ifforces
isnullptr
or ifforces
doest not have the right sizes to accommodate a set of forces for the model to which this joint belongs.
- Parameter
- can_rotate(self: pydrake.multibody.tree.Joint_[AutoDiffXd]) bool
Returns true if this joint’s mobility allows relative rotation of the two frames associated with this joint.
- Precondition:
the MultibodyPlant must be finalized.
See also
can_translate()
- can_translate(self: pydrake.multibody.tree.Joint_[AutoDiffXd]) bool
Returns true if this joint’s mobility allows relative translation of the two frames associated with this joint.
- Precondition:
the MultibodyPlant must be finalized.
See also
can_rotate()
- child_body(self: pydrake.multibody.tree.Joint_[AutoDiffXd]) pydrake.multibody.tree.RigidBody_[AutoDiffXd]
Returns a const reference to the child body B.
- default_damping_vector(self: pydrake.multibody.tree.Joint_[AutoDiffXd]) numpy.ndarray[numpy.float64[m, 1]]
Returns all default damping coefficients for joints that model viscous damping, of size num_velocities(). Joints that do not model damping return a zero vector of size num_velocities(). If vj is the vector of generalized velocities for this joint, of size num_velocities(), viscous damping models a generalized force at the joint of the form tau = -diag(dj)⋅vj, with dj the vector returned by this function. The units of the coefficients will depend on the specific joint type. For instance, for a revolute joint where vj is an angular velocity with units of rad/s and tau having units of N⋅m, the coefficient of viscous damping has units of N⋅m⋅s. Refer to each joint’s documentation for further details.
- default_positions(self: pydrake.multibody.tree.Joint_[AutoDiffXd]) numpy.ndarray[numpy.float64[m, 1]]
Returns the default generalized position coordinates q₀. These will be the values set with set_default_positions() if any; otherwise, they will be the “zero configuration” for this joint type (as defined by the particular joint type).
Note
The default generalized velocities v₀ are zero for every joint.
- frame_on_child(self: pydrake.multibody.tree.Joint_[AutoDiffXd]) pydrake.multibody.tree.Frame_[AutoDiffXd]
Returns a const reference to the frame M attached on the child body B.
- frame_on_parent(self: pydrake.multibody.tree.Joint_[AutoDiffXd]) pydrake.multibody.tree.Frame_[AutoDiffXd]
Returns a const reference to the frame F attached on the parent body P.
- GetDampingVector(self: pydrake.multibody.tree.Joint_[AutoDiffXd], context: pydrake.systems.framework.Context_[AutoDiffXd]) numpy.ndarray[object[m, 1]]
Returns the Context dependent damping coefficients stored as parameters in
context
. Refer to default_damping_vector() for details.- Parameter
context
: The context storing the state and parameters for the model to which
this
joint belongs.
- Parameter
- GetDefaultPose(self: pydrake.multibody.tree.Joint_[AutoDiffXd]) pydrake.math.RigidTransform
Returns this joint’s default pose as a RigidTransform X_FM.
Note
Currently this is implemented only for floating (6 dof) joints which can represent any pose.
- Raises
RuntimeError if called for any joint type that does not implement –
this function. –
- Returns
X_FM
: The default pose as a rigid transform.
See also
default_positions() to see the generalized positions q₀ that this joint used to generate the returned transform.
See also
GetDefaultPosePair() for an alternative using a quaternion
- GetDefaultPosePair(self: pydrake.multibody.tree.Joint_[AutoDiffXd]) tuple[pydrake.common.eigen_geometry.Quaternion, numpy.ndarray[numpy.float64[3, 1]]]
(Advanced) This is the same as GetDefaultPose() except it returns this joint’s default pose as a (quaternion, translation vector) pair.
Note
Currently this is implemented only for floating (6 dof) joints which can represent any pose.
Note
For a QuaternionFloatingJoint the return will be bit-identical to the pose provided to SetDefaultPosePair(). For any other floating (6 dof) joint the pose will be numerically equivalent (i.e. within roundoff) but not identical. For other joint types it will be some approximation.
- Returns
q_FM
: ,p_FM The default pose as a (quaternion, translation) pair.
- Raises
RuntimeError if called for any joint type that does not implement –
this function. –
See also
GetDefaultPose()
- Returns
- GetOnePosition(self: pydrake.multibody.tree.Joint_[AutoDiffXd], context: pydrake.systems.framework.Context_[AutoDiffXd]) pydrake.autodiffutils.AutoDiffXd
Returns the position coordinate for joints with a single degree of freedom.
- Raises
RuntimeError if the joint does not have a single degree of –
freedom. –
- GetOneVelocity(self: pydrake.multibody.tree.Joint_[AutoDiffXd], context: pydrake.systems.framework.Context_[AutoDiffXd]) pydrake.autodiffutils.AutoDiffXd
Returns the velocity coordinate for joints with a single degree of freedom.
- Raises
RuntimeError if the joint does not have a single degree of –
freedom. –
- GetParentPlant(self: pydrake.multibody.tree.Joint_[AutoDiffXd]) drake::multibody::MultibodyPlant<Eigen::AutoDiffScalar<Eigen::Matrix<double, -1, 1, 0, -1, 1> > >
- index(*args, **kwargs)
Overloaded function.
index(self: pydrake.multibody.tree.Joint_[AutoDiffXd]) -> pydrake.multibody.tree.JointIndex
index(self: pydrake.multibody.tree.Joint_[AutoDiffXd]) -> pydrake.multibody.tree.JointIndex
Returns this element’s unique index.
- is_locked(self: pydrake.multibody.tree.Joint_[AutoDiffXd], context: pydrake.systems.framework.Context_[AutoDiffXd]) bool
- Returns
true if the joint is locked, false otherwise.
- Lock(self: pydrake.multibody.tree.Joint_[AutoDiffXd], context: pydrake.systems.framework.Context_[AutoDiffXd]) None
Lock the joint. Its generalized velocities will be 0 until it is unlocked.
- model_instance(self: pydrake.multibody.tree.Joint_[AutoDiffXd]) pydrake.multibody.tree.ModelInstanceIndex
- name(self: pydrake.multibody.tree.Joint_[AutoDiffXd]) str
Returns the name of this joint.
- num_positions(self: pydrake.multibody.tree.Joint_[AutoDiffXd]) int
Returns the number of generalized positions describing this joint.
- num_velocities(self: pydrake.multibody.tree.Joint_[AutoDiffXd]) int
Returns the number of generalized velocities describing this joint.
- parent_body(self: pydrake.multibody.tree.Joint_[AutoDiffXd]) pydrake.multibody.tree.RigidBody_[AutoDiffXd]
Returns a const reference to the parent body P.
- position_lower_limits(self: pydrake.multibody.tree.Joint_[AutoDiffXd]) numpy.ndarray[numpy.float64[m, 1]]
Returns the position lower limits.
- position_start(self: pydrake.multibody.tree.Joint_[AutoDiffXd]) int
Returns the index to the first generalized position for this joint within the vector q of generalized positions for the full multibody system.
- position_suffix(self: pydrake.multibody.tree.Joint_[AutoDiffXd], arg0: int) str
Returns a string suffix (e.g. to be appended to the name()) to identify the k`th position in this joint. ``position_index_in_joint` must be in [0, num_positions()).
- Precondition:
the MultibodyPlant must be finalized.
- position_upper_limits(self: pydrake.multibody.tree.Joint_[AutoDiffXd]) numpy.ndarray[numpy.float64[m, 1]]
Returns the position upper limits.
- set_acceleration_limits(self: pydrake.multibody.tree.Joint_[AutoDiffXd], lower_limits: numpy.ndarray[numpy.float64[m, 1]], upper_limits: numpy.ndarray[numpy.float64[m, 1]]) None
Sets the acceleration limits to
lower_limits
andupper_limits
.- Raises
RuntimeError if the dimension of lower_limits or –
upper_limits` does not match num_velocities() –
RuntimeError if any of lower_limits is larger than the –
corresponding term in upper_limits. –
- set_default_damping_vector(self: pydrake.multibody.tree.Joint_[AutoDiffXd], damping: numpy.ndarray[numpy.float64[m, 1]]) None
Sets the default value of the viscous damping coefficients for this joint. Refer to default_damping_vector() for details.
- Raises
RuntimeError if damping.size() != num_velocities() –
RuntimeError if any of the damping coefficients is negative. –
- Precondition:
the MultibodyPlant must not be finalized.
- set_default_positions(self: pydrake.multibody.tree.Joint_[AutoDiffXd], default_positions: numpy.ndarray[numpy.float64[m, 1]]) None
Sets the default generalized position coordinates q₀ to
default_positions
.Note
The values in
default_positions
are NOT constrained to be within position_lower_limits() and position_upper_limits().Note
The default generalized velocities v₀ are zero for every joint.
- Raises
RuntimeError if the dimension of default_positions does not –
match num_positions() –
- set_position_limits(self: pydrake.multibody.tree.Joint_[AutoDiffXd], lower_limits: numpy.ndarray[numpy.float64[m, 1]], upper_limits: numpy.ndarray[numpy.float64[m, 1]]) None
Sets the position limits to
lower_limits
andupper_limits
.- Raises
RuntimeError if the dimension of lower_limits or –
upper_limits` does not match num_positions() –
RuntimeError if any of lower_limits is larger than the –
corresponding term in upper_limits. –
Note
Setting the position limits does not affect the
default_positions()
, regardless of whether the currentdefault_positions()
satisfy the new position limits.
- set_velocity_limits(self: pydrake.multibody.tree.Joint_[AutoDiffXd], lower_limits: numpy.ndarray[numpy.float64[m, 1]], upper_limits: numpy.ndarray[numpy.float64[m, 1]]) None
Sets the velocity limits to
lower_limits
andupper_limits
.- Raises
RuntimeError if the dimension of lower_limits or –
upper_limits` does not match num_velocities() –
RuntimeError if any of lower_limits is larger than the –
corresponding term in upper_limits. –
- SetDampingVector(self: pydrake.multibody.tree.Joint_[AutoDiffXd], context: pydrake.systems.framework.Context_[AutoDiffXd], damping: numpy.ndarray[object[m, 1]]) None
Sets the value of the viscous damping coefficients for this joint, stored as parameters in
context
. Refer to default_damping_vector() for details.- Parameter
context
: The context storing the state and parameters for the model to which
this
joint belongs.- Parameter
damping
: The vector of damping values.
- Raises
RuntimeError if damping.size() != num_velocities() –
RuntimeError if any of the damping coefficients is negative. –
Note
Some multi-dof joints may have specific semantics for their damping vector that are not enforced here. For instance, QuaternionFloatingJoint assumes identical damping values for all 3 angular velocity components and identical damping values for all 3 translational velocity components. It will thus use
angular_damping = damping[0]
andtranslational_damping = damping[3]
. Refer to the particular subclass for more semantic information.- Parameter
- SetDefaultPose(self: pydrake.multibody.tree.Joint_[AutoDiffXd], X_FM: pydrake.math.RigidTransform) None
Sets this joint’s default generalized positions q₀ such that the pose of the child frame M in the parent frame F best matches the given pose. The pose is given by a RigidTransform
X_FM
, but a joint will represent pose differently.Note
Currently this is implemented only for floating (6 dof) joints which can represent any pose.
- Raises
RuntimeError if called for any joint type that does not implement –
this function. –
See also
default_positions() to see the resulting q₀ after this call.
See also
SetDefaultPosePair() for an alternative using a quaternion
- SetDefaultPosePair(self: pydrake.multibody.tree.Joint_[AutoDiffXd], q_FM: pydrake.common.eigen_geometry.Quaternion, p_FM: numpy.ndarray[numpy.float64[3, 1]]) None
(Advanced) This is the same as SetDefaultPose() except it takes the pose as a (quaternion, translation vector) pair. A QuaternionFloatingJoint will store this pose bit-identically; an RpyFloatingJoint will store it to within floating point precision; any other joint will approximate it consistent with that joint’s mobility.
Note
Currently this is implemented only for floating (6 dof) joints which can represent any pose.
- Raises
RuntimeError if called for any joint type that does not implement –
this function. –
See also
SetDefaultPose()
- type_name(self: pydrake.multibody.tree.Joint_[AutoDiffXd]) str
Returns a string identifying the type of
this
joint, such as “revolute” or “prismatic”.
- Unlock(self: pydrake.multibody.tree.Joint_[AutoDiffXd], context: pydrake.systems.framework.Context_[AutoDiffXd]) None
Unlock the joint.
- velocity_lower_limits(self: pydrake.multibody.tree.Joint_[AutoDiffXd]) numpy.ndarray[numpy.float64[m, 1]]
Returns the velocity lower limits.
- velocity_start(self: pydrake.multibody.tree.Joint_[AutoDiffXd]) int
Returns the index to the first generalized velocity for this joint within the vector v of generalized velocities for the full multibody system.
- velocity_suffix(self: pydrake.multibody.tree.Joint_[AutoDiffXd], arg0: int) str
Returns a string suffix (e.g. to be appended to the name()) to identify the k`th velocity in this joint. ``velocity_index_in_joint` must be in [0, num_velocities()).
- Precondition:
the MultibodyPlant must be finalized.
- velocity_upper_limits(self: pydrake.multibody.tree.Joint_[AutoDiffXd]) numpy.ndarray[numpy.float64[m, 1]]
Returns the velocity upper limits.
- class pydrake.multibody.tree.Joint_[Expression]
A Joint models the kinematical relationship which characterizes the possible relative motion between two bodies. The two bodies connected by this Joint object are referred to as parent and child bodies. The parent/child ordering defines the sign conventions for the generalized coordinates and the coordinate ordering for multi-DOF joints. A Joint is a model of a physical kinematic constraint between two bodies, a constraint that in the real physical system does not specify a tree ordering. @image html drake/multibody/plant/images/BodyParentChildJoint.png width=50%
In Drake we define a frame F rigidly attached to the parent body P with pose
X_PF
and a frame M rigidly attached to the child body B with poseX_BM
. A Joint object specifies a kinematic relation between frames F and M, which in turn imposes a kinematic relation between bodies P and B.Typical joints include the ball joint, to allow unrestricted rotations about a given point, the revolute joint, that constraints two bodies to rotate about a given common axis, etc.
Consider the following example to build a simple pendulum system:
Click to expand C++ code...
MultibodyPlant<double> plant(0.0); // ... Code here to setup quantities below as mass, com, etc. ... const RigidBody<double>& pendulum = plant.AddRigidBody(SpatialInertia<double>(mass, com, unit_inertia)); // We will connect the pendulum body to the world using a RevoluteJoint. // In this simple case the parent body P is the model's world body and frame // F IS the world frame. // Additionally, we need to specify the pose of frame M on the pendulum's // body frame B. // Say we declared and initialized X_BM... const RevoluteJoint<double>& elbow = plant.AddJoint<RevoluteJoint>( "Elbow", /* joint name plant.world_body(), /* parent body {}, /* frame F IS the world frame W pendulum, /* child body, the pendulum X_BM, /* pose of frame M in the body frame B Vector3d::UnitZ()); /* revolute axis in this case
Warning
Do not ever attempt to instantiate and manipulate Joint objects on the stack; it will fail. Add joints to your plant using the provided API MultibodyPlant::AddJoint() as in the example above.
- __init__(*args, **kwargs)
- acceleration_lower_limits(self: pydrake.multibody.tree.Joint_[Expression]) numpy.ndarray[numpy.float64[m, 1]]
Returns the acceleration lower limits.
- acceleration_upper_limits(self: pydrake.multibody.tree.Joint_[Expression]) numpy.ndarray[numpy.float64[m, 1]]
Returns the acceleration upper limits.
- AddInDamping(self: pydrake.multibody.tree.Joint_[Expression], context: pydrake.systems.framework.Context_[Expression], forces: pydrake.multibody.tree.MultibodyForces_[Expression]) None
Adds into
forces
the force due to damping withinthis
joint.- Parameter
context
: The context storing the state and parameters for the model to which
this
joint belongs.- Parameter
forces
: On return, this method will add the force due to damping within
this
joint. This method aborts ifforces
isnullptr
or ifforces
does not have the right sizes to accommodate a set of forces for the model to which this joint belongs.
- Parameter
- AddInOneForce(self: pydrake.multibody.tree.Joint_[Expression], context: pydrake.systems.framework.Context_[Expression], joint_dof: int, joint_tau: pydrake.symbolic.Expression, forces: pydrake.multibody.tree.MultibodyForces_[Expression]) None
Adds into
forces
a force along the one of the joint’s degrees of freedom indicated by indexjoint_dof
. The meaning for this degree of freedom and even its dimensional units depend on the specific joint sub-class. For a RevoluteJoint for instance,joint_dof
can only be 0 since revolute joints’s motion subspace only has one degree of freedom, while the units ofjoint_tau
are those of torque (N⋅m in the MKS system of units). For multi-dof joints please refer to the documentation provided by specific joint sub-classes regarding the meaning ofjoint_dof
.- Parameter
context
: The context storing the state and parameters for the model to which
this
joint belongs.- Parameter
joint_dof
: Index specifying one of the degrees of freedom for this joint. The index must be in the range
0 <= joint_dof < num_velocities()
or otherwise this method will abort.- Parameter
joint_tau
: Generalized force corresponding to the degree of freedom indicated by
joint_dof
to be added intoforces
.- Parameter
forces
: On return, this method will add force
joint_tau
for the degree of freedomjoint_dof
into the outputforces
. This method aborts ifforces
isnullptr
or ifforces
doest not have the right sizes to accommodate a set of forces for the model to which this joint belongs.
- Parameter
- can_rotate(self: pydrake.multibody.tree.Joint_[Expression]) bool
Returns true if this joint’s mobility allows relative rotation of the two frames associated with this joint.
- Precondition:
the MultibodyPlant must be finalized.
See also
can_translate()
- can_translate(self: pydrake.multibody.tree.Joint_[Expression]) bool
Returns true if this joint’s mobility allows relative translation of the two frames associated with this joint.
- Precondition:
the MultibodyPlant must be finalized.
See also
can_rotate()
- child_body(self: pydrake.multibody.tree.Joint_[Expression]) pydrake.multibody.tree.RigidBody_[Expression]
Returns a const reference to the child body B.
- default_damping_vector(self: pydrake.multibody.tree.Joint_[Expression]) numpy.ndarray[numpy.float64[m, 1]]
Returns all default damping coefficients for joints that model viscous damping, of size num_velocities(). Joints that do not model damping return a zero vector of size num_velocities(). If vj is the vector of generalized velocities for this joint, of size num_velocities(), viscous damping models a generalized force at the joint of the form tau = -diag(dj)⋅vj, with dj the vector returned by this function. The units of the coefficients will depend on the specific joint type. For instance, for a revolute joint where vj is an angular velocity with units of rad/s and tau having units of N⋅m, the coefficient of viscous damping has units of N⋅m⋅s. Refer to each joint’s documentation for further details.
- default_positions(self: pydrake.multibody.tree.Joint_[Expression]) numpy.ndarray[numpy.float64[m, 1]]
Returns the default generalized position coordinates q₀. These will be the values set with set_default_positions() if any; otherwise, they will be the “zero configuration” for this joint type (as defined by the particular joint type).
Note
The default generalized velocities v₀ are zero for every joint.
- frame_on_child(self: pydrake.multibody.tree.Joint_[Expression]) pydrake.multibody.tree.Frame_[Expression]
Returns a const reference to the frame M attached on the child body B.
- frame_on_parent(self: pydrake.multibody.tree.Joint_[Expression]) pydrake.multibody.tree.Frame_[Expression]
Returns a const reference to the frame F attached on the parent body P.
- GetDampingVector(self: pydrake.multibody.tree.Joint_[Expression], context: pydrake.systems.framework.Context_[Expression]) numpy.ndarray[object[m, 1]]
Returns the Context dependent damping coefficients stored as parameters in
context
. Refer to default_damping_vector() for details.- Parameter
context
: The context storing the state and parameters for the model to which
this
joint belongs.
- Parameter
- GetDefaultPose(self: pydrake.multibody.tree.Joint_[Expression]) pydrake.math.RigidTransform
Returns this joint’s default pose as a RigidTransform X_FM.
Note
Currently this is implemented only for floating (6 dof) joints which can represent any pose.
- Raises
RuntimeError if called for any joint type that does not implement –
this function. –
- Returns
X_FM
: The default pose as a rigid transform.
See also
default_positions() to see the generalized positions q₀ that this joint used to generate the returned transform.
See also
GetDefaultPosePair() for an alternative using a quaternion
- GetDefaultPosePair(self: pydrake.multibody.tree.Joint_[Expression]) tuple[pydrake.common.eigen_geometry.Quaternion, numpy.ndarray[numpy.float64[3, 1]]]
(Advanced) This is the same as GetDefaultPose() except it returns this joint’s default pose as a (quaternion, translation vector) pair.
Note
Currently this is implemented only for floating (6 dof) joints which can represent any pose.
Note
For a QuaternionFloatingJoint the return will be bit-identical to the pose provided to SetDefaultPosePair(). For any other floating (6 dof) joint the pose will be numerically equivalent (i.e. within roundoff) but not identical. For other joint types it will be some approximation.
- Returns
q_FM
: ,p_FM The default pose as a (quaternion, translation) pair.
- Raises
RuntimeError if called for any joint type that does not implement –
this function. –
See also
GetDefaultPose()
- Returns
- GetOnePosition(self: pydrake.multibody.tree.Joint_[Expression], context: pydrake.systems.framework.Context_[Expression]) pydrake.symbolic.Expression
Returns the position coordinate for joints with a single degree of freedom.
- Raises
RuntimeError if the joint does not have a single degree of –
freedom. –
- GetOneVelocity(self: pydrake.multibody.tree.Joint_[Expression], context: pydrake.systems.framework.Context_[Expression]) pydrake.symbolic.Expression
Returns the velocity coordinate for joints with a single degree of freedom.
- Raises
RuntimeError if the joint does not have a single degree of –
freedom. –
- GetParentPlant(self: pydrake.multibody.tree.Joint_[Expression]) drake::multibody::MultibodyPlant<drake::symbolic::Expression>
- index(*args, **kwargs)
Overloaded function.
index(self: pydrake.multibody.tree.Joint_[Expression]) -> pydrake.multibody.tree.JointIndex
index(self: pydrake.multibody.tree.Joint_[Expression]) -> pydrake.multibody.tree.JointIndex
Returns this element’s unique index.
- is_locked(self: pydrake.multibody.tree.Joint_[Expression], context: pydrake.systems.framework.Context_[Expression]) bool
- Returns
true if the joint is locked, false otherwise.
- Lock(self: pydrake.multibody.tree.Joint_[Expression], context: pydrake.systems.framework.Context_[Expression]) None
Lock the joint. Its generalized velocities will be 0 until it is unlocked.
- model_instance(self: pydrake.multibody.tree.Joint_[Expression]) pydrake.multibody.tree.ModelInstanceIndex
- name(self: pydrake.multibody.tree.Joint_[Expression]) str
Returns the name of this joint.
- num_positions(self: pydrake.multibody.tree.Joint_[Expression]) int
Returns the number of generalized positions describing this joint.
- num_velocities(self: pydrake.multibody.tree.Joint_[Expression]) int
Returns the number of generalized velocities describing this joint.
- parent_body(self: pydrake.multibody.tree.Joint_[Expression]) pydrake.multibody.tree.RigidBody_[Expression]
Returns a const reference to the parent body P.
- position_lower_limits(self: pydrake.multibody.tree.Joint_[Expression]) numpy.ndarray[numpy.float64[m, 1]]
Returns the position lower limits.
- position_start(self: pydrake.multibody.tree.Joint_[Expression]) int
Returns the index to the first generalized position for this joint within the vector q of generalized positions for the full multibody system.
- position_suffix(self: pydrake.multibody.tree.Joint_[Expression], arg0: int) str
Returns a string suffix (e.g. to be appended to the name()) to identify the k`th position in this joint. ``position_index_in_joint` must be in [0, num_positions()).
- Precondition:
the MultibodyPlant must be finalized.
- position_upper_limits(self: pydrake.multibody.tree.Joint_[Expression]) numpy.ndarray[numpy.float64[m, 1]]
Returns the position upper limits.
- set_acceleration_limits(self: pydrake.multibody.tree.Joint_[Expression], lower_limits: numpy.ndarray[numpy.float64[m, 1]], upper_limits: numpy.ndarray[numpy.float64[m, 1]]) None
Sets the acceleration limits to
lower_limits
andupper_limits
.- Raises
RuntimeError if the dimension of lower_limits or –
upper_limits` does not match num_velocities() –
RuntimeError if any of lower_limits is larger than the –
corresponding term in upper_limits. –
- set_default_damping_vector(self: pydrake.multibody.tree.Joint_[Expression], damping: numpy.ndarray[numpy.float64[m, 1]]) None
Sets the default value of the viscous damping coefficients for this joint. Refer to default_damping_vector() for details.
- Raises
RuntimeError if damping.size() != num_velocities() –
RuntimeError if any of the damping coefficients is negative. –
- Precondition:
the MultibodyPlant must not be finalized.
- set_default_positions(self: pydrake.multibody.tree.Joint_[Expression], default_positions: numpy.ndarray[numpy.float64[m, 1]]) None
Sets the default generalized position coordinates q₀ to
default_positions
.Note
The values in
default_positions
are NOT constrained to be within position_lower_limits() and position_upper_limits().Note
The default generalized velocities v₀ are zero for every joint.
- Raises
RuntimeError if the dimension of default_positions does not –
match num_positions() –
- set_position_limits(self: pydrake.multibody.tree.Joint_[Expression], lower_limits: numpy.ndarray[numpy.float64[m, 1]], upper_limits: numpy.ndarray[numpy.float64[m, 1]]) None
Sets the position limits to
lower_limits
andupper_limits
.- Raises
RuntimeError if the dimension of lower_limits or –
upper_limits` does not match num_positions() –
RuntimeError if any of lower_limits is larger than the –
corresponding term in upper_limits. –
Note
Setting the position limits does not affect the
default_positions()
, regardless of whether the currentdefault_positions()
satisfy the new position limits.
- set_velocity_limits(self: pydrake.multibody.tree.Joint_[Expression], lower_limits: numpy.ndarray[numpy.float64[m, 1]], upper_limits: numpy.ndarray[numpy.float64[m, 1]]) None
Sets the velocity limits to
lower_limits
andupper_limits
.- Raises
RuntimeError if the dimension of lower_limits or –
upper_limits` does not match num_velocities() –
RuntimeError if any of lower_limits is larger than the –
corresponding term in upper_limits. –
- SetDampingVector(self: pydrake.multibody.tree.Joint_[Expression], context: pydrake.systems.framework.Context_[Expression], damping: numpy.ndarray[object[m, 1]]) None
Sets the value of the viscous damping coefficients for this joint, stored as parameters in
context
. Refer to default_damping_vector() for details.- Parameter
context
: The context storing the state and parameters for the model to which
this
joint belongs.- Parameter
damping
: The vector of damping values.
- Raises
RuntimeError if damping.size() != num_velocities() –
RuntimeError if any of the damping coefficients is negative. –
Note
Some multi-dof joints may have specific semantics for their damping vector that are not enforced here. For instance, QuaternionFloatingJoint assumes identical damping values for all 3 angular velocity components and identical damping values for all 3 translational velocity components. It will thus use
angular_damping = damping[0]
andtranslational_damping = damping[3]
. Refer to the particular subclass for more semantic information.- Parameter
- SetDefaultPose(self: pydrake.multibody.tree.Joint_[Expression], X_FM: pydrake.math.RigidTransform) None
Sets this joint’s default generalized positions q₀ such that the pose of the child frame M in the parent frame F best matches the given pose. The pose is given by a RigidTransform
X_FM
, but a joint will represent pose differently.Note
Currently this is implemented only for floating (6 dof) joints which can represent any pose.
- Raises
RuntimeError if called for any joint type that does not implement –
this function. –
See also
default_positions() to see the resulting q₀ after this call.
See also
SetDefaultPosePair() for an alternative using a quaternion
- SetDefaultPosePair(self: pydrake.multibody.tree.Joint_[Expression], q_FM: pydrake.common.eigen_geometry.Quaternion, p_FM: numpy.ndarray[numpy.float64[3, 1]]) None
(Advanced) This is the same as SetDefaultPose() except it takes the pose as a (quaternion, translation vector) pair. A QuaternionFloatingJoint will store this pose bit-identically; an RpyFloatingJoint will store it to within floating point precision; any other joint will approximate it consistent with that joint’s mobility.
Note
Currently this is implemented only for floating (6 dof) joints which can represent any pose.
- Raises
RuntimeError if called for any joint type that does not implement –
this function. –
See also
SetDefaultPose()
- type_name(self: pydrake.multibody.tree.Joint_[Expression]) str
Returns a string identifying the type of
this
joint, such as “revolute” or “prismatic”.
- Unlock(self: pydrake.multibody.tree.Joint_[Expression], context: pydrake.systems.framework.Context_[Expression]) None
Unlock the joint.
- velocity_lower_limits(self: pydrake.multibody.tree.Joint_[Expression]) numpy.ndarray[numpy.float64[m, 1]]
Returns the velocity lower limits.
- velocity_start(self: pydrake.multibody.tree.Joint_[Expression]) int
Returns the index to the first generalized velocity for this joint within the vector v of generalized velocities for the full multibody system.
- velocity_suffix(self: pydrake.multibody.tree.Joint_[Expression], arg0: int) str
Returns a string suffix (e.g. to be appended to the name()) to identify the k`th velocity in this joint. ``velocity_index_in_joint` must be in [0, num_velocities()).
- Precondition:
the MultibodyPlant must be finalized.
- velocity_upper_limits(self: pydrake.multibody.tree.Joint_[Expression]) numpy.ndarray[numpy.float64[m, 1]]
Returns the velocity upper limits.
- class pydrake.multibody.tree.JointActuator
The JointActuator class is mostly a simple bookkeeping structure to represent an actuator acting on a given Joint. It helps to flag whether a given Joint is actuated or not so that MultibodyTree clients can apply forces on actuated joints through their actuators, see AddInOneForce().
Note
This class is templated; see
JointActuator_
for the list of instantiations.- __init__(*args, **kwargs)
- calc_reflected_inertia(self: pydrake.multibody.tree.JointActuator, context: pydrake.systems.framework.Context) float
Calculates the reflected inertia value for this actuator in
context
. See reflected_inertia. Note that this ONLY depends on the Parameters in the context; it does not depend on time, input, state, etc.
- default_gear_ratio(self: pydrake.multibody.tree.JointActuator) float
Gets the default value for this actuator’s gear ratio. See reflected_inertia.
- default_reflected_inertia(self: pydrake.multibody.tree.JointActuator) float
Returns the default value for this actuator’s reflected inertia. It is calculated as ρ²⋅Iᵣ, where ρ is the default gear ratio and Iᵣ is the default rotor inertia for this actuator. See reflected_inertia.
- default_rotor_inertia(self: pydrake.multibody.tree.JointActuator) float
Gets the default value for this actuator’s rotor inertia. See reflected_inertia.
- effort_limit(self: pydrake.multibody.tree.JointActuator) float
Returns the actuator effort limit.
- gear_ratio(self: pydrake.multibody.tree.JointActuator, context: pydrake.systems.framework.Context) float
Returns the associated gear ratio value for this actuator, stored in
context
. See reflected_inertia. Note that this ONLY depends on the Parameters in the context; it does not depend on time, input, state, etc.
- get_actuation_vector(self: pydrake.multibody.tree.JointActuator, u: numpy.ndarray[numpy.float64[m, 1]]) numpy.ndarray[numpy.float64[m, 1]]
Gets the actuation values for
this
actuator from the actuation vector u for the entire plant model.- Returns
a reference to a nv-dimensional vector, where nv is the number of velocity variables of joint().
- get_controller_gains(self: pydrake.multibody.tree.JointActuator) pydrake.multibody.tree.PdControllerGains
Returns a reference to the controller gains for this actuator.
- Precondition:
has_controller() is
True
.
- GetParentPlant(self: pydrake.multibody.tree.JointActuator) drake::multibody::MultibodyPlant<double>
- has_controller(self: pydrake.multibody.tree.JointActuator) bool
Returns
True
if controller gains have been specified with a call to set_controller_gains().
- input_start(self: pydrake.multibody.tree.JointActuator) int
Returns the index to the first element for this joint actuator / within the vector of actuation inputs for the full multibody / system.
- Raises
RuntimeError if the MultibodyTree model is not finalized. –
- joint(self: pydrake.multibody.tree.JointActuator) pydrake.multibody.tree.Joint
Returns a reference to the joint actuated by this JointActuator.
- model_instance(self: pydrake.multibody.tree.JointActuator) pydrake.multibody.tree.ModelInstanceIndex
- name(self: pydrake.multibody.tree.JointActuator) str
Returns the name of the actuator.
- num_inputs(self: pydrake.multibody.tree.JointActuator) int
Returns the number of inputs associated with this actuator.
- Raises
RuntimeError if the MultibodyTree model is not finalized. –
- rotor_inertia(self: pydrake.multibody.tree.JointActuator, context: pydrake.systems.framework.Context) float
Returns the associated rotor inertia value for this actuator, stored in
context
. See reflected_inertia. Note that this ONLY depends on the Parameters in the context; it does not depend on time, input, state, etc.
- set_actuation_vector(self: pydrake.multibody.tree.JointActuator, u_actuator: numpy.ndarray[numpy.float64[m, 1]], u: Optional[numpy.ndarray[numpy.float64[m, 1], flags.writeable]]) None
Given the actuation values
u_actuator
forthis
actuator, updates the actuation vectoru
for the entire multibody model to which this actuator belongs to.- Parameter
u_actuator
: Actuation values for
this
actuator. It must be of size equal to num_inputs(). For units and sign conventions refer to the specific Joint sub-class documentation.- Parameter
u
: Actuation values for the entire plant model to which
this
actuator belongs to. The actuation value inu
forthis
actuator must be found at offset input_start(). Only values corresponding to this actuator are changed.
- Raises
RuntimeError if u_actuator.size() != this->num_inputs() –
RuntimeError if u is nullptr. –
RuntimeError if ``u.size() != –
this->GetParentPlant()num_actuated_dofs()``. –
- Parameter
- set_controller_gains(self: pydrake.multibody.tree.JointActuator, gains: pydrake.multibody.tree.PdControllerGains) None
Set controller gains for this joint actuator. This enables the modeling of a simple PD controller of the form: ũ = -Kp⋅(q − qd) - Kd⋅(v − vd) + u_ff u = max(−e, min(e, ũ)) where qd and vd are the desired configuration and velocity for joint(), Kp and Kd are the proportional and derivative gains specified in
gains
, u_ff is the feedforward actuation ande
corresponds to effort_limit().For simulation, feedforward actuation can be provided through MultibodyPlant::get_actuation_input_port(). Desired configuration and velocity are specified through MultibodyPlant::get_desired_state_input_port().
- Precondition:
The MultibodyPlant associated with this actuator has not yet allocated a Context. In other words, although gains can be changed post-Finalize, they cannot be changed during simulation.
- Raises
iff the proportional gain is not strictly positive or if the –
derivative gain is negative. –
iff the owning MultibodyPlant is finalized and no gains were set –
pre-finalize. In other words, editing gains post-finalize is –
fine, but adding gains post-finalize is an error. See –
MultibodyPlant::Finalize() –
- set_default_gear_ratio(self: pydrake.multibody.tree.JointActuator, gear_ratio: float) None
Sets the default value for this actuator’s gear ratio. See reflected_inertia.
- set_default_rotor_inertia(self: pydrake.multibody.tree.JointActuator, rotor_inertia: float) None
Sets the default value for this actuator’s rotor inertia. See reflected_inertia.
- SetGearRatio(self: pydrake.multibody.tree.JointActuator, context: pydrake.systems.framework.Context, gear_ratio: float) None
Sets the associated gear ratio value for this actuator in
context
. See reflected_inertia.
- SetRotorInertia(self: pydrake.multibody.tree.JointActuator, context: pydrake.systems.framework.Context, rotor_inertia: float) None
Sets the associated rotor inertia value for this actuator in
context
. See reflected_inertia.
- template pydrake.multibody.tree.JointActuator_
Instantiations:
JointActuator_[float]
,JointActuator_[AutoDiffXd]
,JointActuator_[Expression]
- class pydrake.multibody.tree.JointActuator_[AutoDiffXd]
The JointActuator class is mostly a simple bookkeeping structure to represent an actuator acting on a given Joint. It helps to flag whether a given Joint is actuated or not so that MultibodyTree clients can apply forces on actuated joints through their actuators, see AddInOneForce().
- __init__(*args, **kwargs)
- calc_reflected_inertia(self: pydrake.multibody.tree.JointActuator_[AutoDiffXd], context: pydrake.systems.framework.Context_[AutoDiffXd]) pydrake.autodiffutils.AutoDiffXd
Calculates the reflected inertia value for this actuator in
context
. See reflected_inertia. Note that this ONLY depends on the Parameters in the context; it does not depend on time, input, state, etc.
- default_gear_ratio(self: pydrake.multibody.tree.JointActuator_[AutoDiffXd]) float
Gets the default value for this actuator’s gear ratio. See reflected_inertia.
- default_reflected_inertia(self: pydrake.multibody.tree.JointActuator_[AutoDiffXd]) float
Returns the default value for this actuator’s reflected inertia. It is calculated as ρ²⋅Iᵣ, where ρ is the default gear ratio and Iᵣ is the default rotor inertia for this actuator. See reflected_inertia.
- default_rotor_inertia(self: pydrake.multibody.tree.JointActuator_[AutoDiffXd]) float
Gets the default value for this actuator’s rotor inertia. See reflected_inertia.
- effort_limit(self: pydrake.multibody.tree.JointActuator_[AutoDiffXd]) float
Returns the actuator effort limit.
- gear_ratio(self: pydrake.multibody.tree.JointActuator_[AutoDiffXd], context: pydrake.systems.framework.Context_[AutoDiffXd]) pydrake.autodiffutils.AutoDiffXd
Returns the associated gear ratio value for this actuator, stored in
context
. See reflected_inertia. Note that this ONLY depends on the Parameters in the context; it does not depend on time, input, state, etc.
- get_actuation_vector(self: pydrake.multibody.tree.JointActuator_[AutoDiffXd], u: numpy.ndarray[object[m, 1]]) numpy.ndarray[object[m, 1]]
Gets the actuation values for
this
actuator from the actuation vector u for the entire plant model.- Returns
a reference to a nv-dimensional vector, where nv is the number of velocity variables of joint().
- get_controller_gains(self: pydrake.multibody.tree.JointActuator_[AutoDiffXd]) pydrake.multibody.tree.PdControllerGains
Returns a reference to the controller gains for this actuator.
- Precondition:
has_controller() is
True
.
- GetParentPlant(self: pydrake.multibody.tree.JointActuator_[AutoDiffXd]) drake::multibody::MultibodyPlant<Eigen::AutoDiffScalar<Eigen::Matrix<double, -1, 1, 0, -1, 1> > >
- has_controller(self: pydrake.multibody.tree.JointActuator_[AutoDiffXd]) bool
Returns
True
if controller gains have been specified with a call to set_controller_gains().
- index(self: pydrake.multibody.tree.JointActuator_[AutoDiffXd]) pydrake.multibody.tree.JointActuatorIndex
- input_start(self: pydrake.multibody.tree.JointActuator_[AutoDiffXd]) int
Returns the index to the first element for this joint actuator / within the vector of actuation inputs for the full multibody / system.
- Raises
RuntimeError if the MultibodyTree model is not finalized. –
- joint(self: pydrake.multibody.tree.JointActuator_[AutoDiffXd]) pydrake.multibody.tree.Joint_[AutoDiffXd]
Returns a reference to the joint actuated by this JointActuator.
- model_instance(self: pydrake.multibody.tree.JointActuator_[AutoDiffXd]) pydrake.multibody.tree.ModelInstanceIndex
- name(self: pydrake.multibody.tree.JointActuator_[AutoDiffXd]) str
Returns the name of the actuator.
- num_inputs(self: pydrake.multibody.tree.JointActuator_[AutoDiffXd]) int
Returns the number of inputs associated with this actuator.
- Raises
RuntimeError if the MultibodyTree model is not finalized. –
- rotor_inertia(self: pydrake.multibody.tree.JointActuator_[AutoDiffXd], context: pydrake.systems.framework.Context_[AutoDiffXd]) pydrake.autodiffutils.AutoDiffXd
Returns the associated rotor inertia value for this actuator, stored in
context
. See reflected_inertia. Note that this ONLY depends on the Parameters in the context; it does not depend on time, input, state, etc.
- set_actuation_vector(self: pydrake.multibody.tree.JointActuator_[AutoDiffXd], u_actuator: numpy.ndarray[object[m, 1]], u: Optional[numpy.ndarray[object[m, 1], flags.writeable]]) None
Given the actuation values
u_actuator
forthis
actuator, updates the actuation vectoru
for the entire multibody model to which this actuator belongs to.- Parameter
u_actuator
: Actuation values for
this
actuator. It must be of size equal to num_inputs(). For units and sign conventions refer to the specific Joint sub-class documentation.- Parameter
u
: Actuation values for the entire plant model to which
this
actuator belongs to. The actuation value inu
forthis
actuator must be found at offset input_start(). Only values corresponding to this actuator are changed.
- Raises
RuntimeError if u_actuator.size() != this->num_inputs() –
RuntimeError if u is nullptr. –
RuntimeError if ``u.size() != –
this->GetParentPlant()num_actuated_dofs()``. –
- Parameter
- set_controller_gains(self: pydrake.multibody.tree.JointActuator_[AutoDiffXd], gains: pydrake.multibody.tree.PdControllerGains) None
Set controller gains for this joint actuator. This enables the modeling of a simple PD controller of the form: ũ = -Kp⋅(q − qd) - Kd⋅(v − vd) + u_ff u = max(−e, min(e, ũ)) where qd and vd are the desired configuration and velocity for joint(), Kp and Kd are the proportional and derivative gains specified in
gains
, u_ff is the feedforward actuation ande
corresponds to effort_limit().For simulation, feedforward actuation can be provided through MultibodyPlant::get_actuation_input_port(). Desired configuration and velocity are specified through MultibodyPlant::get_desired_state_input_port().
- Precondition:
The MultibodyPlant associated with this actuator has not yet allocated a Context. In other words, although gains can be changed post-Finalize, they cannot be changed during simulation.
- Raises
iff the proportional gain is not strictly positive or if the –
derivative gain is negative. –
iff the owning MultibodyPlant is finalized and no gains were set –
pre-finalize. In other words, editing gains post-finalize is –
fine, but adding gains post-finalize is an error. See –
MultibodyPlant::Finalize() –
- set_default_gear_ratio(self: pydrake.multibody.tree.JointActuator_[AutoDiffXd], gear_ratio: float) None
Sets the default value for this actuator’s gear ratio. See reflected_inertia.
- set_default_rotor_inertia(self: pydrake.multibody.tree.JointActuator_[AutoDiffXd], rotor_inertia: float) None
Sets the default value for this actuator’s rotor inertia. See reflected_inertia.
- SetGearRatio(self: pydrake.multibody.tree.JointActuator_[AutoDiffXd], context: pydrake.systems.framework.Context_[AutoDiffXd], gear_ratio: pydrake.autodiffutils.AutoDiffXd) None
Sets the associated gear ratio value for this actuator in
context
. See reflected_inertia.
- SetRotorInertia(self: pydrake.multibody.tree.JointActuator_[AutoDiffXd], context: pydrake.systems.framework.Context_[AutoDiffXd], rotor_inertia: pydrake.autodiffutils.AutoDiffXd) None
Sets the associated rotor inertia value for this actuator in
context
. See reflected_inertia.
- class pydrake.multibody.tree.JointActuator_[Expression]
The JointActuator class is mostly a simple bookkeeping structure to represent an actuator acting on a given Joint. It helps to flag whether a given Joint is actuated or not so that MultibodyTree clients can apply forces on actuated joints through their actuators, see AddInOneForce().
- __init__(*args, **kwargs)
- calc_reflected_inertia(self: pydrake.multibody.tree.JointActuator_[Expression], context: pydrake.systems.framework.Context_[Expression]) pydrake.symbolic.Expression
Calculates the reflected inertia value for this actuator in
context
. See reflected_inertia. Note that this ONLY depends on the Parameters in the context; it does not depend on time, input, state, etc.
- default_gear_ratio(self: pydrake.multibody.tree.JointActuator_[Expression]) float
Gets the default value for this actuator’s gear ratio. See reflected_inertia.
- default_reflected_inertia(self: pydrake.multibody.tree.JointActuator_[Expression]) float
Returns the default value for this actuator’s reflected inertia. It is calculated as ρ²⋅Iᵣ, where ρ is the default gear ratio and Iᵣ is the default rotor inertia for this actuator. See reflected_inertia.
- default_rotor_inertia(self: pydrake.multibody.tree.JointActuator_[Expression]) float
Gets the default value for this actuator’s rotor inertia. See reflected_inertia.
- effort_limit(self: pydrake.multibody.tree.JointActuator_[Expression]) float
Returns the actuator effort limit.
- gear_ratio(self: pydrake.multibody.tree.JointActuator_[Expression], context: pydrake.systems.framework.Context_[Expression]) pydrake.symbolic.Expression
Returns the associated gear ratio value for this actuator, stored in
context
. See reflected_inertia. Note that this ONLY depends on the Parameters in the context; it does not depend on time, input, state, etc.
- get_actuation_vector(self: pydrake.multibody.tree.JointActuator_[Expression], u: numpy.ndarray[object[m, 1]]) numpy.ndarray[object[m, 1]]
Gets the actuation values for
this
actuator from the actuation vector u for the entire plant model.- Returns
a reference to a nv-dimensional vector, where nv is the number of velocity variables of joint().
- get_controller_gains(self: pydrake.multibody.tree.JointActuator_[Expression]) pydrake.multibody.tree.PdControllerGains
Returns a reference to the controller gains for this actuator.
- Precondition:
has_controller() is
True
.
- GetParentPlant(self: pydrake.multibody.tree.JointActuator_[Expression]) drake::multibody::MultibodyPlant<drake::symbolic::Expression>
- has_controller(self: pydrake.multibody.tree.JointActuator_[Expression]) bool
Returns
True
if controller gains have been specified with a call to set_controller_gains().
- index(self: pydrake.multibody.tree.JointActuator_[Expression]) pydrake.multibody.tree.JointActuatorIndex
- input_start(self: pydrake.multibody.tree.JointActuator_[Expression]) int
Returns the index to the first element for this joint actuator / within the vector of actuation inputs for the full multibody / system.
- Raises
RuntimeError if the MultibodyTree model is not finalized. –
- joint(self: pydrake.multibody.tree.JointActuator_[Expression]) pydrake.multibody.tree.Joint_[Expression]
Returns a reference to the joint actuated by this JointActuator.
- model_instance(self: pydrake.multibody.tree.JointActuator_[Expression]) pydrake.multibody.tree.ModelInstanceIndex
- name(self: pydrake.multibody.tree.JointActuator_[Expression]) str
Returns the name of the actuator.
- num_inputs(self: pydrake.multibody.tree.JointActuator_[Expression]) int
Returns the number of inputs associated with this actuator.
- Raises
RuntimeError if the MultibodyTree model is not finalized. –
- rotor_inertia(self: pydrake.multibody.tree.JointActuator_[Expression], context: pydrake.systems.framework.Context_[Expression]) pydrake.symbolic.Expression
Returns the associated rotor inertia value for this actuator, stored in
context
. See reflected_inertia. Note that this ONLY depends on the Parameters in the context; it does not depend on time, input, state, etc.
- set_actuation_vector(self: pydrake.multibody.tree.JointActuator_[Expression], u_actuator: numpy.ndarray[object[m, 1]], u: Optional[numpy.ndarray[object[m, 1], flags.writeable]]) None
Given the actuation values
u_actuator
forthis
actuator, updates the actuation vectoru
for the entire multibody model to which this actuator belongs to.- Parameter
u_actuator
: Actuation values for
this
actuator. It must be of size equal to num_inputs(). For units and sign conventions refer to the specific Joint sub-class documentation.- Parameter
u
: Actuation values for the entire plant model to which
this
actuator belongs to. The actuation value inu
forthis
actuator must be found at offset input_start(). Only values corresponding to this actuator are changed.
- Raises
RuntimeError if u_actuator.size() != this->num_inputs() –
RuntimeError if u is nullptr. –
RuntimeError if ``u.size() != –
this->GetParentPlant()num_actuated_dofs()``. –
- Parameter
- set_controller_gains(self: pydrake.multibody.tree.JointActuator_[Expression], gains: pydrake.multibody.tree.PdControllerGains) None
Set controller gains for this joint actuator. This enables the modeling of a simple PD controller of the form: ũ = -Kp⋅(q − qd) - Kd⋅(v − vd) + u_ff u = max(−e, min(e, ũ)) where qd and vd are the desired configuration and velocity for joint(), Kp and Kd are the proportional and derivative gains specified in
gains
, u_ff is the feedforward actuation ande
corresponds to effort_limit().For simulation, feedforward actuation can be provided through MultibodyPlant::get_actuation_input_port(). Desired configuration and velocity are specified through MultibodyPlant::get_desired_state_input_port().
- Precondition:
The MultibodyPlant associated with this actuator has not yet allocated a Context. In other words, although gains can be changed post-Finalize, they cannot be changed during simulation.
- Raises
iff the proportional gain is not strictly positive or if the –
derivative gain is negative. –
iff the owning MultibodyPlant is finalized and no gains were set –
pre-finalize. In other words, editing gains post-finalize is –
fine, but adding gains post-finalize is an error. See –
MultibodyPlant::Finalize() –
- set_default_gear_ratio(self: pydrake.multibody.tree.JointActuator_[Expression], gear_ratio: float) None
Sets the default value for this actuator’s gear ratio. See reflected_inertia.
- set_default_rotor_inertia(self: pydrake.multibody.tree.JointActuator_[Expression], rotor_inertia: float) None
Sets the default value for this actuator’s rotor inertia. See reflected_inertia.
- SetGearRatio(self: pydrake.multibody.tree.JointActuator_[Expression], context: pydrake.systems.framework.Context_[Expression], gear_ratio: pydrake.symbolic.Expression) None
Sets the associated gear ratio value for this actuator in
context
. See reflected_inertia.
- SetRotorInertia(self: pydrake.multibody.tree.JointActuator_[Expression], context: pydrake.systems.framework.Context_[Expression], rotor_inertia: pydrake.symbolic.Expression) None
Sets the associated rotor inertia value for this actuator in
context
. See reflected_inertia.
- class pydrake.multibody.tree.JointActuatorIndex
Type used to identify actuators by index within a multibody plant.
- __init__(*args, **kwargs)
Overloaded function.
__init__(self: pydrake.multibody.tree.JointActuatorIndex) -> None
Default constructor; the result is an invalid index. This only exists to serve applications which require a default constructor.
__init__(self: pydrake.multibody.tree.JointActuatorIndex, arg0: int) -> None
Construction from a non-negative
int
value. The value must lie in the range of [0, 2³¹). Constructor only promises to test validity in Debug build.
- is_valid(self: pydrake.multibody.tree.JointActuatorIndex) bool
Reports if the index is valid–the only operation on an invalid index that doesn’t throw an exception in Debug builds.
- class pydrake.multibody.tree.JointIndex
Type used to identify joints by index within a multibody plant.
- __init__(*args, **kwargs)
Overloaded function.
__init__(self: pydrake.multibody.tree.JointIndex) -> None
Default constructor; the result is an invalid index. This only exists to serve applications which require a default constructor.
__init__(self: pydrake.multibody.tree.JointIndex, arg0: int) -> None
Construction from a non-negative
int
value. The value must lie in the range of [0, 2³¹). Constructor only promises to test validity in Debug build.
- is_valid(self: pydrake.multibody.tree.JointIndex) bool
Reports if the index is valid–the only operation on an invalid index that doesn’t throw an exception in Debug builds.
- class pydrake.multibody.tree.LinearBushingRollPitchYaw
Bases:
pydrake.multibody.tree.ForceElement
This ForceElement models a massless flexible bushing that connects a frame A of a link (body) L0 to a frame C of a link (body) L1. The bushing can apply a torque and force due to stiffness (spring) and dissipation (damper) properties. Frame B is the bushing frame whose origin Bo is halfway between Ao (A’s origin) and Co (C’s origin) and whose unit vectors 𝐁𝐱, 𝐁𝐲, 𝐁𝐳 are “halfway” (in an angle-axis sense) between the unit vectors of frame A and frame C. Frame B is a “floating” frame in the sense that it is calculated from the position and orientation of frames A and C (B is not welded to the bushing).
@image html drake/multibody/tree/images/LinearBushingRollPitchYaw.png width=80%
The set of forces on frame C from the bushing is equivalent to a torque 𝐭 on frame C and a force 𝐟 applied to a point Cp of C. The set of forces on frame A from the bushing is equivalent to a torque −𝐭 on frame A and a force −𝐟 applied to a point Ap of A. Points Ap and Cp are coincident with Bo (frame B’s origin).
This “quasi-symmetric” bushing force/torque model was developed at Toyota Research Institute and has advantages compared to traditional bushing models because it employs a bushing-centered “symmetric” frame B and it ensures the moment of −𝐟 on A about Ao is equal to the moment of 𝐟 on C about Co. Traditional models differ as they lack a “symmetric” frame B and apply −𝐟 at Ao, which means the moment of −𝐟 on A about Ao is always zero. Note: This bushing model is not fully symmetric since the orientation between frames A and C is parameterized with roll-pitch-yaw angles [q₀ q₁ q₂]. Since these angles have an inherent sequence, they are not mathematically symmetric.
The torque model depends on spring-damper “gimbal” torques
τ ≜ [τ₀ τ₁ τ₂]
which themselves depend on roll-pitch-yaw anglesq ≜ [q₀ q₁ q₂]
and ratesq̇ = [q̇₀ q̇₁ q̇₂]
via a diagonal torque-stiffness matrix K₀₁₂ and a diagonal torque-damping matrix D₀₁₂ asClick to expand C++ code...
⌈ τ₀ ⌉ ⌈k₀ 0 0⌉ ⌈ q₀ ⌉ ⌈d₀ 0 0⌉ ⌈ q̇₀ ⌉ τ ≜ | τ₁ | = − | 0 k₁ 0| | q₁ | − | 0 d₁ 0| | q̇₁ | ⌊ τ₂ ⌋ ⌊ 0 0 k₂⌋ ⌊ q₂ ⌋ ⌊ 0 0 d₂⌋ ⌊ q̇₂ ⌋
where k₀, k₁, k₂ and d₀, d₁, d₂ are torque stiffness and damping constants and must have non-negative values.
Note
τ does not represent a vector expressed in one frame. Instead it is regarded as a 3x1 array of torque scalars associated with roll-pitch yaw.
Note
As discussed in the Advanced section below, τ is not 𝐭
(τ ≠ 𝐭)
.Note
This is a “linear” bushing model as gimbal torque τ varies linearly with q and q̇ as τ = τᴋ + τᴅ where τᴋ = −K₀₁₂ ⋅ q and τᴅ = −D₀₁₂ ⋅ q̇.
The bushing model for the net force 𝐟 on frame C from the bushing depends on scalars x, y, z which are defined so 𝐫 (the position vector from Ao to Co) can be expressed in frame B as
𝐫 ≜ p_AoCo = [x y z]ʙ = x 𝐁𝐱 + y 𝐁𝐲 + z 𝐁𝐳
. The model for 𝐟 uses a diagonal force-stiffness matrix Kxyᴢ, a diagonal force-damping matrix Dxyᴢ, and defines fx, fy, fz so𝐟 = [fx fy fz]ʙ
.Click to expand C++ code...
⌈ fx ⌉ ⌈kx 0 0⌉ ⌈ x ⌉ ⌈dx 0 0⌉ ⌈ ẋ ⌉ | fy | = − | 0 ky 0| | y | − | 0 dy 0| | ẏ | ⌊ fz ⌋ ⌊ 0 0 kz⌋ ⌊ z ⌋ ⌊ 0 0 dz⌋ ⌊ ż ⌋
where kx, ky, kz and dx, dy, dz are force stiffness and damping constants and must have non-negative values.
Note
This is a “linear” bushing model as the force 𝐟 varies linearly with 𝐫 and 𝐫̇̇ as 𝐟 = 𝐟ᴋ + 𝐟ᴅ where 𝐟ᴋ = −Kxyz ⋅ 𝐫 and 𝐟ᴅ = −Dxyz ⋅ 𝐫̇̇.
This bushing’s constructor sets the torque stiffness/damping constants
[k₀ k₁ k₂]
and[d₀ d₁ d₂]
and the force stiffness/damping constants[kx ky kz]
and[dx dy dz]
. The examples below demonstrate how to model various joints that have a flexible (e.g., rubber) mount. The damping values below with ? may be set to 0 or a reasonable positive number.Bushing type | torque constants | force constants ——————————–|:--------------------|:—————— z-axis revolute joint | k₀₁₂ =
[k₀ k₁ 0]
| kxyz =[kx ky kz]
^ | d₀₁₂ =[d₀ d₁ ?]
| dxyz =[dx dy dz]
x-axis prismatic joint | k₀₁₂ =[k₀ k₁ k₂]
| kxyz =[0 ky kz]
^ | d₀₁₂ =[d₀ d₁ d₂]
| dxyz =[? dy dz]
Ball and socket joint | k₀₁₂ =[0 0 0]
| kxyz =[kx ky kz]
^ | d₀₁₂ =[? ? ?]
| dxyz =[dx dy dz]
Weld/fixed joint | k₀₁₂ =[k₀ k₁ k₂]
| kxyz =[kx ky kz]
^ | d₀₁₂ =[d₀ d₁ d₂]
| dxyz =[dx dy dz]
Angles q₀, q₁, q₂ are calculated from frame C’s orientation relative to frame A, with
[−π < q₀ ≤ π, −π/2 ≤ q₁ ≤ π/2, −π < q₂ ≤ π]
, hence, there is no angle wrapping and torque stiffness has a limited range. Gimbal torques τ can be discontinuous if one of q₀, q₁, q₂ is discontinuous and its associated torque spring constant is nonzero. For example, τ₂ is discontinuous ifk₂ ≠ 0
and the bushing has a large rotation so q₂ jumps from≈ −π to π
. τ can also be discontinuous if one of q̇₀, q̇₁, q̇₂ is discontinuous and its associated torque damper constant is nonzero. For example, τ₀ is discontinuous ifd₀ ≠ 0
and q̇₀ is undefined (which occurs whenpitch = q₁ = π/2
). Note: Due to the relationship of 𝐭 to τ shown below, 𝐭 is discontinuous if τ is discontinuous.As shown below, there are multiple ways to estimate torque and force stiffness and damping constants. Use a method or combination of methods appropriate for your application. For example, some methods are more useful for a real physical bushing whereas other methods (called “penalty methods”) can be more useful when replacing an ideal joint (such as a revolute or fixed/weld joint) with a bushing.
Consider a penalty method if you want a bushing to substitute for a “hard” constraint (e.g., an ideal joint). Since a bushing is inherently compliant it will violate a hard constraint somewhat. The stiffer the bushing, the more accurately it enforces the hard constraint, but at a cost of more computational time. To balance accuracy versus time, consider your tolerance for constraint errors. For example, is it OK for your bushing to displace xₘₐₓ = 1 mm for an estimated Fxₘₐₓ = 100 N? Also, one way to choose a force damping constant dx is by choosing a “reasonably small” settling time tₛ, where settling time tₛ is the interval of time for a system to settle to within 1% (0.01) of an equilibrium solution). Is tₛ = 0.01 s negligible for a robot arm with a 10 s reach maneuver?
**** How to choose a torque stiffness constant k₀ or damping constant d₀. The estimate of stiffness k₀ depends on whether you are modeling a physical bushing (consider stiffness methods 1 or 2 below) or whether you are using a bushing to replace an ideal joint such as a revolute or fixed/weld joint (consider stiffness “penalty methods” 3 or 4 below). 1. Use a static experiment, e.g., apply a known moment load Mx, measure the associated angular displacement Δq (radians), and estimate k₀ = Mx / Δq. 2. Use FEA (finite element analysis) software to estimate k₀. 3. Pick a desired maximum angular displacement qₘₐₓ, estimate a maximum moment load Mxₘₐₓ, and estimate
k₀ = Mxₘₐₓ / qₘₐₓ
(units of N*m/rad). 4. Choose a characteristic moment of inertia I₀ (directionally dependent), choose a desired angular frequency ωₙ > 0 (in rad/s) and estimatek₀ = I₀ ωₙ²
(units of N*m/rad).The estimate of damping d₀ depends on whether you are modeling a physical bushing (consider damping method 1 below) or whether you are using a bushing to enforce a constraint (consider damping methods 2 or 3 below). 1. Use experiments to estimate a damping ratio ζ and settling time tₛ. Compute “undamped natural frequency” ωₙ from ζ and tₛ (as shown below in the Advanced section), then
d₀ = 2 ζ k₀ / ωₙ
(units of N*m*s/rad). 2. Choose a damping ratio ζ (e.g., ζ = 1, critical damping) and a desired settling time tₛ, calculate ωₙ (as shown below in the Advanced section), thend₀ = 2 ζ k₀ / ωₙ
(units of N*m*s/rad). 3. Choose a damping ratio ζ (e.g., ζ = 1, critical damping), estimate a characteristic moment of inertia and calculated₀ = 2 ζ √(I₀ k₀)
.Refer to Advanced_bushing_stiffness_and_damping “Advanced bushing stiffness and damping” for more details.
**** How to choose a force stiffness constant kx or damping constant dx. The estimate of stiffness kx depends on whether you are modeling a real bushing (consider stiffness methods 1 or 2 below) or whether you are using a bushing to replace an ideal joint such as a revolute or fixed/weld joint (consider stiffness “penalty methods” 3 or 4 below). 1. Use a static experiment, e.g., apply a known force load Fx, measure the associated displacement (stretch) Δx (in meters), and estimate kx = Fx / Δx. 2. Use FEA (finite element analysis) software to estimate kx (units of N/m). 3. Pick a desired maximum displacement xₘₐₓ, estimate a maximum force load Fxₘₐₓ, and estimate
kx = Fxₘₐₓ / xₘₐₓ
(units of N/m). 4. Choose a characteristic mass m (which may be directionally dependent), choose a desired angular frequency ωₙ > 0 (in rad/s) and estimatekx = m ωₙ²
(units of N/m).The estimate of damping dx depends on whether you are modeling a physical bushing (consider damping method 1 below) or whether you are using a bushing to enforce a constraint (consider damping methods 2 or 3 below). 1. Use experiments to estimate a damping ratio ζ and settling time tₛ. Compute “undamped natural frequency” ωₙ from ζ and tₛ (as shown below in the Advanced section), then
dx = 2 ζ kx / ωₙ
(units of N*s/m). 2. Choose a damping ratio ζ (e.g., ζ = 1, critical damping) and a desired settling time tₛ, calculate ωₙ (as shown below in the Advanced section), thendx = 2 ζ kx / ωₙ
(units of N*s/m). 3. Choose a damping ratio ζ (e.g., ζ = 1, critical damping), estimate a characteristic mass m and calculatedx = 2 ζ √(m kx)
(units of N*s/m).Refer to Advanced_bushing_stiffness_and_damping “Advanced bushing stiffness and damping” for more details.
**** Advanced: Relationship of 𝐭 to τ. To understand how “gimbal torques” τ relate to 𝐭, it helps to remember that the RollPitchYaw class documentation states that a Space-fixed (extrinsic) X-Y-Z rotation with roll-pitch-yaw angles [q₀ q₁ q₂] is equivalent to a Body-fixed (intrinsic) Z-Y-X rotation by yaw-pitch-roll angles [q₂ q₁ q₀]. In the context of “gimbal torques”, the Body-fixed Z-Y-X rotation sequence with angles [q₂ q₁ q₀] is physical meaningful as it produces torques associated with successive frames in a gimbal as τ₂ 𝐀𝐳, τ₁ 𝐏𝐲, τ₀ 𝐂𝐱, where each of 𝐀𝐳, 𝐏𝐲, 𝐂𝐱 are unit vectors associated with a frame in the yaw-pitch-roll rotation sequence and 𝐏𝐲 is a unit vector of the “pitch” intermediate frame. As described earlier, torque 𝐭 is the moment of the bushing forces on frame C about Cp. Scalars tx, ty, tz are defined so 𝐭 can be expressed
𝐭 = [tx ty tz]ᴀ = tx 𝐀𝐱 + ty 𝐀𝐲 + tz 𝐀𝐳
. As shown in code documentation, the relationship of [tx ty tz] to [τ₀ τ₁ τ₂] was found by equating 𝐭’s power to τ’s power as 𝐭 ⋅ w_AC = τ ⋅ q̇.Click to expand C++ code...
⌈ tx ⌉ ⌈ τ₀ ⌉ ⌈ cos(q₂)/cos(q₁) sin(q₂)/cos(q₁) 0 ⌉ | ty | = Nᵀ | τ₁ | where N = | −sin(q2) cos(q2) 0 | ⌊ tz ⌋ ⌊ τ₂ ⌋ ⌊ cos(q₂)*tan(q₁) sin(q₂)*tan(q₁) 1 ⌋
**** Advanced: More on how to choose bushing stiffness and damping constants. The basics on how to choose bushing stiffness and damping constants are at: - Basic_bushing_torque_stiffness_and_damping “How to choose torque stiffness and damping constants” - Basic_bushing_force_stiffness_and_damping “How to choose force stiffness and damping constants”
The list below provides more detail on: The performance tradeoff between high stiffness and long simulation time; loads that affect estimates of Mxₘₐₓ or Fxₘₐₓ; and how a linear 2ⁿᵈ-order ODE provides insight on how to experimentally determine stiffness and damping constants. - Stiffness [k₀ k₁ k₂] and [kx ky kz] affect simulation time and accuracy. Generally, a stiffer bushing better resembles an ideal joint (e.g., a revolute joint or fixed/weld joint). However (depending on integrator), a stiffer bushing usually increases numerical integration time. - An estimate for a maximum load Mxₘₐₓ or Fxₘₐₓ accounts for gravity forces, applied forces, inertia forces (centripetal, Coriolis, gyroscopic), etc. - One way to determine physical stiffness and damping constants is through the mathematical intermediaries ωₙ (units of rad/s) and ζ (no units). The constant ωₙ (called “undamped natural frequency” or “angular frequency”) and constant ζ (called “damping ratio”) relate to the physical constants mass m, damping constant dx, and stiffness constant kx via the following prototypical linear constant-coefficient 2ⁿᵈ-order ODEs.
Click to expand C++ code...
m ẍ + dx ẋ + kx x = 0 or alternatively as ẍ + 2 ζ ωₙ ẋ + ωₙ² x = 0 where ωₙ² = kx/m, ζ = dx / (2 √(m kx))
ωₙ and ζ also appear in the related ODEs for rotational systems, namely
Click to expand C++ code...
I₀ q̈ + d₀ q̇ + k₀ q = 0 or alternatively as q̈ + 2 ζ ωₙ q̇ + ωₙ² q = 0 where ωₙ² = k₀/I₀, ζ = d₀ / (2 √(I₀ k₀))
One way to determine ωₙ is from settling time tₛ which approximates the time for a system to settle to within a specified settling ratio of an equilibrium solutions. Typical values for settling ratio are 1% (0.01), 2% (0.02), 5% (0.05), and 10% (0.10). - When ζ < 0.7 (underdamped), a commonly used approximation is ωₙ ≈ -ln(settling_ratio) / (ζ tₛ) which for settling ratios 0.01 and 0.05 give ωₙ ≈ 4.6 / (ζ tₛ) and ωₙ ≈ 3 / (ζ tₛ). Another commonly used approximation is ωₙ ≈ -ln(settling_ratio √(1- ζ²)) / (ζ tₛ). See https://en.wikipedia.org/wiki/Settling_time or the book Modern Control Engineering by Katsuhiko Ogata. Although these approximate formulas for ωₙ are common, they are somewhat inaccurate. Settling time for underdamped systems is discontinuous and requires solving a nonlinear algebraic equation (an iterative process). For more information, see http://www.scielo.org.co/pdf/rfiua/n66/n66a09.pdf [Ramos-Paja, et. al 2012], “Accurate calculation of settling time in second order systems: a photovoltaic application”. Another reference is https://courses.grainger.illinois.edu/ece486/sp2020/laboratory/docs/lab2/estimates.html - When ζ ≈ 1 (critically damped), ωₙ is determined by choosing a settling ratio and then solving for (ωₙ tₛ) via the nonlinear algebraic equation (1 + ωₙ tₛ)*exp(-ωₙ tₛ) = settling_ratio. Settling ratio | ωₙ ————– | ————- 0.01 | 6.64 / tₛ 0.02 | 5.83 / tₛ 0.05 | 4.74 / tₛ 0.10 | 3.89 / tₛ See https://electronics.stackexchange.com/questions/296567/over-and-critically-damped-systems-settling-time - When ζ ≥ 1.01 (overdamped), ωₙ ≈ -ln(2 settling_ratio sz/s₂) / (s₁ tₛ) where sz = √(ζ² - 1), s₁ = ζ - sz, s₂ = ζ + sz. The derivation and approximation error estimates for this overdamped settling time formula is ApproximateOverdampedSettlingTime “below”.
For a real physical bushing, an experiment is one way to estimate damping
constants. For example, to estimate a torque damping constant d₀ associated with underdamped vibrations (damping ratio 0 < ζ < 1), attach the bushing to a massive rod, initially displace the rod by angle Δq, release the rod and measure q(t). From the q(t) measurement, estimate decay ratio (the ratio of successive peak heights above the final steady-state value) calculate logarithmic decrement δ = -ln(decay_ratio), calculate damping ratio ζ = √(δ² / (4π² + δ²)), then calculate d₀ using d₀ = 2 ζ √(I₀ k₀) or d₀ = 2 ζ k₀ / ωₙ. For more information, see https://en.wikipedia.org/wiki/Damping_ratio#Logarithmic_decrement
**** Derivation: Approximate formula for overdamped settling time. Since a literature reference for this formula was not found, the derivation below was done at TRI (it has not been peer reviewed). This formula results from the “dominant pole” solution in the prototypical constant-coefficient linear 2ⁿᵈ-order ODE. For ẋ(0) = 0, mathematics shows poles p₁ = -ωₙ s₁, p₂ = -ωₙ s₂, where sz = √(ζ² - 1), s₁ = ζ - sz, s₂ = ζ + sz. and
Click to expand C++ code...
x(t) / x(0) = p₂/(p₂-p₁) exp(p₁ t) - p₁/(p₂-p₁) exp(p₂ t) = s₂/(s₂-s₁) exp(p₁ t) - s₁/(s₂-s₁) exp(p₂ t) = k/( k-1 ) exp(p₁ t) - 1/( k-1 ) exp(p₂ t) where k = s₂ / s₁ ≈ k/( k-1 ) exp(p₁ t) since p₁ > p₂
Note: k = s₂ / s₁ is real, k > 0, s₂ = k s₁, and p₁ > p₂ (p₁ is less negative then p₂), so exp(p₁ t) decays to zero slower than exp(p₂ t) and exp(p₁ t) ≫ exp(p₂ t) for sufficiently large t. Hence we assume exp(p₂ t) ≈ 0 (which is why p₁ is called the “dominant pole”). Next,
Click to expand C++ code...
k/(k - 1) = s₂ / s₁ / (s₂/s₁ -1) = s₂ / (s₂ - s₁) = s₂ / (2 sz), so x(t) / x(0) ≈ s₂ / (2 sz) exp(-s₁ ωₙ t), hence settling_ratio ≈ s₂ / (2 sz) exp(-s₁ ωₙ tₛ), finally ωₙ ≈ -ln(settling_ratio 2 sz / s₂) / (s₁ tₛ)
The table below shows that there is little error in this approximate formula for various settling ratios and ζ, particularly for ζ ≥ 1.1. For 1.0 ≤ ζ < 1.1, the critical damping estimates of ωₙ work well. Settling ratio | ζ = 1.01 | ζ = 1.1 | ζ = 1.2 | ζ = 1.3 | ζ = 1.5 ————– | ——– | ——- | ——- | ——- | ——– 0.01 | 1.98% | 0.005% | 2.9E-5% | 1.6E-7% | 2.4E-12% 0.02 | 2.91% | 0.016% | 1.8E-4% | 2.1E-6% | 1.6E-10% 0.05 | 5.10% | 0.076% | 2.3E-3% | 7.0E-5% | 4.4E-8% 0.10 | 8.28% | 0.258% | 1.6E-2% | 1.0E-3% | 3.3E-6% Note: There is a related derivation in the reference below, however, it needlessly makes the oversimplified approximation k/(k - 1) ≈ 1. https://electronics.stackexchange.com/questions/296567/over-and-critically-damped-systems-settling-time
Note
The complete theory for this bushing is documented in the source code. Please look there if you want more information.
- Template parameter
T
: The underlying scalar type. Must be a valid Eigen scalar.
See also
math::RollPitchYaw for definitions of roll, pitch, yaw
[q₀ q₁ q₂]
.Note
Per issue #12982, do not directly or indirectly call the following methods as they have not yet been implemented and throw an exception: CalcPotentialEnergy(), CalcConservativePower(), CalcNonConservativePower().
Note
This class is templated; see
LinearBushingRollPitchYaw_
for the list of instantiations.- __init__(self: pydrake.multibody.tree.LinearBushingRollPitchYaw, frameA: pydrake.multibody.tree.Frame, frameC: pydrake.multibody.tree.Frame, torque_stiffness_constants: numpy.ndarray[numpy.float64[3, 1]], torque_damping_constants: numpy.ndarray[numpy.float64[3, 1]], force_stiffness_constants: numpy.ndarray[numpy.float64[3, 1]], force_damping_constants: numpy.ndarray[numpy.float64[3, 1]]) None
Construct a LinearBushingRollPitchYaw B that connects frames A and C, where frame A is welded to a link L0 and frame C is welded to a link L1.
- Parameter
frameA
: frame A of link (body) L0 that connects to bushing B.
- Parameter
frameC
: frame C of link (body) L1 that connects to bushing B.
- Parameter
torque_stiffness_constants
: [k₀ k₁ k₂]
multiply the roll-pitch-yaw angles[q₀ q₁ q₂]
to produce the spring portion of the “gimbal” torques τ₀, τ₁, τ₂. The SI units ofk₀, k₁, k₂
are N*m/rad.- Parameter
torque_damping_constants
: [d₀ d₁ d₂]
multiply the roll-pitch-yaw rates[q̇₀ q̇₁ q̇₂]
to produce the damper portion of the “gimbal” torques τ₀, τ₁, τ₂. The SI units ofd₀, d₁, d₂
are N*m*s/rad.- Parameter
force_stiffness_constants
: [kx ky kz]
multiply the bushing displacements[x y z]
to form 𝐟ᴋ, the spring portion of the force 𝐟 = [fx fy fz]ʙ. The SI units ofkx, ky, kz
are N/m.- Parameter
force_damping_constants
: [dx dy dz]
multiply the bushing displacement rates[ẋ ẏ ż]
to form 𝐟ᴅ, the damper portion of the force 𝐟 = [fx fy fz]ʙ. The SI units ofdx, dy, dz
are N*s/m.
Note
The LinearBushingRollPitchYaw class documentation describes the stiffness and damping constants.
Note
The net moment on C about Co is affected by both the gimbal torque and the moment of 𝐟 about Co. Similarly, for the net moment on A about Ao.
Note
math::RollPitchYaw describes the roll pitch yaw angles q₀, q₁, q₂. The position from Ao to Co is p_AoCo_B = x 𝐁𝐱 + y 𝐁𝐲 + z 𝐁𝐳 = [x y z]ʙ.
Note
The ModelInstanceIndex assigned to this by the constructor is the one assigned to frame C, i.e., frameC.model_instance().
- Precondition:
All the stiffness and damping constants must be non-negative.
- Parameter
- CalcBushingSpatialForceOnFrameA(self: pydrake.multibody.tree.LinearBushingRollPitchYaw, context: pydrake.systems.framework.Context) pydrake.multibody.math.SpatialForce
Calculate F_A_A, the bushing’s spatial force on frame A expressed in A. F_A_A contains two vectors: the moment of all bushing forces on A about Ao (−𝐭 + p_AoAp × −𝐟) and the net bushing force on A (−𝐟 expressed in A).
- Parameter
context
: The state of the multibody system.
See also
CalcBushingSpatialForceOnFrameC().
- Raises
RuntimeError if pitch angle is near gimbal-lock. For more info, –
See also
RollPitchYaw::DoesCosPitchAngleViolateGimbalLockTolerance().
- Parameter
- CalcBushingSpatialForceOnFrameC(self: pydrake.multibody.tree.LinearBushingRollPitchYaw, context: pydrake.systems.framework.Context) pydrake.multibody.math.SpatialForce
Calculate F_C_C, the bushing’s spatial force on frame C expressed in C. F_C_C contains two vectors: the moment of all bushing forces on C about Co (𝐭 + p_CoCp × 𝐟) and the resultant bushing force on C (𝐟 expressed in C).
- Parameter
context
: The state of the multibody system.
See also
CalcBushingSpatialForceOnFrameA().
- Raises
RuntimeError if pitch angle is near gimbal-lock. For more info, –
See also
RollPitchYaw::DoesCosPitchAngleViolateGimbalLockTolerance().
- Parameter
- force_damping_constants(self: pydrake.multibody.tree.LinearBushingRollPitchYaw) numpy.ndarray[numpy.float64[3, 1]]
Returns the default force damping constants
[dx dy dz]
(units of N*s/m). Refer to Basic_bushing_force_stiffness_and_damping “How to choose force stiffness and damping constants” for more details.
- force_stiffness_constants(self: pydrake.multibody.tree.LinearBushingRollPitchYaw) numpy.ndarray[numpy.float64[3, 1]]
Returns the default force stiffness constants
[kx ky kz]
(units of N/m). Refer to Basic_bushing_force_stiffness_and_damping “How to choose force stiffness and damping constants” for more details.
- frameA(self: pydrake.multibody.tree.LinearBushingRollPitchYaw) pydrake.multibody.tree.Frame
Returns frame A, which is the frame that is welded to link (body) L0 and attached to the bushing.
- frameC(self: pydrake.multibody.tree.LinearBushingRollPitchYaw) pydrake.multibody.tree.Frame
Returns frame C, which is the frame that is welded to link (body) L1 and attached to the bushing.
- GetForceDampingConstants(self: pydrake.multibody.tree.LinearBushingRollPitchYaw, context: pydrake.systems.framework.Context) numpy.ndarray[numpy.float64[3, 1]]
Returns the force damping constants
[dx dy dz]
(units of N*s/m) stored incontext
.
- GetForceStiffnessConstants(self: pydrake.multibody.tree.LinearBushingRollPitchYaw, context: pydrake.systems.framework.Context) numpy.ndarray[numpy.float64[3, 1]]
Returns the force stiffness constants
[kx ky kz]
(units of N/m) stored incontext
.
- GetTorqueDampingConstants(self: pydrake.multibody.tree.LinearBushingRollPitchYaw, context: pydrake.systems.framework.Context) numpy.ndarray[numpy.float64[3, 1]]
Returns the torque damping constants
[d₀ d₁ d₂]
(units of N*m*s/rad) stored incontext
.
- GetTorqueStiffnessConstants(self: pydrake.multibody.tree.LinearBushingRollPitchYaw, context: pydrake.systems.framework.Context) numpy.ndarray[numpy.float64[3, 1]]
Returns the torque stiffness constants
[k₀ k₁ k₂]
(units of N*m/rad) stored incontext
.
- link0(self: pydrake.multibody.tree.LinearBushingRollPitchYaw) pydrake.multibody.tree.RigidBody
Returns link (body) L0 (frame A is welded to link L0).
- link1(self: pydrake.multibody.tree.LinearBushingRollPitchYaw) pydrake.multibody.tree.RigidBody
Returns link (body) L1 (frame C is welded to link L1).
- SetForceDampingConstants(self: pydrake.multibody.tree.LinearBushingRollPitchYaw, context: pydrake.systems.framework.Context, force_damping: numpy.ndarray[numpy.float64[3, 1]]) None
Sets the force damping constants
[dx dy dz]
(units of N*s/m) incontext
.
- SetForceStiffnessConstants(self: pydrake.multibody.tree.LinearBushingRollPitchYaw, context: pydrake.systems.framework.Context, force_stiffness: numpy.ndarray[numpy.float64[3, 1]]) None
Sets the force stiffness constants
[kx ky kz]
(units of N/m) incontext
.
- SetTorqueDampingConstants(self: pydrake.multibody.tree.LinearBushingRollPitchYaw, context: pydrake.systems.framework.Context, torque_damping: numpy.ndarray[numpy.float64[3, 1]]) None
Sets the torque damping constants
[d₀ d₁ d₂]
(units of N*m*s/rad) incontext
.
- SetTorqueStiffnessConstants(self: pydrake.multibody.tree.LinearBushingRollPitchYaw, context: pydrake.systems.framework.Context, torque_stiffness: numpy.ndarray[numpy.float64[3, 1]]) None
Sets the torque stiffness constants
[k₀ k₁ k₂]
(units of N*m/rad) incontext
.
- torque_damping_constants(self: pydrake.multibody.tree.LinearBushingRollPitchYaw) numpy.ndarray[numpy.float64[3, 1]]
Returns the default torque damping constants
[d₀ d₁ d₂]
(units of N*m*s/rad). Refer to Basic_bushing_torque_stiffness_and_damping “How to choose torque stiffness and damping constants” for more details.
- torque_stiffness_constants(self: pydrake.multibody.tree.LinearBushingRollPitchYaw) numpy.ndarray[numpy.float64[3, 1]]
Returns the default torque stiffness constants
[k₀ k₁ k₂]
(units of N*m/rad). Refer to Basic_bushing_torque_stiffness_and_damping “How to choose torque stiffness and damping constants” for more details.
- template pydrake.multibody.tree.LinearBushingRollPitchYaw_
Instantiations:
LinearBushingRollPitchYaw_[float]
,LinearBushingRollPitchYaw_[AutoDiffXd]
,LinearBushingRollPitchYaw_[Expression]
- class pydrake.multibody.tree.LinearBushingRollPitchYaw_[AutoDiffXd]
Bases:
pydrake.multibody.tree.ForceElement_[AutoDiffXd]
This ForceElement models a massless flexible bushing that connects a frame A of a link (body) L0 to a frame C of a link (body) L1. The bushing can apply a torque and force due to stiffness (spring) and dissipation (damper) properties. Frame B is the bushing frame whose origin Bo is halfway between Ao (A’s origin) and Co (C’s origin) and whose unit vectors 𝐁𝐱, 𝐁𝐲, 𝐁𝐳 are “halfway” (in an angle-axis sense) between the unit vectors of frame A and frame C. Frame B is a “floating” frame in the sense that it is calculated from the position and orientation of frames A and C (B is not welded to the bushing).
@image html drake/multibody/tree/images/LinearBushingRollPitchYaw.png width=80%
The set of forces on frame C from the bushing is equivalent to a torque 𝐭 on frame C and a force 𝐟 applied to a point Cp of C. The set of forces on frame A from the bushing is equivalent to a torque −𝐭 on frame A and a force −𝐟 applied to a point Ap of A. Points Ap and Cp are coincident with Bo (frame B’s origin).
This “quasi-symmetric” bushing force/torque model was developed at Toyota Research Institute and has advantages compared to traditional bushing models because it employs a bushing-centered “symmetric” frame B and it ensures the moment of −𝐟 on A about Ao is equal to the moment of 𝐟 on C about Co. Traditional models differ as they lack a “symmetric” frame B and apply −𝐟 at Ao, which means the moment of −𝐟 on A about Ao is always zero. Note: This bushing model is not fully symmetric since the orientation between frames A and C is parameterized with roll-pitch-yaw angles [q₀ q₁ q₂]. Since these angles have an inherent sequence, they are not mathematically symmetric.
The torque model depends on spring-damper “gimbal” torques
τ ≜ [τ₀ τ₁ τ₂]
which themselves depend on roll-pitch-yaw anglesq ≜ [q₀ q₁ q₂]
and ratesq̇ = [q̇₀ q̇₁ q̇₂]
via a diagonal torque-stiffness matrix K₀₁₂ and a diagonal torque-damping matrix D₀₁₂ asClick to expand C++ code...
⌈ τ₀ ⌉ ⌈k₀ 0 0⌉ ⌈ q₀ ⌉ ⌈d₀ 0 0⌉ ⌈ q̇₀ ⌉ τ ≜ | τ₁ | = − | 0 k₁ 0| | q₁ | − | 0 d₁ 0| | q̇₁ | ⌊ τ₂ ⌋ ⌊ 0 0 k₂⌋ ⌊ q₂ ⌋ ⌊ 0 0 d₂⌋ ⌊ q̇₂ ⌋
where k₀, k₁, k₂ and d₀, d₁, d₂ are torque stiffness and damping constants and must have non-negative values.
Note
τ does not represent a vector expressed in one frame. Instead it is regarded as a 3x1 array of torque scalars associated with roll-pitch yaw.
Note
As discussed in the Advanced section below, τ is not 𝐭
(τ ≠ 𝐭)
.Note
This is a “linear” bushing model as gimbal torque τ varies linearly with q and q̇ as τ = τᴋ + τᴅ where τᴋ = −K₀₁₂ ⋅ q and τᴅ = −D₀₁₂ ⋅ q̇.
The bushing model for the net force 𝐟 on frame C from the bushing depends on scalars x, y, z which are defined so 𝐫 (the position vector from Ao to Co) can be expressed in frame B as
𝐫 ≜ p_AoCo = [x y z]ʙ = x 𝐁𝐱 + y 𝐁𝐲 + z 𝐁𝐳
. The model for 𝐟 uses a diagonal force-stiffness matrix Kxyᴢ, a diagonal force-damping matrix Dxyᴢ, and defines fx, fy, fz so𝐟 = [fx fy fz]ʙ
.Click to expand C++ code...
⌈ fx ⌉ ⌈kx 0 0⌉ ⌈ x ⌉ ⌈dx 0 0⌉ ⌈ ẋ ⌉ | fy | = − | 0 ky 0| | y | − | 0 dy 0| | ẏ | ⌊ fz ⌋ ⌊ 0 0 kz⌋ ⌊ z ⌋ ⌊ 0 0 dz⌋ ⌊ ż ⌋
where kx, ky, kz and dx, dy, dz are force stiffness and damping constants and must have non-negative values.
Note
This is a “linear” bushing model as the force 𝐟 varies linearly with 𝐫 and 𝐫̇̇ as 𝐟 = 𝐟ᴋ + 𝐟ᴅ where 𝐟ᴋ = −Kxyz ⋅ 𝐫 and 𝐟ᴅ = −Dxyz ⋅ 𝐫̇̇.
This bushing’s constructor sets the torque stiffness/damping constants
[k₀ k₁ k₂]
and[d₀ d₁ d₂]
and the force stiffness/damping constants[kx ky kz]
and[dx dy dz]
. The examples below demonstrate how to model various joints that have a flexible (e.g., rubber) mount. The damping values below with ? may be set to 0 or a reasonable positive number.Bushing type | torque constants | force constants ——————————–|:--------------------|:—————— z-axis revolute joint | k₀₁₂ =
[k₀ k₁ 0]
| kxyz =[kx ky kz]
^ | d₀₁₂ =[d₀ d₁ ?]
| dxyz =[dx dy dz]
x-axis prismatic joint | k₀₁₂ =[k₀ k₁ k₂]
| kxyz =[0 ky kz]
^ | d₀₁₂ =[d₀ d₁ d₂]
| dxyz =[? dy dz]
Ball and socket joint | k₀₁₂ =[0 0 0]
| kxyz =[kx ky kz]
^ | d₀₁₂ =[? ? ?]
| dxyz =[dx dy dz]
Weld/fixed joint | k₀₁₂ =[k₀ k₁ k₂]
| kxyz =[kx ky kz]
^ | d₀₁₂ =[d₀ d₁ d₂]
| dxyz =[dx dy dz]
Angles q₀, q₁, q₂ are calculated from frame C’s orientation relative to frame A, with
[−π < q₀ ≤ π, −π/2 ≤ q₁ ≤ π/2, −π < q₂ ≤ π]
, hence, there is no angle wrapping and torque stiffness has a limited range. Gimbal torques τ can be discontinuous if one of q₀, q₁, q₂ is discontinuous and its associated torque spring constant is nonzero. For example, τ₂ is discontinuous ifk₂ ≠ 0
and the bushing has a large rotation so q₂ jumps from≈ −π to π
. τ can also be discontinuous if one of q̇₀, q̇₁, q̇₂ is discontinuous and its associated torque damper constant is nonzero. For example, τ₀ is discontinuous ifd₀ ≠ 0
and q̇₀ is undefined (which occurs whenpitch = q₁ = π/2
). Note: Due to the relationship of 𝐭 to τ shown below, 𝐭 is discontinuous if τ is discontinuous.As shown below, there are multiple ways to estimate torque and force stiffness and damping constants. Use a method or combination of methods appropriate for your application. For example, some methods are more useful for a real physical bushing whereas other methods (called “penalty methods”) can be more useful when replacing an ideal joint (such as a revolute or fixed/weld joint) with a bushing.
Consider a penalty method if you want a bushing to substitute for a “hard” constraint (e.g., an ideal joint). Since a bushing is inherently compliant it will violate a hard constraint somewhat. The stiffer the bushing, the more accurately it enforces the hard constraint, but at a cost of more computational time. To balance accuracy versus time, consider your tolerance for constraint errors. For example, is it OK for your bushing to displace xₘₐₓ = 1 mm for an estimated Fxₘₐₓ = 100 N? Also, one way to choose a force damping constant dx is by choosing a “reasonably small” settling time tₛ, where settling time tₛ is the interval of time for a system to settle to within 1% (0.01) of an equilibrium solution). Is tₛ = 0.01 s negligible for a robot arm with a 10 s reach maneuver?
**** How to choose a torque stiffness constant k₀ or damping constant d₀. The estimate of stiffness k₀ depends on whether you are modeling a physical bushing (consider stiffness methods 1 or 2 below) or whether you are using a bushing to replace an ideal joint such as a revolute or fixed/weld joint (consider stiffness “penalty methods” 3 or 4 below). 1. Use a static experiment, e.g., apply a known moment load Mx, measure the associated angular displacement Δq (radians), and estimate k₀ = Mx / Δq. 2. Use FEA (finite element analysis) software to estimate k₀. 3. Pick a desired maximum angular displacement qₘₐₓ, estimate a maximum moment load Mxₘₐₓ, and estimate
k₀ = Mxₘₐₓ / qₘₐₓ
(units of N*m/rad). 4. Choose a characteristic moment of inertia I₀ (directionally dependent), choose a desired angular frequency ωₙ > 0 (in rad/s) and estimatek₀ = I₀ ωₙ²
(units of N*m/rad).The estimate of damping d₀ depends on whether you are modeling a physical bushing (consider damping method 1 below) or whether you are using a bushing to enforce a constraint (consider damping methods 2 or 3 below). 1. Use experiments to estimate a damping ratio ζ and settling time tₛ. Compute “undamped natural frequency” ωₙ from ζ and tₛ (as shown below in the Advanced section), then
d₀ = 2 ζ k₀ / ωₙ
(units of N*m*s/rad). 2. Choose a damping ratio ζ (e.g., ζ = 1, critical damping) and a desired settling time tₛ, calculate ωₙ (as shown below in the Advanced section), thend₀ = 2 ζ k₀ / ωₙ
(units of N*m*s/rad). 3. Choose a damping ratio ζ (e.g., ζ = 1, critical damping), estimate a characteristic moment of inertia and calculated₀ = 2 ζ √(I₀ k₀)
.Refer to Advanced_bushing_stiffness_and_damping “Advanced bushing stiffness and damping” for more details.
**** How to choose a force stiffness constant kx or damping constant dx. The estimate of stiffness kx depends on whether you are modeling a real bushing (consider stiffness methods 1 or 2 below) or whether you are using a bushing to replace an ideal joint such as a revolute or fixed/weld joint (consider stiffness “penalty methods” 3 or 4 below). 1. Use a static experiment, e.g., apply a known force load Fx, measure the associated displacement (stretch) Δx (in meters), and estimate kx = Fx / Δx. 2. Use FEA (finite element analysis) software to estimate kx (units of N/m). 3. Pick a desired maximum displacement xₘₐₓ, estimate a maximum force load Fxₘₐₓ, and estimate
kx = Fxₘₐₓ / xₘₐₓ
(units of N/m). 4. Choose a characteristic mass m (which may be directionally dependent), choose a desired angular frequency ωₙ > 0 (in rad/s) and estimatekx = m ωₙ²
(units of N/m).The estimate of damping dx depends on whether you are modeling a physical bushing (consider damping method 1 below) or whether you are using a bushing to enforce a constraint (consider damping methods 2 or 3 below). 1. Use experiments to estimate a damping ratio ζ and settling time tₛ. Compute “undamped natural frequency” ωₙ from ζ and tₛ (as shown below in the Advanced section), then
dx = 2 ζ kx / ωₙ
(units of N*s/m). 2. Choose a damping ratio ζ (e.g., ζ = 1, critical damping) and a desired settling time tₛ, calculate ωₙ (as shown below in the Advanced section), thendx = 2 ζ kx / ωₙ
(units of N*s/m). 3. Choose a damping ratio ζ (e.g., ζ = 1, critical damping), estimate a characteristic mass m and calculatedx = 2 ζ √(m kx)
(units of N*s/m).Refer to Advanced_bushing_stiffness_and_damping “Advanced bushing stiffness and damping” for more details.
**** Advanced: Relationship of 𝐭 to τ. To understand how “gimbal torques” τ relate to 𝐭, it helps to remember that the RollPitchYaw class documentation states that a Space-fixed (extrinsic) X-Y-Z rotation with roll-pitch-yaw angles [q₀ q₁ q₂] is equivalent to a Body-fixed (intrinsic) Z-Y-X rotation by yaw-pitch-roll angles [q₂ q₁ q₀]. In the context of “gimbal torques”, the Body-fixed Z-Y-X rotation sequence with angles [q₂ q₁ q₀] is physical meaningful as it produces torques associated with successive frames in a gimbal as τ₂ 𝐀𝐳, τ₁ 𝐏𝐲, τ₀ 𝐂𝐱, where each of 𝐀𝐳, 𝐏𝐲, 𝐂𝐱 are unit vectors associated with a frame in the yaw-pitch-roll rotation sequence and 𝐏𝐲 is a unit vector of the “pitch” intermediate frame. As described earlier, torque 𝐭 is the moment of the bushing forces on frame C about Cp. Scalars tx, ty, tz are defined so 𝐭 can be expressed
𝐭 = [tx ty tz]ᴀ = tx 𝐀𝐱 + ty 𝐀𝐲 + tz 𝐀𝐳
. As shown in code documentation, the relationship of [tx ty tz] to [τ₀ τ₁ τ₂] was found by equating 𝐭’s power to τ’s power as 𝐭 ⋅ w_AC = τ ⋅ q̇.Click to expand C++ code...
⌈ tx ⌉ ⌈ τ₀ ⌉ ⌈ cos(q₂)/cos(q₁) sin(q₂)/cos(q₁) 0 ⌉ | ty | = Nᵀ | τ₁ | where N = | −sin(q2) cos(q2) 0 | ⌊ tz ⌋ ⌊ τ₂ ⌋ ⌊ cos(q₂)*tan(q₁) sin(q₂)*tan(q₁) 1 ⌋
**** Advanced: More on how to choose bushing stiffness and damping constants. The basics on how to choose bushing stiffness and damping constants are at: - Basic_bushing_torque_stiffness_and_damping “How to choose torque stiffness and damping constants” - Basic_bushing_force_stiffness_and_damping “How to choose force stiffness and damping constants”
The list below provides more detail on: The performance tradeoff between high stiffness and long simulation time; loads that affect estimates of Mxₘₐₓ or Fxₘₐₓ; and how a linear 2ⁿᵈ-order ODE provides insight on how to experimentally determine stiffness and damping constants. - Stiffness [k₀ k₁ k₂] and [kx ky kz] affect simulation time and accuracy. Generally, a stiffer bushing better resembles an ideal joint (e.g., a revolute joint or fixed/weld joint). However (depending on integrator), a stiffer bushing usually increases numerical integration time. - An estimate for a maximum load Mxₘₐₓ or Fxₘₐₓ accounts for gravity forces, applied forces, inertia forces (centripetal, Coriolis, gyroscopic), etc. - One way to determine physical stiffness and damping constants is through the mathematical intermediaries ωₙ (units of rad/s) and ζ (no units). The constant ωₙ (called “undamped natural frequency” or “angular frequency”) and constant ζ (called “damping ratio”) relate to the physical constants mass m, damping constant dx, and stiffness constant kx via the following prototypical linear constant-coefficient 2ⁿᵈ-order ODEs.
Click to expand C++ code...
m ẍ + dx ẋ + kx x = 0 or alternatively as ẍ + 2 ζ ωₙ ẋ + ωₙ² x = 0 where ωₙ² = kx/m, ζ = dx / (2 √(m kx))
ωₙ and ζ also appear in the related ODEs for rotational systems, namely
Click to expand C++ code...
I₀ q̈ + d₀ q̇ + k₀ q = 0 or alternatively as q̈ + 2 ζ ωₙ q̇ + ωₙ² q = 0 where ωₙ² = k₀/I₀, ζ = d₀ / (2 √(I₀ k₀))
One way to determine ωₙ is from settling time tₛ which approximates the time for a system to settle to within a specified settling ratio of an equilibrium solutions. Typical values for settling ratio are 1% (0.01), 2% (0.02), 5% (0.05), and 10% (0.10). - When ζ < 0.7 (underdamped), a commonly used approximation is ωₙ ≈ -ln(settling_ratio) / (ζ tₛ) which for settling ratios 0.01 and 0.05 give ωₙ ≈ 4.6 / (ζ tₛ) and ωₙ ≈ 3 / (ζ tₛ). Another commonly used approximation is ωₙ ≈ -ln(settling_ratio √(1- ζ²)) / (ζ tₛ). See https://en.wikipedia.org/wiki/Settling_time or the book Modern Control Engineering by Katsuhiko Ogata. Although these approximate formulas for ωₙ are common, they are somewhat inaccurate. Settling time for underdamped systems is discontinuous and requires solving a nonlinear algebraic equation (an iterative process). For more information, see http://www.scielo.org.co/pdf/rfiua/n66/n66a09.pdf [Ramos-Paja, et. al 2012], “Accurate calculation of settling time in second order systems: a photovoltaic application”. Another reference is https://courses.grainger.illinois.edu/ece486/sp2020/laboratory/docs/lab2/estimates.html - When ζ ≈ 1 (critically damped), ωₙ is determined by choosing a settling ratio and then solving for (ωₙ tₛ) via the nonlinear algebraic equation (1 + ωₙ tₛ)*exp(-ωₙ tₛ) = settling_ratio. Settling ratio | ωₙ ————– | ————- 0.01 | 6.64 / tₛ 0.02 | 5.83 / tₛ 0.05 | 4.74 / tₛ 0.10 | 3.89 / tₛ See https://electronics.stackexchange.com/questions/296567/over-and-critically-damped-systems-settling-time - When ζ ≥ 1.01 (overdamped), ωₙ ≈ -ln(2 settling_ratio sz/s₂) / (s₁ tₛ) where sz = √(ζ² - 1), s₁ = ζ - sz, s₂ = ζ + sz. The derivation and approximation error estimates for this overdamped settling time formula is ApproximateOverdampedSettlingTime “below”.
For a real physical bushing, an experiment is one way to estimate damping
constants. For example, to estimate a torque damping constant d₀ associated with underdamped vibrations (damping ratio 0 < ζ < 1), attach the bushing to a massive rod, initially displace the rod by angle Δq, release the rod and measure q(t). From the q(t) measurement, estimate decay ratio (the ratio of successive peak heights above the final steady-state value) calculate logarithmic decrement δ = -ln(decay_ratio), calculate damping ratio ζ = √(δ² / (4π² + δ²)), then calculate d₀ using d₀ = 2 ζ √(I₀ k₀) or d₀ = 2 ζ k₀ / ωₙ. For more information, see https://en.wikipedia.org/wiki/Damping_ratio#Logarithmic_decrement
**** Derivation: Approximate formula for overdamped settling time. Since a literature reference for this formula was not found, the derivation below was done at TRI (it has not been peer reviewed). This formula results from the “dominant pole” solution in the prototypical constant-coefficient linear 2ⁿᵈ-order ODE. For ẋ(0) = 0, mathematics shows poles p₁ = -ωₙ s₁, p₂ = -ωₙ s₂, where sz = √(ζ² - 1), s₁ = ζ - sz, s₂ = ζ + sz. and
Click to expand C++ code...
x(t) / x(0) = p₂/(p₂-p₁) exp(p₁ t) - p₁/(p₂-p₁) exp(p₂ t) = s₂/(s₂-s₁) exp(p₁ t) - s₁/(s₂-s₁) exp(p₂ t) = k/( k-1 ) exp(p₁ t) - 1/( k-1 ) exp(p₂ t) where k = s₂ / s₁ ≈ k/( k-1 ) exp(p₁ t) since p₁ > p₂
Note: k = s₂ / s₁ is real, k > 0, s₂ = k s₁, and p₁ > p₂ (p₁ is less negative then p₂), so exp(p₁ t) decays to zero slower than exp(p₂ t) and exp(p₁ t) ≫ exp(p₂ t) for sufficiently large t. Hence we assume exp(p₂ t) ≈ 0 (which is why p₁ is called the “dominant pole”). Next,
Click to expand C++ code...
k/(k - 1) = s₂ / s₁ / (s₂/s₁ -1) = s₂ / (s₂ - s₁) = s₂ / (2 sz), so x(t) / x(0) ≈ s₂ / (2 sz) exp(-s₁ ωₙ t), hence settling_ratio ≈ s₂ / (2 sz) exp(-s₁ ωₙ tₛ), finally ωₙ ≈ -ln(settling_ratio 2 sz / s₂) / (s₁ tₛ)
The table below shows that there is little error in this approximate formula for various settling ratios and ζ, particularly for ζ ≥ 1.1. For 1.0 ≤ ζ < 1.1, the critical damping estimates of ωₙ work well. Settling ratio | ζ = 1.01 | ζ = 1.1 | ζ = 1.2 | ζ = 1.3 | ζ = 1.5 ————– | ——– | ——- | ——- | ——- | ——– 0.01 | 1.98% | 0.005% | 2.9E-5% | 1.6E-7% | 2.4E-12% 0.02 | 2.91% | 0.016% | 1.8E-4% | 2.1E-6% | 1.6E-10% 0.05 | 5.10% | 0.076% | 2.3E-3% | 7.0E-5% | 4.4E-8% 0.10 | 8.28% | 0.258% | 1.6E-2% | 1.0E-3% | 3.3E-6% Note: There is a related derivation in the reference below, however, it needlessly makes the oversimplified approximation k/(k - 1) ≈ 1. https://electronics.stackexchange.com/questions/296567/over-and-critically-damped-systems-settling-time
Note
The complete theory for this bushing is documented in the source code. Please look there if you want more information.
- Template parameter
T
: The underlying scalar type. Must be a valid Eigen scalar.
See also
math::RollPitchYaw for definitions of roll, pitch, yaw
[q₀ q₁ q₂]
.Note
Per issue #12982, do not directly or indirectly call the following methods as they have not yet been implemented and throw an exception: CalcPotentialEnergy(), CalcConservativePower(), CalcNonConservativePower().
- __init__(self: pydrake.multibody.tree.LinearBushingRollPitchYaw_[AutoDiffXd], frameA: pydrake.multibody.tree.Frame_[AutoDiffXd], frameC: pydrake.multibody.tree.Frame_[AutoDiffXd], torque_stiffness_constants: numpy.ndarray[numpy.float64[3, 1]], torque_damping_constants: numpy.ndarray[numpy.float64[3, 1]], force_stiffness_constants: numpy.ndarray[numpy.float64[3, 1]], force_damping_constants: numpy.ndarray[numpy.float64[3, 1]]) None
Construct a LinearBushingRollPitchYaw B that connects frames A and C, where frame A is welded to a link L0 and frame C is welded to a link L1.
- Parameter
frameA
: frame A of link (body) L0 that connects to bushing B.
- Parameter
frameC
: frame C of link (body) L1 that connects to bushing B.
- Parameter
torque_stiffness_constants
: [k₀ k₁ k₂]
multiply the roll-pitch-yaw angles[q₀ q₁ q₂]
to produce the spring portion of the “gimbal” torques τ₀, τ₁, τ₂. The SI units ofk₀, k₁, k₂
are N*m/rad.- Parameter
torque_damping_constants
: [d₀ d₁ d₂]
multiply the roll-pitch-yaw rates[q̇₀ q̇₁ q̇₂]
to produce the damper portion of the “gimbal” torques τ₀, τ₁, τ₂. The SI units ofd₀, d₁, d₂
are N*m*s/rad.- Parameter
force_stiffness_constants
: [kx ky kz]
multiply the bushing displacements[x y z]
to form 𝐟ᴋ, the spring portion of the force 𝐟 = [fx fy fz]ʙ. The SI units ofkx, ky, kz
are N/m.- Parameter
force_damping_constants
: [dx dy dz]
multiply the bushing displacement rates[ẋ ẏ ż]
to form 𝐟ᴅ, the damper portion of the force 𝐟 = [fx fy fz]ʙ. The SI units ofdx, dy, dz
are N*s/m.
Note
The LinearBushingRollPitchYaw class documentation describes the stiffness and damping constants.
Note
The net moment on C about Co is affected by both the gimbal torque and the moment of 𝐟 about Co. Similarly, for the net moment on A about Ao.
Note
math::RollPitchYaw describes the roll pitch yaw angles q₀, q₁, q₂. The position from Ao to Co is p_AoCo_B = x 𝐁𝐱 + y 𝐁𝐲 + z 𝐁𝐳 = [x y z]ʙ.
Note
The ModelInstanceIndex assigned to this by the constructor is the one assigned to frame C, i.e., frameC.model_instance().
- Precondition:
All the stiffness and damping constants must be non-negative.
- Parameter
- CalcBushingSpatialForceOnFrameA(self: pydrake.multibody.tree.LinearBushingRollPitchYaw_[AutoDiffXd], context: pydrake.systems.framework.Context_[AutoDiffXd]) pydrake.multibody.math.SpatialForce_[AutoDiffXd]
Calculate F_A_A, the bushing’s spatial force on frame A expressed in A. F_A_A contains two vectors: the moment of all bushing forces on A about Ao (−𝐭 + p_AoAp × −𝐟) and the net bushing force on A (−𝐟 expressed in A).
- Parameter
context
: The state of the multibody system.
See also
CalcBushingSpatialForceOnFrameC().
- Raises
RuntimeError if pitch angle is near gimbal-lock. For more info, –
See also
RollPitchYaw::DoesCosPitchAngleViolateGimbalLockTolerance().
- Parameter
- CalcBushingSpatialForceOnFrameC(self: pydrake.multibody.tree.LinearBushingRollPitchYaw_[AutoDiffXd], context: pydrake.systems.framework.Context_[AutoDiffXd]) pydrake.multibody.math.SpatialForce_[AutoDiffXd]
Calculate F_C_C, the bushing’s spatial force on frame C expressed in C. F_C_C contains two vectors: the moment of all bushing forces on C about Co (𝐭 + p_CoCp × 𝐟) and the resultant bushing force on C (𝐟 expressed in C).
- Parameter
context
: The state of the multibody system.
See also
CalcBushingSpatialForceOnFrameA().
- Raises
RuntimeError if pitch angle is near gimbal-lock. For more info, –
See also
RollPitchYaw::DoesCosPitchAngleViolateGimbalLockTolerance().
- Parameter
- force_damping_constants(self: pydrake.multibody.tree.LinearBushingRollPitchYaw_[AutoDiffXd]) numpy.ndarray[numpy.float64[3, 1]]
Returns the default force damping constants
[dx dy dz]
(units of N*s/m). Refer to Basic_bushing_force_stiffness_and_damping “How to choose force stiffness and damping constants” for more details.
- force_stiffness_constants(self: pydrake.multibody.tree.LinearBushingRollPitchYaw_[AutoDiffXd]) numpy.ndarray[numpy.float64[3, 1]]
Returns the default force stiffness constants
[kx ky kz]
(units of N/m). Refer to Basic_bushing_force_stiffness_and_damping “How to choose force stiffness and damping constants” for more details.
- frameA(self: pydrake.multibody.tree.LinearBushingRollPitchYaw_[AutoDiffXd]) pydrake.multibody.tree.Frame_[AutoDiffXd]
Returns frame A, which is the frame that is welded to link (body) L0 and attached to the bushing.
- frameC(self: pydrake.multibody.tree.LinearBushingRollPitchYaw_[AutoDiffXd]) pydrake.multibody.tree.Frame_[AutoDiffXd]
Returns frame C, which is the frame that is welded to link (body) L1 and attached to the bushing.
- GetForceDampingConstants(self: pydrake.multibody.tree.LinearBushingRollPitchYaw_[AutoDiffXd], context: pydrake.systems.framework.Context_[AutoDiffXd]) numpy.ndarray[object[3, 1]]
Returns the force damping constants
[dx dy dz]
(units of N*s/m) stored incontext
.
- GetForceStiffnessConstants(self: pydrake.multibody.tree.LinearBushingRollPitchYaw_[AutoDiffXd], context: pydrake.systems.framework.Context_[AutoDiffXd]) numpy.ndarray[object[3, 1]]
Returns the force stiffness constants
[kx ky kz]
(units of N/m) stored incontext
.
- GetTorqueDampingConstants(self: pydrake.multibody.tree.LinearBushingRollPitchYaw_[AutoDiffXd], context: pydrake.systems.framework.Context_[AutoDiffXd]) numpy.ndarray[object[3, 1]]
Returns the torque damping constants
[d₀ d₁ d₂]
(units of N*m*s/rad) stored incontext
.
- GetTorqueStiffnessConstants(self: pydrake.multibody.tree.LinearBushingRollPitchYaw_[AutoDiffXd], context: pydrake.systems.framework.Context_[AutoDiffXd]) numpy.ndarray[object[3, 1]]
Returns the torque stiffness constants
[k₀ k₁ k₂]
(units of N*m/rad) stored incontext
.
- link0(self: pydrake.multibody.tree.LinearBushingRollPitchYaw_[AutoDiffXd]) pydrake.multibody.tree.RigidBody_[AutoDiffXd]
Returns link (body) L0 (frame A is welded to link L0).
- link1(self: pydrake.multibody.tree.LinearBushingRollPitchYaw_[AutoDiffXd]) pydrake.multibody.tree.RigidBody_[AutoDiffXd]
Returns link (body) L1 (frame C is welded to link L1).
- SetForceDampingConstants(self: pydrake.multibody.tree.LinearBushingRollPitchYaw_[AutoDiffXd], context: pydrake.systems.framework.Context_[AutoDiffXd], force_damping: numpy.ndarray[object[3, 1]]) None
Sets the force damping constants
[dx dy dz]
(units of N*s/m) incontext
.
- SetForceStiffnessConstants(self: pydrake.multibody.tree.LinearBushingRollPitchYaw_[AutoDiffXd], context: pydrake.systems.framework.Context_[AutoDiffXd], force_stiffness: numpy.ndarray[object[3, 1]]) None
Sets the force stiffness constants
[kx ky kz]
(units of N/m) incontext
.
- SetTorqueDampingConstants(self: pydrake.multibody.tree.LinearBushingRollPitchYaw_[AutoDiffXd], context: pydrake.systems.framework.Context_[AutoDiffXd], torque_damping: numpy.ndarray[object[3, 1]]) None
Sets the torque damping constants
[d₀ d₁ d₂]
(units of N*m*s/rad) incontext
.
- SetTorqueStiffnessConstants(self: pydrake.multibody.tree.LinearBushingRollPitchYaw_[AutoDiffXd], context: pydrake.systems.framework.Context_[AutoDiffXd], torque_stiffness: numpy.ndarray[object[3, 1]]) None
Sets the torque stiffness constants
[k₀ k₁ k₂]
(units of N*m/rad) incontext
.
- torque_damping_constants(self: pydrake.multibody.tree.LinearBushingRollPitchYaw_[AutoDiffXd]) numpy.ndarray[numpy.float64[3, 1]]
Returns the default torque damping constants
[d₀ d₁ d₂]
(units of N*m*s/rad). Refer to Basic_bushing_torque_stiffness_and_damping “How to choose torque stiffness and damping constants” for more details.
- torque_stiffness_constants(self: pydrake.multibody.tree.LinearBushingRollPitchYaw_[AutoDiffXd]) numpy.ndarray[numpy.float64[3, 1]]
Returns the default torque stiffness constants
[k₀ k₁ k₂]
(units of N*m/rad). Refer to Basic_bushing_torque_stiffness_and_damping “How to choose torque stiffness and damping constants” for more details.
- class pydrake.multibody.tree.LinearBushingRollPitchYaw_[Expression]
Bases:
pydrake.multibody.tree.ForceElement_[Expression]
This ForceElement models a massless flexible bushing that connects a frame A of a link (body) L0 to a frame C of a link (body) L1. The bushing can apply a torque and force due to stiffness (spring) and dissipation (damper) properties. Frame B is the bushing frame whose origin Bo is halfway between Ao (A’s origin) and Co (C’s origin) and whose unit vectors 𝐁𝐱, 𝐁𝐲, 𝐁𝐳 are “halfway” (in an angle-axis sense) between the unit vectors of frame A and frame C. Frame B is a “floating” frame in the sense that it is calculated from the position and orientation of frames A and C (B is not welded to the bushing).
@image html drake/multibody/tree/images/LinearBushingRollPitchYaw.png width=80%
The set of forces on frame C from the bushing is equivalent to a torque 𝐭 on frame C and a force 𝐟 applied to a point Cp of C. The set of forces on frame A from the bushing is equivalent to a torque −𝐭 on frame A and a force −𝐟 applied to a point Ap of A. Points Ap and Cp are coincident with Bo (frame B’s origin).
This “quasi-symmetric” bushing force/torque model was developed at Toyota Research Institute and has advantages compared to traditional bushing models because it employs a bushing-centered “symmetric” frame B and it ensures the moment of −𝐟 on A about Ao is equal to the moment of 𝐟 on C about Co. Traditional models differ as they lack a “symmetric” frame B and apply −𝐟 at Ao, which means the moment of −𝐟 on A about Ao is always zero. Note: This bushing model is not fully symmetric since the orientation between frames A and C is parameterized with roll-pitch-yaw angles [q₀ q₁ q₂]. Since these angles have an inherent sequence, they are not mathematically symmetric.
The torque model depends on spring-damper “gimbal” torques
τ ≜ [τ₀ τ₁ τ₂]
which themselves depend on roll-pitch-yaw anglesq ≜ [q₀ q₁ q₂]
and ratesq̇ = [q̇₀ q̇₁ q̇₂]
via a diagonal torque-stiffness matrix K₀₁₂ and a diagonal torque-damping matrix D₀₁₂ asClick to expand C++ code...
⌈ τ₀ ⌉ ⌈k₀ 0 0⌉ ⌈ q₀ ⌉ ⌈d₀ 0 0⌉ ⌈ q̇₀ ⌉ τ ≜ | τ₁ | = − | 0 k₁ 0| | q₁ | − | 0 d₁ 0| | q̇₁ | ⌊ τ₂ ⌋ ⌊ 0 0 k₂⌋ ⌊ q₂ ⌋ ⌊ 0 0 d₂⌋ ⌊ q̇₂ ⌋
where k₀, k₁, k₂ and d₀, d₁, d₂ are torque stiffness and damping constants and must have non-negative values.
Note
τ does not represent a vector expressed in one frame. Instead it is regarded as a 3x1 array of torque scalars associated with roll-pitch yaw.
Note
As discussed in the Advanced section below, τ is not 𝐭
(τ ≠ 𝐭)
.Note
This is a “linear” bushing model as gimbal torque τ varies linearly with q and q̇ as τ = τᴋ + τᴅ where τᴋ = −K₀₁₂ ⋅ q and τᴅ = −D₀₁₂ ⋅ q̇.
The bushing model for the net force 𝐟 on frame C from the bushing depends on scalars x, y, z which are defined so 𝐫 (the position vector from Ao to Co) can be expressed in frame B as
𝐫 ≜ p_AoCo = [x y z]ʙ = x 𝐁𝐱 + y 𝐁𝐲 + z 𝐁𝐳
. The model for 𝐟 uses a diagonal force-stiffness matrix Kxyᴢ, a diagonal force-damping matrix Dxyᴢ, and defines fx, fy, fz so𝐟 = [fx fy fz]ʙ
.Click to expand C++ code...
⌈ fx ⌉ ⌈kx 0 0⌉ ⌈ x ⌉ ⌈dx 0 0⌉ ⌈ ẋ ⌉ | fy | = − | 0 ky 0| | y | − | 0 dy 0| | ẏ | ⌊ fz ⌋ ⌊ 0 0 kz⌋ ⌊ z ⌋ ⌊ 0 0 dz⌋ ⌊ ż ⌋
where kx, ky, kz and dx, dy, dz are force stiffness and damping constants and must have non-negative values.
Note
This is a “linear” bushing model as the force 𝐟 varies linearly with 𝐫 and 𝐫̇̇ as 𝐟 = 𝐟ᴋ + 𝐟ᴅ where 𝐟ᴋ = −Kxyz ⋅ 𝐫 and 𝐟ᴅ = −Dxyz ⋅ 𝐫̇̇.
This bushing’s constructor sets the torque stiffness/damping constants
[k₀ k₁ k₂]
and[d₀ d₁ d₂]
and the force stiffness/damping constants[kx ky kz]
and[dx dy dz]
. The examples below demonstrate how to model various joints that have a flexible (e.g., rubber) mount. The damping values below with ? may be set to 0 or a reasonable positive number.Bushing type | torque constants | force constants ——————————–|:--------------------|:—————— z-axis revolute joint | k₀₁₂ =
[k₀ k₁ 0]
| kxyz =[kx ky kz]
^ | d₀₁₂ =[d₀ d₁ ?]
| dxyz =[dx dy dz]
x-axis prismatic joint | k₀₁₂ =[k₀ k₁ k₂]
| kxyz =[0 ky kz]
^ | d₀₁₂ =[d₀ d₁ d₂]
| dxyz =[? dy dz]
Ball and socket joint | k₀₁₂ =[0 0 0]
| kxyz =[kx ky kz]
^ | d₀₁₂ =[? ? ?]
| dxyz =[dx dy dz]
Weld/fixed joint | k₀₁₂ =[k₀ k₁ k₂]
| kxyz =[kx ky kz]
^ | d₀₁₂ =[d₀ d₁ d₂]
| dxyz =[dx dy dz]
Angles q₀, q₁, q₂ are calculated from frame C’s orientation relative to frame A, with
[−π < q₀ ≤ π, −π/2 ≤ q₁ ≤ π/2, −π < q₂ ≤ π]
, hence, there is no angle wrapping and torque stiffness has a limited range. Gimbal torques τ can be discontinuous if one of q₀, q₁, q₂ is discontinuous and its associated torque spring constant is nonzero. For example, τ₂ is discontinuous ifk₂ ≠ 0
and the bushing has a large rotation so q₂ jumps from≈ −π to π
. τ can also be discontinuous if one of q̇₀, q̇₁, q̇₂ is discontinuous and its associated torque damper constant is nonzero. For example, τ₀ is discontinuous ifd₀ ≠ 0
and q̇₀ is undefined (which occurs whenpitch = q₁ = π/2
). Note: Due to the relationship of 𝐭 to τ shown below, 𝐭 is discontinuous if τ is discontinuous.As shown below, there are multiple ways to estimate torque and force stiffness and damping constants. Use a method or combination of methods appropriate for your application. For example, some methods are more useful for a real physical bushing whereas other methods (called “penalty methods”) can be more useful when replacing an ideal joint (such as a revolute or fixed/weld joint) with a bushing.
Consider a penalty method if you want a bushing to substitute for a “hard” constraint (e.g., an ideal joint). Since a bushing is inherently compliant it will violate a hard constraint somewhat. The stiffer the bushing, the more accurately it enforces the hard constraint, but at a cost of more computational time. To balance accuracy versus time, consider your tolerance for constraint errors. For example, is it OK for your bushing to displace xₘₐₓ = 1 mm for an estimated Fxₘₐₓ = 100 N? Also, one way to choose a force damping constant dx is by choosing a “reasonably small” settling time tₛ, where settling time tₛ is the interval of time for a system to settle to within 1% (0.01) of an equilibrium solution). Is tₛ = 0.01 s negligible for a robot arm with a 10 s reach maneuver?
**** How to choose a torque stiffness constant k₀ or damping constant d₀. The estimate of stiffness k₀ depends on whether you are modeling a physical bushing (consider stiffness methods 1 or 2 below) or whether you are using a bushing to replace an ideal joint such as a revolute or fixed/weld joint (consider stiffness “penalty methods” 3 or 4 below). 1. Use a static experiment, e.g., apply a known moment load Mx, measure the associated angular displacement Δq (radians), and estimate k₀ = Mx / Δq. 2. Use FEA (finite element analysis) software to estimate k₀. 3. Pick a desired maximum angular displacement qₘₐₓ, estimate a maximum moment load Mxₘₐₓ, and estimate
k₀ = Mxₘₐₓ / qₘₐₓ
(units of N*m/rad). 4. Choose a characteristic moment of inertia I₀ (directionally dependent), choose a desired angular frequency ωₙ > 0 (in rad/s) and estimatek₀ = I₀ ωₙ²
(units of N*m/rad).The estimate of damping d₀ depends on whether you are modeling a physical bushing (consider damping method 1 below) or whether you are using a bushing to enforce a constraint (consider damping methods 2 or 3 below). 1. Use experiments to estimate a damping ratio ζ and settling time tₛ. Compute “undamped natural frequency” ωₙ from ζ and tₛ (as shown below in the Advanced section), then
d₀ = 2 ζ k₀ / ωₙ
(units of N*m*s/rad). 2. Choose a damping ratio ζ (e.g., ζ = 1, critical damping) and a desired settling time tₛ, calculate ωₙ (as shown below in the Advanced section), thend₀ = 2 ζ k₀ / ωₙ
(units of N*m*s/rad). 3. Choose a damping ratio ζ (e.g., ζ = 1, critical damping), estimate a characteristic moment of inertia and calculated₀ = 2 ζ √(I₀ k₀)
.Refer to Advanced_bushing_stiffness_and_damping “Advanced bushing stiffness and damping” for more details.
**** How to choose a force stiffness constant kx or damping constant dx. The estimate of stiffness kx depends on whether you are modeling a real bushing (consider stiffness methods 1 or 2 below) or whether you are using a bushing to replace an ideal joint such as a revolute or fixed/weld joint (consider stiffness “penalty methods” 3 or 4 below). 1. Use a static experiment, e.g., apply a known force load Fx, measure the associated displacement (stretch) Δx (in meters), and estimate kx = Fx / Δx. 2. Use FEA (finite element analysis) software to estimate kx (units of N/m). 3. Pick a desired maximum displacement xₘₐₓ, estimate a maximum force load Fxₘₐₓ, and estimate
kx = Fxₘₐₓ / xₘₐₓ
(units of N/m). 4. Choose a characteristic mass m (which may be directionally dependent), choose a desired angular frequency ωₙ > 0 (in rad/s) and estimatekx = m ωₙ²
(units of N/m).The estimate of damping dx depends on whether you are modeling a physical bushing (consider damping method 1 below) or whether you are using a bushing to enforce a constraint (consider damping methods 2 or 3 below). 1. Use experiments to estimate a damping ratio ζ and settling time tₛ. Compute “undamped natural frequency” ωₙ from ζ and tₛ (as shown below in the Advanced section), then
dx = 2 ζ kx / ωₙ
(units of N*s/m). 2. Choose a damping ratio ζ (e.g., ζ = 1, critical damping) and a desired settling time tₛ, calculate ωₙ (as shown below in the Advanced section), thendx = 2 ζ kx / ωₙ
(units of N*s/m). 3. Choose a damping ratio ζ (e.g., ζ = 1, critical damping), estimate a characteristic mass m and calculatedx = 2 ζ √(m kx)
(units of N*s/m).Refer to Advanced_bushing_stiffness_and_damping “Advanced bushing stiffness and damping” for more details.
**** Advanced: Relationship of 𝐭 to τ. To understand how “gimbal torques” τ relate to 𝐭, it helps to remember that the RollPitchYaw class documentation states that a Space-fixed (extrinsic) X-Y-Z rotation with roll-pitch-yaw angles [q₀ q₁ q₂] is equivalent to a Body-fixed (intrinsic) Z-Y-X rotation by yaw-pitch-roll angles [q₂ q₁ q₀]. In the context of “gimbal torques”, the Body-fixed Z-Y-X rotation sequence with angles [q₂ q₁ q₀] is physical meaningful as it produces torques associated with successive frames in a gimbal as τ₂ 𝐀𝐳, τ₁ 𝐏𝐲, τ₀ 𝐂𝐱, where each of 𝐀𝐳, 𝐏𝐲, 𝐂𝐱 are unit vectors associated with a frame in the yaw-pitch-roll rotation sequence and 𝐏𝐲 is a unit vector of the “pitch” intermediate frame. As described earlier, torque 𝐭 is the moment of the bushing forces on frame C about Cp. Scalars tx, ty, tz are defined so 𝐭 can be expressed
𝐭 = [tx ty tz]ᴀ = tx 𝐀𝐱 + ty 𝐀𝐲 + tz 𝐀𝐳
. As shown in code documentation, the relationship of [tx ty tz] to [τ₀ τ₁ τ₂] was found by equating 𝐭’s power to τ’s power as 𝐭 ⋅ w_AC = τ ⋅ q̇.Click to expand C++ code...
⌈ tx ⌉ ⌈ τ₀ ⌉ ⌈ cos(q₂)/cos(q₁) sin(q₂)/cos(q₁) 0 ⌉ | ty | = Nᵀ | τ₁ | where N = | −sin(q2) cos(q2) 0 | ⌊ tz ⌋ ⌊ τ₂ ⌋ ⌊ cos(q₂)*tan(q₁) sin(q₂)*tan(q₁) 1 ⌋
**** Advanced: More on how to choose bushing stiffness and damping constants. The basics on how to choose bushing stiffness and damping constants are at: - Basic_bushing_torque_stiffness_and_damping “How to choose torque stiffness and damping constants” - Basic_bushing_force_stiffness_and_damping “How to choose force stiffness and damping constants”
The list below provides more detail on: The performance tradeoff between high stiffness and long simulation time; loads that affect estimates of Mxₘₐₓ or Fxₘₐₓ; and how a linear 2ⁿᵈ-order ODE provides insight on how to experimentally determine stiffness and damping constants. - Stiffness [k₀ k₁ k₂] and [kx ky kz] affect simulation time and accuracy. Generally, a stiffer bushing better resembles an ideal joint (e.g., a revolute joint or fixed/weld joint). However (depending on integrator), a stiffer bushing usually increases numerical integration time. - An estimate for a maximum load Mxₘₐₓ or Fxₘₐₓ accounts for gravity forces, applied forces, inertia forces (centripetal, Coriolis, gyroscopic), etc. - One way to determine physical stiffness and damping constants is through the mathematical intermediaries ωₙ (units of rad/s) and ζ (no units). The constant ωₙ (called “undamped natural frequency” or “angular frequency”) and constant ζ (called “damping ratio”) relate to the physical constants mass m, damping constant dx, and stiffness constant kx via the following prototypical linear constant-coefficient 2ⁿᵈ-order ODEs.
Click to expand C++ code...
m ẍ + dx ẋ + kx x = 0 or alternatively as ẍ + 2 ζ ωₙ ẋ + ωₙ² x = 0 where ωₙ² = kx/m, ζ = dx / (2 √(m kx))
ωₙ and ζ also appear in the related ODEs for rotational systems, namely
Click to expand C++ code...
I₀ q̈ + d₀ q̇ + k₀ q = 0 or alternatively as q̈ + 2 ζ ωₙ q̇ + ωₙ² q = 0 where ωₙ² = k₀/I₀, ζ = d₀ / (2 √(I₀ k₀))
One way to determine ωₙ is from settling time tₛ which approximates the time for a system to settle to within a specified settling ratio of an equilibrium solutions. Typical values for settling ratio are 1% (0.01), 2% (0.02), 5% (0.05), and 10% (0.10). - When ζ < 0.7 (underdamped), a commonly used approximation is ωₙ ≈ -ln(settling_ratio) / (ζ tₛ) which for settling ratios 0.01 and 0.05 give ωₙ ≈ 4.6 / (ζ tₛ) and ωₙ ≈ 3 / (ζ tₛ). Another commonly used approximation is ωₙ ≈ -ln(settling_ratio √(1- ζ²)) / (ζ tₛ). See https://en.wikipedia.org/wiki/Settling_time or the book Modern Control Engineering by Katsuhiko Ogata. Although these approximate formulas for ωₙ are common, they are somewhat inaccurate. Settling time for underdamped systems is discontinuous and requires solving a nonlinear algebraic equation (an iterative process). For more information, see http://www.scielo.org.co/pdf/rfiua/n66/n66a09.pdf [Ramos-Paja, et. al 2012], “Accurate calculation of settling time in second order systems: a photovoltaic application”. Another reference is https://courses.grainger.illinois.edu/ece486/sp2020/laboratory/docs/lab2/estimates.html - When ζ ≈ 1 (critically damped), ωₙ is determined by choosing a settling ratio and then solving for (ωₙ tₛ) via the nonlinear algebraic equation (1 + ωₙ tₛ)*exp(-ωₙ tₛ) = settling_ratio. Settling ratio | ωₙ ————– | ————- 0.01 | 6.64 / tₛ 0.02 | 5.83 / tₛ 0.05 | 4.74 / tₛ 0.10 | 3.89 / tₛ See https://electronics.stackexchange.com/questions/296567/over-and-critically-damped-systems-settling-time - When ζ ≥ 1.01 (overdamped), ωₙ ≈ -ln(2 settling_ratio sz/s₂) / (s₁ tₛ) where sz = √(ζ² - 1), s₁ = ζ - sz, s₂ = ζ + sz. The derivation and approximation error estimates for this overdamped settling time formula is ApproximateOverdampedSettlingTime “below”.
For a real physical bushing, an experiment is one way to estimate damping
constants. For example, to estimate a torque damping constant d₀ associated with underdamped vibrations (damping ratio 0 < ζ < 1), attach the bushing to a massive rod, initially displace the rod by angle Δq, release the rod and measure q(t). From the q(t) measurement, estimate decay ratio (the ratio of successive peak heights above the final steady-state value) calculate logarithmic decrement δ = -ln(decay_ratio), calculate damping ratio ζ = √(δ² / (4π² + δ²)), then calculate d₀ using d₀ = 2 ζ √(I₀ k₀) or d₀ = 2 ζ k₀ / ωₙ. For more information, see https://en.wikipedia.org/wiki/Damping_ratio#Logarithmic_decrement
**** Derivation: Approximate formula for overdamped settling time. Since a literature reference for this formula was not found, the derivation below was done at TRI (it has not been peer reviewed). This formula results from the “dominant pole” solution in the prototypical constant-coefficient linear 2ⁿᵈ-order ODE. For ẋ(0) = 0, mathematics shows poles p₁ = -ωₙ s₁, p₂ = -ωₙ s₂, where sz = √(ζ² - 1), s₁ = ζ - sz, s₂ = ζ + sz. and
Click to expand C++ code...
x(t) / x(0) = p₂/(p₂-p₁) exp(p₁ t) - p₁/(p₂-p₁) exp(p₂ t) = s₂/(s₂-s₁) exp(p₁ t) - s₁/(s₂-s₁) exp(p₂ t) = k/( k-1 ) exp(p₁ t) - 1/( k-1 ) exp(p₂ t) where k = s₂ / s₁ ≈ k/( k-1 ) exp(p₁ t) since p₁ > p₂
Note: k = s₂ / s₁ is real, k > 0, s₂ = k s₁, and p₁ > p₂ (p₁ is less negative then p₂), so exp(p₁ t) decays to zero slower than exp(p₂ t) and exp(p₁ t) ≫ exp(p₂ t) for sufficiently large t. Hence we assume exp(p₂ t) ≈ 0 (which is why p₁ is called the “dominant pole”). Next,
Click to expand C++ code...
k/(k - 1) = s₂ / s₁ / (s₂/s₁ -1) = s₂ / (s₂ - s₁) = s₂ / (2 sz), so x(t) / x(0) ≈ s₂ / (2 sz) exp(-s₁ ωₙ t), hence settling_ratio ≈ s₂ / (2 sz) exp(-s₁ ωₙ tₛ), finally ωₙ ≈ -ln(settling_ratio 2 sz / s₂) / (s₁ tₛ)
The table below shows that there is little error in this approximate formula for various settling ratios and ζ, particularly for ζ ≥ 1.1. For 1.0 ≤ ζ < 1.1, the critical damping estimates of ωₙ work well. Settling ratio | ζ = 1.01 | ζ = 1.1 | ζ = 1.2 | ζ = 1.3 | ζ = 1.5 ————– | ——– | ——- | ——- | ——- | ——– 0.01 | 1.98% | 0.005% | 2.9E-5% | 1.6E-7% | 2.4E-12% 0.02 | 2.91% | 0.016% | 1.8E-4% | 2.1E-6% | 1.6E-10% 0.05 | 5.10% | 0.076% | 2.3E-3% | 7.0E-5% | 4.4E-8% 0.10 | 8.28% | 0.258% | 1.6E-2% | 1.0E-3% | 3.3E-6% Note: There is a related derivation in the reference below, however, it needlessly makes the oversimplified approximation k/(k - 1) ≈ 1. https://electronics.stackexchange.com/questions/296567/over-and-critically-damped-systems-settling-time
Note
The complete theory for this bushing is documented in the source code. Please look there if you want more information.
- Template parameter
T
: The underlying scalar type. Must be a valid Eigen scalar.
See also
math::RollPitchYaw for definitions of roll, pitch, yaw
[q₀ q₁ q₂]
.Note
Per issue #12982, do not directly or indirectly call the following methods as they have not yet been implemented and throw an exception: CalcPotentialEnergy(), CalcConservativePower(), CalcNonConservativePower().
- __init__(self: pydrake.multibody.tree.LinearBushingRollPitchYaw_[Expression], frameA: pydrake.multibody.tree.Frame_[Expression], frameC: pydrake.multibody.tree.Frame_[Expression], torque_stiffness_constants: numpy.ndarray[numpy.float64[3, 1]], torque_damping_constants: numpy.ndarray[numpy.float64[3, 1]], force_stiffness_constants: numpy.ndarray[numpy.float64[3, 1]], force_damping_constants: numpy.ndarray[numpy.float64[3, 1]]) None
Construct a LinearBushingRollPitchYaw B that connects frames A and C, where frame A is welded to a link L0 and frame C is welded to a link L1.
- Parameter
frameA
: frame A of link (body) L0 that connects to bushing B.
- Parameter
frameC
: frame C of link (body) L1 that connects to bushing B.
- Parameter
torque_stiffness_constants
: [k₀ k₁ k₂]
multiply the roll-pitch-yaw angles[q₀ q₁ q₂]
to produce the spring portion of the “gimbal” torques τ₀, τ₁, τ₂. The SI units ofk₀, k₁, k₂
are N*m/rad.- Parameter
torque_damping_constants
: [d₀ d₁ d₂]
multiply the roll-pitch-yaw rates[q̇₀ q̇₁ q̇₂]
to produce the damper portion of the “gimbal” torques τ₀, τ₁, τ₂. The SI units ofd₀, d₁, d₂
are N*m*s/rad.- Parameter
force_stiffness_constants
: [kx ky kz]
multiply the bushing displacements[x y z]
to form 𝐟ᴋ, the spring portion of the force 𝐟 = [fx fy fz]ʙ. The SI units ofkx, ky, kz
are N/m.- Parameter
force_damping_constants
: [dx dy dz]
multiply the bushing displacement rates[ẋ ẏ ż]
to form 𝐟ᴅ, the damper portion of the force 𝐟 = [fx fy fz]ʙ. The SI units ofdx, dy, dz
are N*s/m.
Note
The LinearBushingRollPitchYaw class documentation describes the stiffness and damping constants.
Note
The net moment on C about Co is affected by both the gimbal torque and the moment of 𝐟 about Co. Similarly, for the net moment on A about Ao.
Note
math::RollPitchYaw describes the roll pitch yaw angles q₀, q₁, q₂. The position from Ao to Co is p_AoCo_B = x 𝐁𝐱 + y 𝐁𝐲 + z 𝐁𝐳 = [x y z]ʙ.
Note
The ModelInstanceIndex assigned to this by the constructor is the one assigned to frame C, i.e., frameC.model_instance().
- Precondition:
All the stiffness and damping constants must be non-negative.
- Parameter
- CalcBushingSpatialForceOnFrameA(self: pydrake.multibody.tree.LinearBushingRollPitchYaw_[Expression], context: pydrake.systems.framework.Context_[Expression]) pydrake.multibody.math.SpatialForce_[Expression]
Calculate F_A_A, the bushing’s spatial force on frame A expressed in A. F_A_A contains two vectors: the moment of all bushing forces on A about Ao (−𝐭 + p_AoAp × −𝐟) and the net bushing force on A (−𝐟 expressed in A).
- Parameter
context
: The state of the multibody system.
See also
CalcBushingSpatialForceOnFrameC().
- Raises
RuntimeError if pitch angle is near gimbal-lock. For more info, –
See also
RollPitchYaw::DoesCosPitchAngleViolateGimbalLockTolerance().
- Parameter
- CalcBushingSpatialForceOnFrameC(self: pydrake.multibody.tree.LinearBushingRollPitchYaw_[Expression], context: pydrake.systems.framework.Context_[Expression]) pydrake.multibody.math.SpatialForce_[Expression]
Calculate F_C_C, the bushing’s spatial force on frame C expressed in C. F_C_C contains two vectors: the moment of all bushing forces on C about Co (𝐭 + p_CoCp × 𝐟) and the resultant bushing force on C (𝐟 expressed in C).
- Parameter
context
: The state of the multibody system.
See also
CalcBushingSpatialForceOnFrameA().
- Raises
RuntimeError if pitch angle is near gimbal-lock. For more info, –
See also
RollPitchYaw::DoesCosPitchAngleViolateGimbalLockTolerance().
- Parameter
- force_damping_constants(self: pydrake.multibody.tree.LinearBushingRollPitchYaw_[Expression]) numpy.ndarray[numpy.float64[3, 1]]
Returns the default force damping constants
[dx dy dz]
(units of N*s/m). Refer to Basic_bushing_force_stiffness_and_damping “How to choose force stiffness and damping constants” for more details.
- force_stiffness_constants(self: pydrake.multibody.tree.LinearBushingRollPitchYaw_[Expression]) numpy.ndarray[numpy.float64[3, 1]]
Returns the default force stiffness constants
[kx ky kz]
(units of N/m). Refer to Basic_bushing_force_stiffness_and_damping “How to choose force stiffness and damping constants” for more details.
- frameA(self: pydrake.multibody.tree.LinearBushingRollPitchYaw_[Expression]) pydrake.multibody.tree.Frame_[Expression]
Returns frame A, which is the frame that is welded to link (body) L0 and attached to the bushing.
- frameC(self: pydrake.multibody.tree.LinearBushingRollPitchYaw_[Expression]) pydrake.multibody.tree.Frame_[Expression]
Returns frame C, which is the frame that is welded to link (body) L1 and attached to the bushing.
- GetForceDampingConstants(self: pydrake.multibody.tree.LinearBushingRollPitchYaw_[Expression], context: pydrake.systems.framework.Context_[Expression]) numpy.ndarray[object[3, 1]]
Returns the force damping constants
[dx dy dz]
(units of N*s/m) stored incontext
.
- GetForceStiffnessConstants(self: pydrake.multibody.tree.LinearBushingRollPitchYaw_[Expression], context: pydrake.systems.framework.Context_[Expression]) numpy.ndarray[object[3, 1]]
Returns the force stiffness constants
[kx ky kz]
(units of N/m) stored incontext
.
- GetTorqueDampingConstants(self: pydrake.multibody.tree.LinearBushingRollPitchYaw_[Expression], context: pydrake.systems.framework.Context_[Expression]) numpy.ndarray[object[3, 1]]
Returns the torque damping constants
[d₀ d₁ d₂]
(units of N*m*s/rad) stored incontext
.
- GetTorqueStiffnessConstants(self: pydrake.multibody.tree.LinearBushingRollPitchYaw_[Expression], context: pydrake.systems.framework.Context_[Expression]) numpy.ndarray[object[3, 1]]
Returns the torque stiffness constants
[k₀ k₁ k₂]
(units of N*m/rad) stored incontext
.
- link0(self: pydrake.multibody.tree.LinearBushingRollPitchYaw_[Expression]) pydrake.multibody.tree.RigidBody_[Expression]
Returns link (body) L0 (frame A is welded to link L0).
- link1(self: pydrake.multibody.tree.LinearBushingRollPitchYaw_[Expression]) pydrake.multibody.tree.RigidBody_[Expression]
Returns link (body) L1 (frame C is welded to link L1).
- SetForceDampingConstants(self: pydrake.multibody.tree.LinearBushingRollPitchYaw_[Expression], context: pydrake.systems.framework.Context_[Expression], force_damping: numpy.ndarray[object[3, 1]]) None
Sets the force damping constants
[dx dy dz]
(units of N*s/m) incontext
.
- SetForceStiffnessConstants(self: pydrake.multibody.tree.LinearBushingRollPitchYaw_[Expression], context: pydrake.systems.framework.Context_[Expression], force_stiffness: numpy.ndarray[object[3, 1]]) None
Sets the force stiffness constants
[kx ky kz]
(units of N/m) incontext
.
- SetTorqueDampingConstants(self: pydrake.multibody.tree.LinearBushingRollPitchYaw_[Expression], context: pydrake.systems.framework.Context_[Expression], torque_damping: numpy.ndarray[object[3, 1]]) None
Sets the torque damping constants
[d₀ d₁ d₂]
(units of N*m*s/rad) incontext
.
- SetTorqueStiffnessConstants(self: pydrake.multibody.tree.LinearBushingRollPitchYaw_[Expression], context: pydrake.systems.framework.Context_[Expression], torque_stiffness: numpy.ndarray[object[3, 1]]) None
Sets the torque stiffness constants
[k₀ k₁ k₂]
(units of N*m/rad) incontext
.
- torque_damping_constants(self: pydrake.multibody.tree.LinearBushingRollPitchYaw_[Expression]) numpy.ndarray[numpy.float64[3, 1]]
Returns the default torque damping constants
[d₀ d₁ d₂]
(units of N*m*s/rad). Refer to Basic_bushing_torque_stiffness_and_damping “How to choose torque stiffness and damping constants” for more details.
- torque_stiffness_constants(self: pydrake.multibody.tree.LinearBushingRollPitchYaw_[Expression]) numpy.ndarray[numpy.float64[3, 1]]
Returns the default torque stiffness constants
[k₀ k₁ k₂]
(units of N*m/rad). Refer to Basic_bushing_torque_stiffness_and_damping “How to choose torque stiffness and damping constants” for more details.
- class pydrake.multibody.tree.LinearSpringDamper
Bases:
pydrake.multibody.tree.ForceElement
This ForceElement models a spring-damper attached between two points on two different bodies. Given a point P on a body A and a point Q on a body B with positions p_AP and p_BQ, respectively, this spring-damper applies equal and opposite forces on bodies A and B according to:
Click to expand C++ code...
f_AP = (k⋅(ℓ - ℓ₀) + c⋅dℓ/dt)⋅r̂ f_BQ = -f_AP
where
ℓ = ‖p_WQ - p_WP‖
is the current length of the spring, dℓ/dt its rate of change,r̂ = (p_WQ - p_WP) / ℓ
is the normalized vector from P to Q, ℓ₀ is the free length of the spring and k and c are the stiffness and damping of the spring-damper, respectively. This ForceElement is meant to model finite free length springs attached between two points. In this typical arrangement springs are usually pre-loaded, meaning they apply a non-zero spring force in the static configuration of the system. Thus, neither the free length ℓ₀ nor the current length ℓ of the spring can ever be zero. The length of the spring approaching zero would incur in a non-physical configuration and therefore this element throws a RuntimeError exception in that case. Note that:The applied force is always along the line connecting points P and
Q. - Damping always dissipates energy. - Forces on bodies A and B are equal and opposite according to Newton’s third law.
Note
This class is templated; see
LinearSpringDamper_
for the list of instantiations.- __init__(self: pydrake.multibody.tree.LinearSpringDamper, bodyA: pydrake.multibody.tree.RigidBody, p_AP: numpy.ndarray[numpy.float64[3, 1]], bodyB: pydrake.multibody.tree.RigidBody, p_BQ: numpy.ndarray[numpy.float64[3, 1]], free_length: float, stiffness: float, damping: float) None
Constructor for a spring-damper between a point P on
bodyA
and a point Q onbodyB
. Point P is defined by its positionp_AP
as measured and expressed in the body frame A and similarly, point Q is defined by its position p_BQ as measured and expressed in body frame B. The remaining parameters define:- Parameter
free_length
: The free length of the spring ℓ₀, in meters, at which the spring applies no forces. Since this force element is meant to model finite length springs, ℓ₀ must be strictly positive.
- Parameter
stiffness
: The stiffness k of the spring in N/m. It must be non-negative.
- Parameter
damping
: The damping c of the damper in N⋅s/m. It must be non-negative. Refer to this class’s documentation for further details.
- Raises
RuntimeError if free_length is negative or zero. –
RuntimeError if stiffness is negative. –
RuntimeError if damping is negative. –
- Parameter
- damping(self: pydrake.multibody.tree.LinearSpringDamper) float
- free_length(self: pydrake.multibody.tree.LinearSpringDamper) float
- p_AP(self: pydrake.multibody.tree.LinearSpringDamper) numpy.ndarray[numpy.float64[3, 1]]
The position p_AP of point P on body A as measured and expressed in body frame A.
- p_BQ(self: pydrake.multibody.tree.LinearSpringDamper) numpy.ndarray[numpy.float64[3, 1]]
The position p_BQ of point Q on body B as measured and expressed in body frame B.
- stiffness(self: pydrake.multibody.tree.LinearSpringDamper) float
- template pydrake.multibody.tree.LinearSpringDamper_
Instantiations:
LinearSpringDamper_[float]
,LinearSpringDamper_[AutoDiffXd]
,LinearSpringDamper_[Expression]
- class pydrake.multibody.tree.LinearSpringDamper_[AutoDiffXd]
Bases:
pydrake.multibody.tree.ForceElement_[AutoDiffXd]
This ForceElement models a spring-damper attached between two points on two different bodies. Given a point P on a body A and a point Q on a body B with positions p_AP and p_BQ, respectively, this spring-damper applies equal and opposite forces on bodies A and B according to:
Click to expand C++ code...
f_AP = (k⋅(ℓ - ℓ₀) + c⋅dℓ/dt)⋅r̂ f_BQ = -f_AP
where
ℓ = ‖p_WQ - p_WP‖
is the current length of the spring, dℓ/dt its rate of change,r̂ = (p_WQ - p_WP) / ℓ
is the normalized vector from P to Q, ℓ₀ is the free length of the spring and k and c are the stiffness and damping of the spring-damper, respectively. This ForceElement is meant to model finite free length springs attached between two points. In this typical arrangement springs are usually pre-loaded, meaning they apply a non-zero spring force in the static configuration of the system. Thus, neither the free length ℓ₀ nor the current length ℓ of the spring can ever be zero. The length of the spring approaching zero would incur in a non-physical configuration and therefore this element throws a RuntimeError exception in that case. Note that:The applied force is always along the line connecting points P and
Q. - Damping always dissipates energy. - Forces on bodies A and B are equal and opposite according to Newton’s third law.
- __init__(self: pydrake.multibody.tree.LinearSpringDamper_[AutoDiffXd], bodyA: pydrake.multibody.tree.RigidBody_[AutoDiffXd], p_AP: numpy.ndarray[numpy.float64[3, 1]], bodyB: pydrake.multibody.tree.RigidBody_[AutoDiffXd], p_BQ: numpy.ndarray[numpy.float64[3, 1]], free_length: float, stiffness: float, damping: float) None
Constructor for a spring-damper between a point P on
bodyA
and a point Q onbodyB
. Point P is defined by its positionp_AP
as measured and expressed in the body frame A and similarly, point Q is defined by its position p_BQ as measured and expressed in body frame B. The remaining parameters define:- Parameter
free_length
: The free length of the spring ℓ₀, in meters, at which the spring applies no forces. Since this force element is meant to model finite length springs, ℓ₀ must be strictly positive.
- Parameter
stiffness
: The stiffness k of the spring in N/m. It must be non-negative.
- Parameter
damping
: The damping c of the damper in N⋅s/m. It must be non-negative. Refer to this class’s documentation for further details.
- Raises
RuntimeError if free_length is negative or zero. –
RuntimeError if stiffness is negative. –
RuntimeError if damping is negative. –
- Parameter
- bodyA(self: pydrake.multibody.tree.LinearSpringDamper_[AutoDiffXd]) pydrake.multibody.tree.RigidBody_[AutoDiffXd]
- bodyB(self: pydrake.multibody.tree.LinearSpringDamper_[AutoDiffXd]) pydrake.multibody.tree.RigidBody_[AutoDiffXd]
- damping(self: pydrake.multibody.tree.LinearSpringDamper_[AutoDiffXd]) float
- free_length(self: pydrake.multibody.tree.LinearSpringDamper_[AutoDiffXd]) float
- p_AP(self: pydrake.multibody.tree.LinearSpringDamper_[AutoDiffXd]) numpy.ndarray[numpy.float64[3, 1]]
The position p_AP of point P on body A as measured and expressed in body frame A.
- p_BQ(self: pydrake.multibody.tree.LinearSpringDamper_[AutoDiffXd]) numpy.ndarray[numpy.float64[3, 1]]
The position p_BQ of point Q on body B as measured and expressed in body frame B.
- stiffness(self: pydrake.multibody.tree.LinearSpringDamper_[AutoDiffXd]) float
- class pydrake.multibody.tree.LinearSpringDamper_[Expression]
Bases:
pydrake.multibody.tree.ForceElement_[Expression]
This ForceElement models a spring-damper attached between two points on two different bodies. Given a point P on a body A and a point Q on a body B with positions p_AP and p_BQ, respectively, this spring-damper applies equal and opposite forces on bodies A and B according to:
Click to expand C++ code...
f_AP = (k⋅(ℓ - ℓ₀) + c⋅dℓ/dt)⋅r̂ f_BQ = -f_AP
where
ℓ = ‖p_WQ - p_WP‖
is the current length of the spring, dℓ/dt its rate of change,r̂ = (p_WQ - p_WP) / ℓ
is the normalized vector from P to Q, ℓ₀ is the free length of the spring and k and c are the stiffness and damping of the spring-damper, respectively. This ForceElement is meant to model finite free length springs attached between two points. In this typical arrangement springs are usually pre-loaded, meaning they apply a non-zero spring force in the static configuration of the system. Thus, neither the free length ℓ₀ nor the current length ℓ of the spring can ever be zero. The length of the spring approaching zero would incur in a non-physical configuration and therefore this element throws a RuntimeError exception in that case. Note that:The applied force is always along the line connecting points P and
Q. - Damping always dissipates energy. - Forces on bodies A and B are equal and opposite according to Newton’s third law.
- __init__(self: pydrake.multibody.tree.LinearSpringDamper_[Expression], bodyA: pydrake.multibody.tree.RigidBody_[Expression], p_AP: numpy.ndarray[numpy.float64[3, 1]], bodyB: pydrake.multibody.tree.RigidBody_[Expression], p_BQ: numpy.ndarray[numpy.float64[3, 1]], free_length: float, stiffness: float, damping: float) None
Constructor for a spring-damper between a point P on
bodyA
and a point Q onbodyB
. Point P is defined by its positionp_AP
as measured and expressed in the body frame A and similarly, point Q is defined by its position p_BQ as measured and expressed in body frame B. The remaining parameters define:- Parameter
free_length
: The free length of the spring ℓ₀, in meters, at which the spring applies no forces. Since this force element is meant to model finite length springs, ℓ₀ must be strictly positive.
- Parameter
stiffness
: The stiffness k of the spring in N/m. It must be non-negative.
- Parameter
damping
: The damping c of the damper in N⋅s/m. It must be non-negative. Refer to this class’s documentation for further details.
- Raises
RuntimeError if free_length is negative or zero. –
RuntimeError if stiffness is negative. –
RuntimeError if damping is negative. –
- Parameter
- bodyA(self: pydrake.multibody.tree.LinearSpringDamper_[Expression]) pydrake.multibody.tree.RigidBody_[Expression]
- bodyB(self: pydrake.multibody.tree.LinearSpringDamper_[Expression]) pydrake.multibody.tree.RigidBody_[Expression]
- damping(self: pydrake.multibody.tree.LinearSpringDamper_[Expression]) float
- free_length(self: pydrake.multibody.tree.LinearSpringDamper_[Expression]) float
- p_AP(self: pydrake.multibody.tree.LinearSpringDamper_[Expression]) numpy.ndarray[numpy.float64[3, 1]]
The position p_AP of point P on body A as measured and expressed in body frame A.
- p_BQ(self: pydrake.multibody.tree.LinearSpringDamper_[Expression]) numpy.ndarray[numpy.float64[3, 1]]
The position p_BQ of point Q on body B as measured and expressed in body frame B.
- stiffness(self: pydrake.multibody.tree.LinearSpringDamper_[Expression]) float
- class pydrake.multibody.tree.ModelInstanceIndex
Type used to identify model instances by index within a multibody plant.
- __init__(*args, **kwargs)
Overloaded function.
__init__(self: pydrake.multibody.tree.ModelInstanceIndex) -> None
Default constructor; the result is an invalid index. This only exists to serve applications which require a default constructor.
__init__(self: pydrake.multibody.tree.ModelInstanceIndex, arg0: int) -> None
Construction from a non-negative
int
value. The value must lie in the range of [0, 2³¹). Constructor only promises to test validity in Debug build.
- is_valid(self: pydrake.multibody.tree.ModelInstanceIndex) bool
Reports if the index is valid–the only operation on an invalid index that doesn’t throw an exception in Debug builds.
- class pydrake.multibody.tree.MultibodyConstraintId
Type used to identify constraint by id within a multibody plant.
- __init__(*args, **kwargs)
- static get_new_id() pydrake.multibody.tree.MultibodyConstraintId
Generates a new identifier for this id type. This new identifier will be different from all previous identifiers created. This method does not make any guarantees about the values of ids from successive invocations. This method is guaranteed to be thread safe.
- get_value(self: pydrake.multibody.tree.MultibodyConstraintId) int
Extracts the underlying representation from the identifier. This is considered invalid for invalid ids and is strictly enforced in Debug builds.
- is_valid(self: pydrake.multibody.tree.MultibodyConstraintId) bool
Reports if the id is valid.
- class pydrake.multibody.tree.MultibodyForces
A class to hold a set of forces applied to a MultibodyTree system. Forces can include generalized forces as well as body spatial forces. MultibodyPlant::CalcGeneralizedForces() can be used to compute the total generalized force, combining generalized_forces() and body_forces().
Note
This class is templated; see
MultibodyForces_
for the list of instantiations.- __init__(*args, **kwargs)
Overloaded function.
__init__(self: pydrake.multibody.tree.MultibodyForces, plant: drake::multibody::MultibodyPlant<double>) -> None
Constructs a force object to store a set of forces to be applied to the multibody model for
plant
. Forces are initialized to zero, meaning no forces are applied.plant
must have been already finalized with MultibodyPlant::Finalize() or this constructor will abort.__init__(self: pydrake.multibody.tree.MultibodyForces, nb: int, nv: int) -> None
Number of bodies and number of generalized velocities overload. This constructor is useful for constructing the MultibodyForces structure before a MultibodyPlant has been constructed.
- AddInForces(self: pydrake.multibody.tree.MultibodyForces, addend: pydrake.multibody.tree.MultibodyForces) None
Adds into
this
the force contribution stored inaddend
.
- generalized_forces(self: pydrake.multibody.tree.MultibodyForces) numpy.ndarray[numpy.float64[m, 1]]
(Advanced) Returns a constant reference to the vector of generalized forces stored by
this
forces object.
- mutable_generalized_forces(self: pydrake.multibody.tree.MultibodyForces) numpy.ndarray[numpy.float64[m, 1]]
(Advanced) Mutable version of generalized_forces().
- num_bodies(self: pydrake.multibody.tree.MultibodyForces) int
Returns the number of bodies for which
this
force object applies. Determined at construction from the given model MultibodyTree object.
- num_velocities(self: pydrake.multibody.tree.MultibodyForces) int
Returns the number of generalized velocities for the model to which these forces apply. The number of generalized forces in a multibody model always equals the number of generalized velocities. Determined at construction from the given model MultibodyTree object.
- SetZero(self: pydrake.multibody.tree.MultibodyForces) pydrake.multibody.tree.MultibodyForces
Sets
this
to store zero forces (no applied forces).
- template pydrake.multibody.tree.MultibodyForces_
Instantiations:
MultibodyForces_[float]
,MultibodyForces_[AutoDiffXd]
,MultibodyForces_[Expression]
- class pydrake.multibody.tree.MultibodyForces_[AutoDiffXd]
A class to hold a set of forces applied to a MultibodyTree system. Forces can include generalized forces as well as body spatial forces. MultibodyPlant::CalcGeneralizedForces() can be used to compute the total generalized force, combining generalized_forces() and body_forces().
- __init__(*args, **kwargs)
Overloaded function.
__init__(self: pydrake.multibody.tree.MultibodyForces_[AutoDiffXd], plant: drake::multibody::MultibodyPlant<Eigen::AutoDiffScalar<Eigen::Matrix<double, -1, 1, 0, -1, 1> > >) -> None
Constructs a force object to store a set of forces to be applied to the multibody model for
plant
. Forces are initialized to zero, meaning no forces are applied.plant
must have been already finalized with MultibodyPlant::Finalize() or this constructor will abort.__init__(self: pydrake.multibody.tree.MultibodyForces_[AutoDiffXd], nb: int, nv: int) -> None
Number of bodies and number of generalized velocities overload. This constructor is useful for constructing the MultibodyForces structure before a MultibodyPlant has been constructed.
- AddInForces(self: pydrake.multibody.tree.MultibodyForces_[AutoDiffXd], addend: pydrake.multibody.tree.MultibodyForces_[AutoDiffXd]) None
Adds into
this
the force contribution stored inaddend
.
- generalized_forces(self: pydrake.multibody.tree.MultibodyForces_[AutoDiffXd]) numpy.ndarray[object[m, 1]]
(Advanced) Returns a constant reference to the vector of generalized forces stored by
this
forces object.
- mutable_generalized_forces(self: pydrake.multibody.tree.MultibodyForces_[AutoDiffXd]) numpy.ndarray[object[m, 1]]
(Advanced) Mutable version of generalized_forces().
- num_bodies(self: pydrake.multibody.tree.MultibodyForces_[AutoDiffXd]) int
Returns the number of bodies for which
this
force object applies. Determined at construction from the given model MultibodyTree object.
- num_velocities(self: pydrake.multibody.tree.MultibodyForces_[AutoDiffXd]) int
Returns the number of generalized velocities for the model to which these forces apply. The number of generalized forces in a multibody model always equals the number of generalized velocities. Determined at construction from the given model MultibodyTree object.
- SetZero(self: pydrake.multibody.tree.MultibodyForces_[AutoDiffXd]) pydrake.multibody.tree.MultibodyForces_[AutoDiffXd]
Sets
this
to store zero forces (no applied forces).
- class pydrake.multibody.tree.MultibodyForces_[Expression]
A class to hold a set of forces applied to a MultibodyTree system. Forces can include generalized forces as well as body spatial forces. MultibodyPlant::CalcGeneralizedForces() can be used to compute the total generalized force, combining generalized_forces() and body_forces().
- __init__(*args, **kwargs)
Overloaded function.
__init__(self: pydrake.multibody.tree.MultibodyForces_[Expression], plant: drake::multibody::MultibodyPlant<drake::symbolic::Expression>) -> None
Constructs a force object to store a set of forces to be applied to the multibody model for
plant
. Forces are initialized to zero, meaning no forces are applied.plant
must have been already finalized with MultibodyPlant::Finalize() or this constructor will abort.__init__(self: pydrake.multibody.tree.MultibodyForces_[Expression], nb: int, nv: int) -> None
Number of bodies and number of generalized velocities overload. This constructor is useful for constructing the MultibodyForces structure before a MultibodyPlant has been constructed.
- AddInForces(self: pydrake.multibody.tree.MultibodyForces_[Expression], addend: pydrake.multibody.tree.MultibodyForces_[Expression]) None
Adds into
this
the force contribution stored inaddend
.
- generalized_forces(self: pydrake.multibody.tree.MultibodyForces_[Expression]) numpy.ndarray[object[m, 1]]
(Advanced) Returns a constant reference to the vector of generalized forces stored by
this
forces object.
- mutable_generalized_forces(self: pydrake.multibody.tree.MultibodyForces_[Expression]) numpy.ndarray[object[m, 1]]
(Advanced) Mutable version of generalized_forces().
- num_bodies(self: pydrake.multibody.tree.MultibodyForces_[Expression]) int
Returns the number of bodies for which
this
force object applies. Determined at construction from the given model MultibodyTree object.
- num_velocities(self: pydrake.multibody.tree.MultibodyForces_[Expression]) int
Returns the number of generalized velocities for the model to which these forces apply. The number of generalized forces in a multibody model always equals the number of generalized velocities. Determined at construction from the given model MultibodyTree object.
- SetZero(self: pydrake.multibody.tree.MultibodyForces_[Expression]) pydrake.multibody.tree.MultibodyForces_[Expression]
Sets
this
to store zero forces (no applied forces).
- class pydrake.multibody.tree.PdControllerGains
PD controller gains. This enables the modeling of a simple low level PD controllers, see JointActuator::set_controller_gains().
- __init__(self: pydrake.multibody.tree.PdControllerGains, **kwargs) None
- property d
- property p
- class pydrake.multibody.tree.PlanarJoint
Bases:
pydrake.multibody.tree.Joint
This joint models a planar joint allowing two bodies to translate and rotate relative to one another in a plane with three degrees of freedom. That is, given a frame F attached to the parent body P and a frame M attached to the child body B (see the Joint class’s documentation), this joint allows frame M to translate within the x-y plane of frame F and to rotate about the z-axis, with M’s z-axis Mz and F’s z-axis Fz coincident at all times. The translations along the x- and y-axes of F, the rotation about the z-axis and their rates specify the state of the joint. Zero (x, y, θ) corresponds to frames F and M being coincident and aligned. Translation (x, y) is defined to be positive in the direction of the respective axes and the rotation θ is defined to be positive according to the right-hand-rule with the thumb aligned in the direction of frame F’s z-axis.
Note
This class is templated; see
PlanarJoint_
for the list of instantiations.- __init__(self: pydrake.multibody.tree.PlanarJoint, name: str, frame_on_parent: pydrake.multibody.tree.Frame, frame_on_child: pydrake.multibody.tree.Frame, damping: numpy.ndarray[numpy.float64[3, 1]] = array([0., 0., 0.])) None
Constructor to create a planar joint between two bodies so that frame F attached to the parent body P and frame M attached to the child body B translate and rotate as described in the class’s documentation. This constructor signature creates a joint with no joint limits, i.e. the joint position, velocity and acceleration limits are the pair
(-∞, ∞)
. These can be set using the Joint methods set_position_limits(), set_velocity_limits() and set_acceleration_limits(). The first three arguments to this constructor are those of the Joint class constructor. See the Joint class’s documentation for details. The additional parameters are:- Parameter
damping
: Viscous damping coefficient, in N⋅s/m for translation and N⋅m⋅s for rotation, used to model losses within the joint. See documentation of default_damping() for details on modelling of the damping force and torque.
- Raises
RuntimeError if any element of damping is negative. –
- Parameter
- default_damping(self: pydrake.multibody.tree.PlanarJoint) numpy.ndarray[numpy.float64[3, 1]]
Returns
this
joint’s default damping constant in N⋅s/m for the translational degrees and N⋅m⋅s for the rotational degree. The damping force (in N) is modeled asfᵢ = -dampingᵢ⋅vᵢ, i = 1, 2
i.e. opposing motion, with vᵢ the translation rates along the i-th axis forthis
joint (see get_translational_velocity()) and fᵢ the force on child body B at Mo and expressed in F. That is, f_BMo_F = (f₁, f₂). The damping torque (in N⋅m) is modeled asτ = -damping₃⋅ω
i.e. opposing motion, with ω the angular rate forthis
joint (see get_angular_velocity()) and τ the torque on child body B expressed in frame F as t_B_F = τ⋅Fz_F.
- get_angular_velocity(self: pydrake.multibody.tree.PlanarJoint, context: pydrake.systems.framework.Context) float
Gets the rate of change, in radians per second, of
this
joint’s angle θ fromcontext
. See class documentation for the definition of this angle.- Parameter
context
: The context of the model this joint belongs to.
- Returns
theta_dot
: The rate of change of
this
joint’s angle θ as stored in thecontext
.
- Parameter
- get_default_rotation(self: pydrake.multibody.tree.PlanarJoint) float
Gets the default angle for
this
joint.- Returns
theta
: The default angle of
this
joint.
- Returns
- get_default_translation(self: pydrake.multibody.tree.PlanarJoint) numpy.ndarray[numpy.float64[2, 1]]
Gets the default position for
this
joint.- Returns
p_FoMo_F
: The default position of
this
joint.
- Returns
- get_rotation(self: pydrake.multibody.tree.PlanarJoint, context: pydrake.systems.framework.Context) float
Gets the angle θ of
this
joint fromcontext
.- Parameter
context
: The context of the model this joint belongs to.
- Returns
theta
: The angle of
this
joint stored in thecontext
. See class documentation for details.
- Parameter
- get_translation(self: pydrake.multibody.tree.PlanarJoint, context: pydrake.systems.framework.Context) numpy.ndarray[numpy.float64[2, 1]]
Gets the position of
this
joint fromcontext
.- Parameter
context
: The context of the model this joint belongs to.
- Returns
p_FoMo_F
: The position of
this
joint stored in thecontext
ordered as (x, y). See class documentation for details.
- Parameter
- get_translational_velocity(self: pydrake.multibody.tree.PlanarJoint, context: pydrake.systems.framework.Context) numpy.ndarray[numpy.float64[2, 1]]
Gets the translational velocity v_FoMo_F, in meters per second, of
this
joint’s Mo measured and expressed in frame F fromcontext
.- Parameter
context
: The context of the model this joint belongs to.
- Returns
v_FoMo_F
: The translational velocity of
this
joint as stored in thecontext
.
- Parameter
- kTypeName = 'planar'
- set_angular_velocity(self: pydrake.multibody.tree.PlanarJoint, context: pydrake.systems.framework.Context, theta_dot: float) pydrake.multibody.tree.PlanarJoint
Sets the rate of change, in radians per second, of
this
joint’s angle θ (see class documentation) totheta_dot
. The new rate of change gets stored incontext
.- Parameter
context
: The context of the model this joint belongs to.
- Parameter
theta_dot
: The desired rates of change of
this
joint’s angle in radians per second.
- Returns
a constant reference to
this
joint.
- Parameter
- set_default_pose(self: pydrake.multibody.tree.PlanarJoint, p_FoMo_F: numpy.ndarray[numpy.float64[2, 1]], theta: float) None
Sets the default position and angle of this joint.
- Parameter
p_FoMo_F
: The desired default position of the joint
- Parameter
theta
: The desired default angle of the joint
- Parameter
- set_default_rotation(self: pydrake.multibody.tree.PlanarJoint, theta: float) None
Sets the default angle of this joint.
- Parameter
theta
: The desired default angle of the joint
- Parameter
- set_default_translation(self: pydrake.multibody.tree.PlanarJoint, p_FoMo_F: numpy.ndarray[numpy.float64[2, 1]]) None
Sets the default position of this joint.
- Parameter
p_FoMo_F
: The desired default position of the joint
- Parameter
- set_pose(self: pydrake.multibody.tree.PlanarJoint, context: pydrake.systems.framework.Context, p_FoMo_F: numpy.ndarray[numpy.float64[2, 1]], theta: float) pydrake.multibody.tree.PlanarJoint
Sets the
context
so that the position ofthis
joint equalsp_FoMo_F
and its angle equalstheta
.- Parameter
context
: The context of the model this joint belongs to.
- Parameter
p_FoMo_F
: The desired position in meters to be stored in
context
ordered as (x, y). See class documentation for details.- Parameter
theta
: The desired angle in radians to be stored in
context
. See class documentation for details.
- Returns
a constant reference to
this
joint.
- Parameter
- set_random_pose_distribution(self: pydrake.multibody.tree.PlanarJoint, p_FoMo_F: numpy.ndarray[object[2, 1]], theta: pydrake.symbolic.Expression) None
Sets the random distribution that the position and angle of this joint will be randomly sampled from. See class documentation for details on the definition of the position and angle.
- set_rotation(self: pydrake.multibody.tree.PlanarJoint, context: pydrake.systems.framework.Context, theta: float) pydrake.multibody.tree.PlanarJoint
Sets the
context
so that the angle θ ofthis
joint equalstheta
.- Parameter
context
: The context of the model this joint belongs to.
- Parameter
theta
: The desired angle in radians to be stored in
context
. See class documentation for details.
- Returns
a constant reference to
this
joint.
- Parameter
- set_translation(self: pydrake.multibody.tree.PlanarJoint, context: pydrake.systems.framework.Context, p_FoMo_F: numpy.ndarray[numpy.float64[2, 1]]) pydrake.multibody.tree.PlanarJoint
Sets the
context
so that the position ofthis
joint equalsp_FoMo_F
.- Parameter
context
: The context of the model this joint belongs to.
- Parameter
p_FoMo_F
: The desired position in meters to be stored in
context
ordered as (x, y). See class documentation for details.
- Returns
a constant reference to
this
joint.
- Parameter
- set_translational_velocity(self: pydrake.multibody.tree.PlanarJoint, context: pydrake.systems.framework.Context, v_FoMo_F: numpy.ndarray[numpy.float64[2, 1]]) pydrake.multibody.tree.PlanarJoint
Sets the translational velocity, in meters per second, of this
this
joint’s Mo measured and expressed in frame F tov_FoMo_F
. The new translational velocity gets stored incontext
.- Parameter
context
: The context of the model this joint belongs to.
- Parameter
v_FoMo_F
: The desired translational velocity of
this
joint in meters per second.
- Returns
a constant reference to
this
joint.
- Parameter
- template pydrake.multibody.tree.PlanarJoint_
Instantiations:
PlanarJoint_[float]
,PlanarJoint_[AutoDiffXd]
,PlanarJoint_[Expression]
- class pydrake.multibody.tree.PlanarJoint_[AutoDiffXd]
Bases:
pydrake.multibody.tree.Joint_[AutoDiffXd]
This joint models a planar joint allowing two bodies to translate and rotate relative to one another in a plane with three degrees of freedom. That is, given a frame F attached to the parent body P and a frame M attached to the child body B (see the Joint class’s documentation), this joint allows frame M to translate within the x-y plane of frame F and to rotate about the z-axis, with M’s z-axis Mz and F’s z-axis Fz coincident at all times. The translations along the x- and y-axes of F, the rotation about the z-axis and their rates specify the state of the joint. Zero (x, y, θ) corresponds to frames F and M being coincident and aligned. Translation (x, y) is defined to be positive in the direction of the respective axes and the rotation θ is defined to be positive according to the right-hand-rule with the thumb aligned in the direction of frame F’s z-axis.
- __init__(self: pydrake.multibody.tree.PlanarJoint_[AutoDiffXd], name: str, frame_on_parent: pydrake.multibody.tree.Frame_[AutoDiffXd], frame_on_child: pydrake.multibody.tree.Frame_[AutoDiffXd], damping: numpy.ndarray[numpy.float64[3, 1]] = array([0., 0., 0.])) None
Constructor to create a planar joint between two bodies so that frame F attached to the parent body P and frame M attached to the child body B translate and rotate as described in the class’s documentation. This constructor signature creates a joint with no joint limits, i.e. the joint position, velocity and acceleration limits are the pair
(-∞, ∞)
. These can be set using the Joint methods set_position_limits(), set_velocity_limits() and set_acceleration_limits(). The first three arguments to this constructor are those of the Joint class constructor. See the Joint class’s documentation for details. The additional parameters are:- Parameter
damping
: Viscous damping coefficient, in N⋅s/m for translation and N⋅m⋅s for rotation, used to model losses within the joint. See documentation of default_damping() for details on modelling of the damping force and torque.
- Raises
RuntimeError if any element of damping is negative. –
- Parameter
- default_damping(self: pydrake.multibody.tree.PlanarJoint_[AutoDiffXd]) numpy.ndarray[numpy.float64[3, 1]]
Returns
this
joint’s default damping constant in N⋅s/m for the translational degrees and N⋅m⋅s for the rotational degree. The damping force (in N) is modeled asfᵢ = -dampingᵢ⋅vᵢ, i = 1, 2
i.e. opposing motion, with vᵢ the translation rates along the i-th axis forthis
joint (see get_translational_velocity()) and fᵢ the force on child body B at Mo and expressed in F. That is, f_BMo_F = (f₁, f₂). The damping torque (in N⋅m) is modeled asτ = -damping₃⋅ω
i.e. opposing motion, with ω the angular rate forthis
joint (see get_angular_velocity()) and τ the torque on child body B expressed in frame F as t_B_F = τ⋅Fz_F.
- get_angular_velocity(self: pydrake.multibody.tree.PlanarJoint_[AutoDiffXd], context: pydrake.systems.framework.Context_[AutoDiffXd]) pydrake.autodiffutils.AutoDiffXd
Gets the rate of change, in radians per second, of
this
joint’s angle θ fromcontext
. See class documentation for the definition of this angle.- Parameter
context
: The context of the model this joint belongs to.
- Returns
theta_dot
: The rate of change of
this
joint’s angle θ as stored in thecontext
.
- Parameter
- get_default_rotation(self: pydrake.multibody.tree.PlanarJoint_[AutoDiffXd]) float
Gets the default angle for
this
joint.- Returns
theta
: The default angle of
this
joint.
- Returns
- get_default_translation(self: pydrake.multibody.tree.PlanarJoint_[AutoDiffXd]) numpy.ndarray[numpy.float64[2, 1]]
Gets the default position for
this
joint.- Returns
p_FoMo_F
: The default position of
this
joint.
- Returns
- get_rotation(self: pydrake.multibody.tree.PlanarJoint_[AutoDiffXd], context: pydrake.systems.framework.Context_[AutoDiffXd]) pydrake.autodiffutils.AutoDiffXd
Gets the angle θ of
this
joint fromcontext
.- Parameter
context
: The context of the model this joint belongs to.
- Returns
theta
: The angle of
this
joint stored in thecontext
. See class documentation for details.
- Parameter
- get_translation(self: pydrake.multibody.tree.PlanarJoint_[AutoDiffXd], context: pydrake.systems.framework.Context_[AutoDiffXd]) numpy.ndarray[object[2, 1]]
Gets the position of
this
joint fromcontext
.- Parameter
context
: The context of the model this joint belongs to.
- Returns
p_FoMo_F
: The position of
this
joint stored in thecontext
ordered as (x, y). See class documentation for details.
- Parameter
- get_translational_velocity(self: pydrake.multibody.tree.PlanarJoint_[AutoDiffXd], context: pydrake.systems.framework.Context_[AutoDiffXd]) numpy.ndarray[object[2, 1]]
Gets the translational velocity v_FoMo_F, in meters per second, of
this
joint’s Mo measured and expressed in frame F fromcontext
.- Parameter
context
: The context of the model this joint belongs to.
- Returns
v_FoMo_F
: The translational velocity of
this
joint as stored in thecontext
.
- Parameter
- kTypeName = 'planar'
- set_angular_velocity(self: pydrake.multibody.tree.PlanarJoint_[AutoDiffXd], context: pydrake.systems.framework.Context_[AutoDiffXd], theta_dot: pydrake.autodiffutils.AutoDiffXd) pydrake.multibody.tree.PlanarJoint_[AutoDiffXd]
Sets the rate of change, in radians per second, of
this
joint’s angle θ (see class documentation) totheta_dot
. The new rate of change gets stored incontext
.- Parameter
context
: The context of the model this joint belongs to.
- Parameter
theta_dot
: The desired rates of change of
this
joint’s angle in radians per second.
- Returns
a constant reference to
this
joint.
- Parameter
- set_default_pose(self: pydrake.multibody.tree.PlanarJoint_[AutoDiffXd], p_FoMo_F: numpy.ndarray[numpy.float64[2, 1]], theta: float) None
Sets the default position and angle of this joint.
- Parameter
p_FoMo_F
: The desired default position of the joint
- Parameter
theta
: The desired default angle of the joint
- Parameter
- set_default_rotation(self: pydrake.multibody.tree.PlanarJoint_[AutoDiffXd], theta: float) None
Sets the default angle of this joint.
- Parameter
theta
: The desired default angle of the joint
- Parameter
- set_default_translation(self: pydrake.multibody.tree.PlanarJoint_[AutoDiffXd], p_FoMo_F: numpy.ndarray[numpy.float64[2, 1]]) None
Sets the default position of this joint.
- Parameter
p_FoMo_F
: The desired default position of the joint
- Parameter
- set_pose(self: pydrake.multibody.tree.PlanarJoint_[AutoDiffXd], context: pydrake.systems.framework.Context_[AutoDiffXd], p_FoMo_F: numpy.ndarray[object[2, 1]], theta: pydrake.autodiffutils.AutoDiffXd) pydrake.multibody.tree.PlanarJoint_[AutoDiffXd]
Sets the
context
so that the position ofthis
joint equalsp_FoMo_F
and its angle equalstheta
.- Parameter
context
: The context of the model this joint belongs to.
- Parameter
p_FoMo_F
: The desired position in meters to be stored in
context
ordered as (x, y). See class documentation for details.- Parameter
theta
: The desired angle in radians to be stored in
context
. See class documentation for details.
- Returns
a constant reference to
this
joint.
- Parameter
- set_random_pose_distribution(self: pydrake.multibody.tree.PlanarJoint_[AutoDiffXd], p_FoMo_F: numpy.ndarray[object[2, 1]], theta: pydrake.symbolic.Expression) None
Sets the random distribution that the position and angle of this joint will be randomly sampled from. See class documentation for details on the definition of the position and angle.
- set_rotation(self: pydrake.multibody.tree.PlanarJoint_[AutoDiffXd], context: pydrake.systems.framework.Context_[AutoDiffXd], theta: pydrake.autodiffutils.AutoDiffXd) pydrake.multibody.tree.PlanarJoint_[AutoDiffXd]
Sets the
context
so that the angle θ ofthis
joint equalstheta
.- Parameter
context
: The context of the model this joint belongs to.
- Parameter
theta
: The desired angle in radians to be stored in
context
. See class documentation for details.
- Returns
a constant reference to
this
joint.
- Parameter
- set_translation(self: pydrake.multibody.tree.PlanarJoint_[AutoDiffXd], context: pydrake.systems.framework.Context_[AutoDiffXd], p_FoMo_F: numpy.ndarray[object[2, 1]]) pydrake.multibody.tree.PlanarJoint_[AutoDiffXd]
Sets the
context
so that the position ofthis
joint equalsp_FoMo_F
.- Parameter
context
: The context of the model this joint belongs to.
- Parameter
p_FoMo_F
: The desired position in meters to be stored in
context
ordered as (x, y). See class documentation for details.
- Returns
a constant reference to
this
joint.
- Parameter
- set_translational_velocity(self: pydrake.multibody.tree.PlanarJoint_[AutoDiffXd], context: pydrake.systems.framework.Context_[AutoDiffXd], v_FoMo_F: numpy.ndarray[object[2, 1]]) pydrake.multibody.tree.PlanarJoint_[AutoDiffXd]
Sets the translational velocity, in meters per second, of this
this
joint’s Mo measured and expressed in frame F tov_FoMo_F
. The new translational velocity gets stored incontext
.- Parameter
context
: The context of the model this joint belongs to.
- Parameter
v_FoMo_F
: The desired translational velocity of
this
joint in meters per second.
- Returns
a constant reference to
this
joint.
- Parameter
- class pydrake.multibody.tree.PlanarJoint_[Expression]
Bases:
pydrake.multibody.tree.Joint_[Expression]
This joint models a planar joint allowing two bodies to translate and rotate relative to one another in a plane with three degrees of freedom. That is, given a frame F attached to the parent body P and a frame M attached to the child body B (see the Joint class’s documentation), this joint allows frame M to translate within the x-y plane of frame F and to rotate about the z-axis, with M’s z-axis Mz and F’s z-axis Fz coincident at all times. The translations along the x- and y-axes of F, the rotation about the z-axis and their rates specify the state of the joint. Zero (x, y, θ) corresponds to frames F and M being coincident and aligned. Translation (x, y) is defined to be positive in the direction of the respective axes and the rotation θ is defined to be positive according to the right-hand-rule with the thumb aligned in the direction of frame F’s z-axis.
- __init__(self: pydrake.multibody.tree.PlanarJoint_[Expression], name: str, frame_on_parent: pydrake.multibody.tree.Frame_[Expression], frame_on_child: pydrake.multibody.tree.Frame_[Expression], damping: numpy.ndarray[numpy.float64[3, 1]] = array([0., 0., 0.])) None
Constructor to create a planar joint between two bodies so that frame F attached to the parent body P and frame M attached to the child body B translate and rotate as described in the class’s documentation. This constructor signature creates a joint with no joint limits, i.e. the joint position, velocity and acceleration limits are the pair
(-∞, ∞)
. These can be set using the Joint methods set_position_limits(), set_velocity_limits() and set_acceleration_limits(). The first three arguments to this constructor are those of the Joint class constructor. See the Joint class’s documentation for details. The additional parameters are:- Parameter
damping
: Viscous damping coefficient, in N⋅s/m for translation and N⋅m⋅s for rotation, used to model losses within the joint. See documentation of default_damping() for details on modelling of the damping force and torque.
- Raises
RuntimeError if any element of damping is negative. –
- Parameter
- default_damping(self: pydrake.multibody.tree.PlanarJoint_[Expression]) numpy.ndarray[numpy.float64[3, 1]]
Returns
this
joint’s default damping constant in N⋅s/m for the translational degrees and N⋅m⋅s for the rotational degree. The damping force (in N) is modeled asfᵢ = -dampingᵢ⋅vᵢ, i = 1, 2
i.e. opposing motion, with vᵢ the translation rates along the i-th axis forthis
joint (see get_translational_velocity()) and fᵢ the force on child body B at Mo and expressed in F. That is, f_BMo_F = (f₁, f₂). The damping torque (in N⋅m) is modeled asτ = -damping₃⋅ω
i.e. opposing motion, with ω the angular rate forthis
joint (see get_angular_velocity()) and τ the torque on child body B expressed in frame F as t_B_F = τ⋅Fz_F.
- get_angular_velocity(self: pydrake.multibody.tree.PlanarJoint_[Expression], context: pydrake.systems.framework.Context_[Expression]) pydrake.symbolic.Expression
Gets the rate of change, in radians per second, of
this
joint’s angle θ fromcontext
. See class documentation for the definition of this angle.- Parameter
context
: The context of the model this joint belongs to.
- Returns
theta_dot
: The rate of change of
this
joint’s angle θ as stored in thecontext
.
- Parameter
- get_default_rotation(self: pydrake.multibody.tree.PlanarJoint_[Expression]) float
Gets the default angle for
this
joint.- Returns
theta
: The default angle of
this
joint.
- Returns
- get_default_translation(self: pydrake.multibody.tree.PlanarJoint_[Expression]) numpy.ndarray[numpy.float64[2, 1]]
Gets the default position for
this
joint.- Returns
p_FoMo_F
: The default position of
this
joint.
- Returns
- get_rotation(self: pydrake.multibody.tree.PlanarJoint_[Expression], context: pydrake.systems.framework.Context_[Expression]) pydrake.symbolic.Expression
Gets the angle θ of
this
joint fromcontext
.- Parameter
context
: The context of the model this joint belongs to.
- Returns
theta
: The angle of
this
joint stored in thecontext
. See class documentation for details.
- Parameter
- get_translation(self: pydrake.multibody.tree.PlanarJoint_[Expression], context: pydrake.systems.framework.Context_[Expression]) numpy.ndarray[object[2, 1]]
Gets the position of
this
joint fromcontext
.- Parameter
context
: The context of the model this joint belongs to.
- Returns
p_FoMo_F
: The position of
this
joint stored in thecontext
ordered as (x, y). See class documentation for details.
- Parameter
- get_translational_velocity(self: pydrake.multibody.tree.PlanarJoint_[Expression], context: pydrake.systems.framework.Context_[Expression]) numpy.ndarray[object[2, 1]]
Gets the translational velocity v_FoMo_F, in meters per second, of
this
joint’s Mo measured and expressed in frame F fromcontext
.- Parameter
context
: The context of the model this joint belongs to.
- Returns
v_FoMo_F
: The translational velocity of
this
joint as stored in thecontext
.
- Parameter
- kTypeName = 'planar'
- set_angular_velocity(self: pydrake.multibody.tree.PlanarJoint_[Expression], context: pydrake.systems.framework.Context_[Expression], theta_dot: pydrake.symbolic.Expression) pydrake.multibody.tree.PlanarJoint_[Expression]
Sets the rate of change, in radians per second, of
this
joint’s angle θ (see class documentation) totheta_dot
. The new rate of change gets stored incontext
.- Parameter
context
: The context of the model this joint belongs to.
- Parameter
theta_dot
: The desired rates of change of
this
joint’s angle in radians per second.
- Returns
a constant reference to
this
joint.
- Parameter
- set_default_pose(self: pydrake.multibody.tree.PlanarJoint_[Expression], p_FoMo_F: numpy.ndarray[numpy.float64[2, 1]], theta: float) None
Sets the default position and angle of this joint.
- Parameter
p_FoMo_F
: The desired default position of the joint
- Parameter
theta
: The desired default angle of the joint
- Parameter
- set_default_rotation(self: pydrake.multibody.tree.PlanarJoint_[Expression], theta: float) None
Sets the default angle of this joint.
- Parameter
theta
: The desired default angle of the joint
- Parameter
- set_default_translation(self: pydrake.multibody.tree.PlanarJoint_[Expression], p_FoMo_F: numpy.ndarray[numpy.float64[2, 1]]) None
Sets the default position of this joint.
- Parameter
p_FoMo_F
: The desired default position of the joint
- Parameter
- set_pose(self: pydrake.multibody.tree.PlanarJoint_[Expression], context: pydrake.systems.framework.Context_[Expression], p_FoMo_F: numpy.ndarray[object[2, 1]], theta: pydrake.symbolic.Expression) pydrake.multibody.tree.PlanarJoint_[Expression]
Sets the
context
so that the position ofthis
joint equalsp_FoMo_F
and its angle equalstheta
.- Parameter
context
: The context of the model this joint belongs to.
- Parameter
p_FoMo_F
: The desired position in meters to be stored in
context
ordered as (x, y). See class documentation for details.- Parameter
theta
: The desired angle in radians to be stored in
context
. See class documentation for details.
- Returns
a constant reference to
this
joint.
- Parameter
- set_random_pose_distribution(self: pydrake.multibody.tree.PlanarJoint_[Expression], p_FoMo_F: numpy.ndarray[object[2, 1]], theta: pydrake.symbolic.Expression) None
Sets the random distribution that the position and angle of this joint will be randomly sampled from. See class documentation for details on the definition of the position and angle.
- set_rotation(self: pydrake.multibody.tree.PlanarJoint_[Expression], context: pydrake.systems.framework.Context_[Expression], theta: pydrake.symbolic.Expression) pydrake.multibody.tree.PlanarJoint_[Expression]
Sets the
context
so that the angle θ ofthis
joint equalstheta
.- Parameter
context
: The context of the model this joint belongs to.
- Parameter
theta
: The desired angle in radians to be stored in
context
. See class documentation for details.
- Returns
a constant reference to
this
joint.
- Parameter
- set_translation(self: pydrake.multibody.tree.PlanarJoint_[Expression], context: pydrake.systems.framework.Context_[Expression], p_FoMo_F: numpy.ndarray[object[2, 1]]) pydrake.multibody.tree.PlanarJoint_[Expression]
Sets the
context
so that the position ofthis
joint equalsp_FoMo_F
.- Parameter
context
: The context of the model this joint belongs to.
- Parameter
p_FoMo_F
: The desired position in meters to be stored in
context
ordered as (x, y). See class documentation for details.
- Returns
a constant reference to
this
joint.
- Parameter
- set_translational_velocity(self: pydrake.multibody.tree.PlanarJoint_[Expression], context: pydrake.systems.framework.Context_[Expression], v_FoMo_F: numpy.ndarray[object[2, 1]]) pydrake.multibody.tree.PlanarJoint_[Expression]
Sets the translational velocity, in meters per second, of this
this
joint’s Mo measured and expressed in frame F tov_FoMo_F
. The new translational velocity gets stored incontext
.- Parameter
context
: The context of the model this joint belongs to.
- Parameter
v_FoMo_F
: The desired translational velocity of
this
joint in meters per second.
- Returns
a constant reference to
this
joint.
- Parameter
- class pydrake.multibody.tree.PrismaticJoint
Bases:
pydrake.multibody.tree.Joint
This Joint allows two bodies to translate relative to one another along a common axis. That is, given a frame F attached to the parent body P and a frame M attached to the child body B (see the Joint class’s documentation), this Joint allows frames F and M to translate with respect to each other along an axis â. The translation distance is defined positive when child body B translates along the direction of â. Axis â is constant and has the same measures in both frames F and M, that is,
â_F = â_M
.Note
This class is templated; see
PrismaticJoint_
for the list of instantiations.- __init__(self: pydrake.multibody.tree.PrismaticJoint, name: str, frame_on_parent: pydrake.multibody.tree.Frame, frame_on_child: pydrake.multibody.tree.Frame, axis: numpy.ndarray[numpy.float64[3, 1]], pos_lower_limit: float = - inf, pos_upper_limit: float = inf, damping: float = 0) None
Constructor to create a prismatic joint between two bodies so that frame F attached to the parent body P and frame M attached to the child body B, translate relatively to one another along a common axis. See this class’s documentation for further details on the definition of these frames and translation distance. The first three arguments to this constructor are those of the Joint class constructor. See the Joint class’s documentation for details. The additional parameter
axis
is:- Parameter
axis
: A vector in ℝ³ specifying the translation axis for this joint. Given that frame M only translates with respect to F and there is no relative rotation, the measures of
axis
in either frame F or M are exactly the same, that is,axis_F = axis_M
. This vector can have any length, only the direction is used.- Parameter
pos_lower_limit
: Lower position limit, in meters, for the translation coordinate (see get_translation()).
- Parameter
pos_upper_limit
: Upper position limit, in meters, for the translation coordinate (see get_translation()).
- Parameter
damping
: Viscous damping coefficient, in N⋅s/m, used to model losses within the joint. The damping force (in N) is modeled as
f = -damping⋅v
, i.e. opposing motion, with v the translational speed forthis
joint (see get_translation_rate()).
- Raises
RuntimeError if the L2 norm of axis is less than the square –
root of machine epsilon. –
RuntimeError if damping is negative. –
RuntimeError if pos_lower_limit > pos_upper_limit. –
- Parameter
- acceleration_lower_limit(self: pydrake.multibody.tree.PrismaticJoint) float
Returns the acceleration lower limit for
this
joint in meters per second squared.
- acceleration_upper_limit(self: pydrake.multibody.tree.PrismaticJoint) float
Returns the acceleration upper limit for
this
joint in meters per second squared.
- default_damping(self: pydrake.multibody.tree.PrismaticJoint) float
Returns
this
joint’s default damping constant in N⋅s/m.
- get_default_translation(self: pydrake.multibody.tree.PrismaticJoint) float
Gets the default translation. Wrapper for the more general
Joint::default_positions()
.- Returns
The default translation of
this
stored indefault_positions_
.
- get_translation(self: pydrake.multibody.tree.PrismaticJoint, context: pydrake.systems.framework.Context) float
Gets the translation distance of
this
mobilizer fromcontext
.- Parameter
context
: The context of the MultibodyTree this joint belongs to.
- Returns
The translation coordinate of
this
joint read fromcontext
.
- Parameter
- get_translation_rate(self: pydrake.multibody.tree.PrismaticJoint, context: pydrake.systems.framework.Context) float
Gets the rate of change, in meters per second, of
this
joint’s translation distance (see get_translation()) fromcontext
.- Parameter
context
: The context of the MultibodyTree this joint belongs to.
- Returns
The rate of change of
this
joint’s translation read fromcontext
.
- Parameter
- GetDamping(self: pydrake.multibody.tree.PrismaticJoint, context: pydrake.systems.framework.Context) float
Returns the Context dependent damping coefficient stored as a parameter in
context
. Refer to default_damping() for details.- Parameter
context
: The context storing the state and parameters for the model to which
this
joint belongs.
- Parameter
- kTypeName = 'prismatic'
- position_lower_limit(self: pydrake.multibody.tree.PrismaticJoint) float
Returns the position lower limit for
this
joint in meters.
- position_upper_limit(self: pydrake.multibody.tree.PrismaticJoint) float
Returns the position upper limit for
this
joint in meters.
- set_default_damping(self: pydrake.multibody.tree.PrismaticJoint, damping: float) None
Sets the default value of viscous damping for this joint, in N⋅s/m.
- Raises
RuntimeError if damping is negative. –
- Precondition:
the MultibodyPlant must not be finalized.
- set_default_translation(self: pydrake.multibody.tree.PrismaticJoint, translation: float) None
Sets the
default_positions
of this joint (in this case a single translation)- Parameter
translation
: The desired default translation of the joint
- Parameter
- set_random_translation_distribution(self: pydrake.multibody.tree.PrismaticJoint, translation: pydrake.symbolic.Expression) None
- set_translation(self: pydrake.multibody.tree.PrismaticJoint, context: pydrake.systems.framework.Context, translation: float) pydrake.multibody.tree.PrismaticJoint
Sets
context
so that the generalized coordinate corresponding to the translation distance ofthis
joint equalstranslation
.- Parameter
context
: The context of the MultibodyTree this joint belongs to.
- Parameter
translation
: The desired translation in meters to be stored in
context
.
- Returns
a constant reference to
this
joint.
- Parameter
- set_translation_rate(self: pydrake.multibody.tree.PrismaticJoint, context: pydrake.systems.framework.Context, translation_dot: float) pydrake.multibody.tree.PrismaticJoint
Sets the rate of change, in meters per second, of
this
joint’s translation distance totranslation_dot
. The new rate of changetranslation_dot
gets stored incontext
.- Parameter
context
: The context of the MultibodyTree this joint belongs to.
- Parameter
translation_dot
: The desired rate of change of
this
joints’s translation in meters per second.
- Returns
a constant reference to
this
joint.
- Parameter
- SetDamping(self: pydrake.multibody.tree.PrismaticJoint, context: pydrake.systems.framework.Context, damping: float) None
Sets the value of the viscous damping coefficient for this joint, stored as a parameter in
context
. Refer to default_damping() for details.- Parameter
context
: The context storing the state and parameters for the model to which
this
joint belongs.- Parameter
damping
: The damping value.
- Raises
RuntimeError if damping is negative. –
- Parameter
- translation_axis(self: pydrake.multibody.tree.PrismaticJoint) numpy.ndarray[numpy.float64[3, 1]]
Returns the axis of translation for
this
joint as a unit vector. Since the measures of this axis in either frame F or M are the same (see this class’s documentation for frame definitions) then,axis = axis_F = axis_M
.
- velocity_lower_limit(self: pydrake.multibody.tree.PrismaticJoint) float
Returns the velocity lower limit for
this
joint in meters per second.
- velocity_upper_limit(self: pydrake.multibody.tree.PrismaticJoint) float
Returns the velocity upper limit for
this
joint in meters per second.
- template pydrake.multibody.tree.PrismaticJoint_
Instantiations:
PrismaticJoint_[float]
,PrismaticJoint_[AutoDiffXd]
,PrismaticJoint_[Expression]
- class pydrake.multibody.tree.PrismaticJoint_[AutoDiffXd]
Bases:
pydrake.multibody.tree.Joint_[AutoDiffXd]
This Joint allows two bodies to translate relative to one another along a common axis. That is, given a frame F attached to the parent body P and a frame M attached to the child body B (see the Joint class’s documentation), this Joint allows frames F and M to translate with respect to each other along an axis â. The translation distance is defined positive when child body B translates along the direction of â. Axis â is constant and has the same measures in both frames F and M, that is,
â_F = â_M
.- __init__(self: pydrake.multibody.tree.PrismaticJoint_[AutoDiffXd], name: str, frame_on_parent: pydrake.multibody.tree.Frame_[AutoDiffXd], frame_on_child: pydrake.multibody.tree.Frame_[AutoDiffXd], axis: numpy.ndarray[numpy.float64[3, 1]], pos_lower_limit: float = - inf, pos_upper_limit: float = inf, damping: float = 0) None
Constructor to create a prismatic joint between two bodies so that frame F attached to the parent body P and frame M attached to the child body B, translate relatively to one another along a common axis. See this class’s documentation for further details on the definition of these frames and translation distance. The first three arguments to this constructor are those of the Joint class constructor. See the Joint class’s documentation for details. The additional parameter
axis
is:- Parameter
axis
: A vector in ℝ³ specifying the translation axis for this joint. Given that frame M only translates with respect to F and there is no relative rotation, the measures of
axis
in either frame F or M are exactly the same, that is,axis_F = axis_M
. This vector can have any length, only the direction is used.- Parameter
pos_lower_limit
: Lower position limit, in meters, for the translation coordinate (see get_translation()).
- Parameter
pos_upper_limit
: Upper position limit, in meters, for the translation coordinate (see get_translation()).
- Parameter
damping
: Viscous damping coefficient, in N⋅s/m, used to model losses within the joint. The damping force (in N) is modeled as
f = -damping⋅v
, i.e. opposing motion, with v the translational speed forthis
joint (see get_translation_rate()).
- Raises
RuntimeError if the L2 norm of axis is less than the square –
root of machine epsilon. –
RuntimeError if damping is negative. –
RuntimeError if pos_lower_limit > pos_upper_limit. –
- Parameter
- acceleration_lower_limit(self: pydrake.multibody.tree.PrismaticJoint_[AutoDiffXd]) float
Returns the acceleration lower limit for
this
joint in meters per second squared.
- acceleration_upper_limit(self: pydrake.multibody.tree.PrismaticJoint_[AutoDiffXd]) float
Returns the acceleration upper limit for
this
joint in meters per second squared.
- default_damping(self: pydrake.multibody.tree.PrismaticJoint_[AutoDiffXd]) float
Returns
this
joint’s default damping constant in N⋅s/m.
- get_default_translation(self: pydrake.multibody.tree.PrismaticJoint_[AutoDiffXd]) float
Gets the default translation. Wrapper for the more general
Joint::default_positions()
.- Returns
The default translation of
this
stored indefault_positions_
.
- get_translation(self: pydrake.multibody.tree.PrismaticJoint_[AutoDiffXd], context: pydrake.systems.framework.Context_[AutoDiffXd]) pydrake.autodiffutils.AutoDiffXd
Gets the translation distance of
this
mobilizer fromcontext
.- Parameter
context
: The context of the MultibodyTree this joint belongs to.
- Returns
The translation coordinate of
this
joint read fromcontext
.
- Parameter
- get_translation_rate(self: pydrake.multibody.tree.PrismaticJoint_[AutoDiffXd], context: pydrake.systems.framework.Context_[AutoDiffXd]) pydrake.autodiffutils.AutoDiffXd
Gets the rate of change, in meters per second, of
this
joint’s translation distance (see get_translation()) fromcontext
.- Parameter
context
: The context of the MultibodyTree this joint belongs to.
- Returns
The rate of change of
this
joint’s translation read fromcontext
.
- Parameter
- GetDamping(self: pydrake.multibody.tree.PrismaticJoint_[AutoDiffXd], context: pydrake.systems.framework.Context_[AutoDiffXd]) pydrake.autodiffutils.AutoDiffXd
Returns the Context dependent damping coefficient stored as a parameter in
context
. Refer to default_damping() for details.- Parameter
context
: The context storing the state and parameters for the model to which
this
joint belongs.
- Parameter
- kTypeName = 'prismatic'
- position_lower_limit(self: pydrake.multibody.tree.PrismaticJoint_[AutoDiffXd]) float
Returns the position lower limit for
this
joint in meters.
- position_upper_limit(self: pydrake.multibody.tree.PrismaticJoint_[AutoDiffXd]) float
Returns the position upper limit for
this
joint in meters.
- set_default_damping(self: pydrake.multibody.tree.PrismaticJoint_[AutoDiffXd], damping: float) None
Sets the default value of viscous damping for this joint, in N⋅s/m.
- Raises
RuntimeError if damping is negative. –
- Precondition:
the MultibodyPlant must not be finalized.
- set_default_translation(self: pydrake.multibody.tree.PrismaticJoint_[AutoDiffXd], translation: float) None
Sets the
default_positions
of this joint (in this case a single translation)- Parameter
translation
: The desired default translation of the joint
- Parameter
- set_random_translation_distribution(self: pydrake.multibody.tree.PrismaticJoint_[AutoDiffXd], translation: pydrake.symbolic.Expression) None
- set_translation(self: pydrake.multibody.tree.PrismaticJoint_[AutoDiffXd], context: pydrake.systems.framework.Context_[AutoDiffXd], translation: pydrake.autodiffutils.AutoDiffXd) pydrake.multibody.tree.PrismaticJoint_[AutoDiffXd]
Sets
context
so that the generalized coordinate corresponding to the translation distance ofthis
joint equalstranslation
.- Parameter
context
: The context of the MultibodyTree this joint belongs to.
- Parameter
translation
: The desired translation in meters to be stored in
context
.
- Returns
a constant reference to
this
joint.
- Parameter
- set_translation_rate(self: pydrake.multibody.tree.PrismaticJoint_[AutoDiffXd], context: pydrake.systems.framework.Context_[AutoDiffXd], translation_dot: pydrake.autodiffutils.AutoDiffXd) pydrake.multibody.tree.PrismaticJoint_[AutoDiffXd]
Sets the rate of change, in meters per second, of
this
joint’s translation distance totranslation_dot
. The new rate of changetranslation_dot
gets stored incontext
.- Parameter
context
: The context of the MultibodyTree this joint belongs to.
- Parameter
translation_dot
: The desired rate of change of
this
joints’s translation in meters per second.
- Returns
a constant reference to
this
joint.
- Parameter
- SetDamping(self: pydrake.multibody.tree.PrismaticJoint_[AutoDiffXd], context: pydrake.systems.framework.Context_[AutoDiffXd], damping: pydrake.autodiffutils.AutoDiffXd) None
Sets the value of the viscous damping coefficient for this joint, stored as a parameter in
context
. Refer to default_damping() for details.- Parameter
context
: The context storing the state and parameters for the model to which
this
joint belongs.- Parameter
damping
: The damping value.
- Raises
RuntimeError if damping is negative. –
- Parameter
- translation_axis(self: pydrake.multibody.tree.PrismaticJoint_[AutoDiffXd]) numpy.ndarray[numpy.float64[3, 1]]
Returns the axis of translation for
this
joint as a unit vector. Since the measures of this axis in either frame F or M are the same (see this class’s documentation for frame definitions) then,axis = axis_F = axis_M
.
- velocity_lower_limit(self: pydrake.multibody.tree.PrismaticJoint_[AutoDiffXd]) float
Returns the velocity lower limit for
this
joint in meters per second.
- velocity_upper_limit(self: pydrake.multibody.tree.PrismaticJoint_[AutoDiffXd]) float
Returns the velocity upper limit for
this
joint in meters per second.
- class pydrake.multibody.tree.PrismaticJoint_[Expression]
Bases:
pydrake.multibody.tree.Joint_[Expression]
This Joint allows two bodies to translate relative to one another along a common axis. That is, given a frame F attached to the parent body P and a frame M attached to the child body B (see the Joint class’s documentation), this Joint allows frames F and M to translate with respect to each other along an axis â. The translation distance is defined positive when child body B translates along the direction of â. Axis â is constant and has the same measures in both frames F and M, that is,
â_F = â_M
.- __init__(self: pydrake.multibody.tree.PrismaticJoint_[Expression], name: str, frame_on_parent: pydrake.multibody.tree.Frame_[Expression], frame_on_child: pydrake.multibody.tree.Frame_[Expression], axis: numpy.ndarray[numpy.float64[3, 1]], pos_lower_limit: float = - inf, pos_upper_limit: float = inf, damping: float = 0) None
Constructor to create a prismatic joint between two bodies so that frame F attached to the parent body P and frame M attached to the child body B, translate relatively to one another along a common axis. See this class’s documentation for further details on the definition of these frames and translation distance. The first three arguments to this constructor are those of the Joint class constructor. See the Joint class’s documentation for details. The additional parameter
axis
is:- Parameter
axis
: A vector in ℝ³ specifying the translation axis for this joint. Given that frame M only translates with respect to F and there is no relative rotation, the measures of
axis
in either frame F or M are exactly the same, that is,axis_F = axis_M
. This vector can have any length, only the direction is used.- Parameter
pos_lower_limit
: Lower position limit, in meters, for the translation coordinate (see get_translation()).
- Parameter
pos_upper_limit
: Upper position limit, in meters, for the translation coordinate (see get_translation()).
- Parameter
damping
: Viscous damping coefficient, in N⋅s/m, used to model losses within the joint. The damping force (in N) is modeled as
f = -damping⋅v
, i.e. opposing motion, with v the translational speed forthis
joint (see get_translation_rate()).
- Raises
RuntimeError if the L2 norm of axis is less than the square –
root of machine epsilon. –
RuntimeError if damping is negative. –
RuntimeError if pos_lower_limit > pos_upper_limit. –
- Parameter
- acceleration_lower_limit(self: pydrake.multibody.tree.PrismaticJoint_[Expression]) float
Returns the acceleration lower limit for
this
joint in meters per second squared.
- acceleration_upper_limit(self: pydrake.multibody.tree.PrismaticJoint_[Expression]) float
Returns the acceleration upper limit for
this
joint in meters per second squared.
- default_damping(self: pydrake.multibody.tree.PrismaticJoint_[Expression]) float
Returns
this
joint’s default damping constant in N⋅s/m.
- get_default_translation(self: pydrake.multibody.tree.PrismaticJoint_[Expression]) float
Gets the default translation. Wrapper for the more general
Joint::default_positions()
.- Returns
The default translation of
this
stored indefault_positions_
.
- get_translation(self: pydrake.multibody.tree.PrismaticJoint_[Expression], context: pydrake.systems.framework.Context_[Expression]) pydrake.symbolic.Expression
Gets the translation distance of
this
mobilizer fromcontext
.- Parameter
context
: The context of the MultibodyTree this joint belongs to.
- Returns
The translation coordinate of
this
joint read fromcontext
.
- Parameter
- get_translation_rate(self: pydrake.multibody.tree.PrismaticJoint_[Expression], context: pydrake.systems.framework.Context_[Expression]) pydrake.symbolic.Expression
Gets the rate of change, in meters per second, of
this
joint’s translation distance (see get_translation()) fromcontext
.- Parameter
context
: The context of the MultibodyTree this joint belongs to.
- Returns
The rate of change of
this
joint’s translation read fromcontext
.
- Parameter
- GetDamping(self: pydrake.multibody.tree.PrismaticJoint_[Expression], context: pydrake.systems.framework.Context_[Expression]) pydrake.symbolic.Expression
Returns the Context dependent damping coefficient stored as a parameter in
context
. Refer to default_damping() for details.- Parameter
context
: The context storing the state and parameters for the model to which
this
joint belongs.
- Parameter
- kTypeName = 'prismatic'
- position_lower_limit(self: pydrake.multibody.tree.PrismaticJoint_[Expression]) float
Returns the position lower limit for
this
joint in meters.
- position_upper_limit(self: pydrake.multibody.tree.PrismaticJoint_[Expression]) float
Returns the position upper limit for
this
joint in meters.
- set_default_damping(self: pydrake.multibody.tree.PrismaticJoint_[Expression], damping: float) None
Sets the default value of viscous damping for this joint, in N⋅s/m.
- Raises
RuntimeError if damping is negative. –
- Precondition:
the MultibodyPlant must not be finalized.
- set_default_translation(self: pydrake.multibody.tree.PrismaticJoint_[Expression], translation: float) None
Sets the
default_positions
of this joint (in this case a single translation)- Parameter
translation
: The desired default translation of the joint
- Parameter
- set_random_translation_distribution(self: pydrake.multibody.tree.PrismaticJoint_[Expression], translation: pydrake.symbolic.Expression) None
- set_translation(self: pydrake.multibody.tree.PrismaticJoint_[Expression], context: pydrake.systems.framework.Context_[Expression], translation: pydrake.symbolic.Expression) pydrake.multibody.tree.PrismaticJoint_[Expression]
Sets
context
so that the generalized coordinate corresponding to the translation distance ofthis
joint equalstranslation
.- Parameter
context
: The context of the MultibodyTree this joint belongs to.
- Parameter
translation
: The desired translation in meters to be stored in
context
.
- Returns
a constant reference to
this
joint.
- Parameter
- set_translation_rate(self: pydrake.multibody.tree.PrismaticJoint_[Expression], context: pydrake.systems.framework.Context_[Expression], translation_dot: pydrake.symbolic.Expression) pydrake.multibody.tree.PrismaticJoint_[Expression]
Sets the rate of change, in meters per second, of
this
joint’s translation distance totranslation_dot
. The new rate of changetranslation_dot
gets stored incontext
.- Parameter
context
: The context of the MultibodyTree this joint belongs to.
- Parameter
translation_dot
: The desired rate of change of
this
joints’s translation in meters per second.
- Returns
a constant reference to
this
joint.
- Parameter
- SetDamping(self: pydrake.multibody.tree.PrismaticJoint_[Expression], context: pydrake.systems.framework.Context_[Expression], damping: pydrake.symbolic.Expression) None
Sets the value of the viscous damping coefficient for this joint, stored as a parameter in
context
. Refer to default_damping() for details.- Parameter
context
: The context storing the state and parameters for the model to which
this
joint belongs.- Parameter
damping
: The damping value.
- Raises
RuntimeError if damping is negative. –
- Parameter
- translation_axis(self: pydrake.multibody.tree.PrismaticJoint_[Expression]) numpy.ndarray[numpy.float64[3, 1]]
Returns the axis of translation for
this
joint as a unit vector. Since the measures of this axis in either frame F or M are the same (see this class’s documentation for frame definitions) then,axis = axis_F = axis_M
.
- velocity_lower_limit(self: pydrake.multibody.tree.PrismaticJoint_[Expression]) float
Returns the velocity lower limit for
this
joint in meters per second.
- velocity_upper_limit(self: pydrake.multibody.tree.PrismaticJoint_[Expression]) float
Returns the velocity upper limit for
this
joint in meters per second.
- class pydrake.multibody.tree.PrismaticSpring
Bases:
pydrake.multibody.tree.ForceElement
This ForceElement models a linear spring attached to a PrismaticJoint and applies a force to that joint according to
Click to expand C++ code...
f = -k⋅(x - x₀)
where x₀ is the nominal (zero spring force) position in meters, x is the joint position in meters, f is the spring force in Newtons and k is the spring constant in N/m. Note that joint damping exists within the PrismaticJoint itself, and so is not included here.
Note
This is different from the LinearSpringDamper: this PrismaticSpring is associated with a joint, while the LinearSpringDamper connects two bodies.
Note
This class is templated; see
PrismaticSpring_
for the list of instantiations.- __init__(self: pydrake.multibody.tree.PrismaticSpring, joint: pydrake.multibody.tree.PrismaticJoint, nominal_position: float, stiffness: float) None
Constructor for a linear spring attached to the given prismatic joint.
- Parameter
nominal_position
: The nominal position of the spring x₀, in meters, at which the spring applies no force. This is measured the same way as the generalized position of the prismatic joint.
- Parameter
stiffness
: The stiffness k of the spring in N/m.
- Raises
RuntimeError if stiffness is (strictly) negative. –
- Parameter
- nominal_position(self: pydrake.multibody.tree.PrismaticSpring) float
- stiffness(self: pydrake.multibody.tree.PrismaticSpring) float
- template pydrake.multibody.tree.PrismaticSpring_
Instantiations:
PrismaticSpring_[float]
,PrismaticSpring_[AutoDiffXd]
,PrismaticSpring_[Expression]
- class pydrake.multibody.tree.PrismaticSpring_[AutoDiffXd]
Bases:
pydrake.multibody.tree.ForceElement_[AutoDiffXd]
This ForceElement models a linear spring attached to a PrismaticJoint and applies a force to that joint according to
Click to expand C++ code...
f = -k⋅(x - x₀)
where x₀ is the nominal (zero spring force) position in meters, x is the joint position in meters, f is the spring force in Newtons and k is the spring constant in N/m. Note that joint damping exists within the PrismaticJoint itself, and so is not included here.
Note
This is different from the LinearSpringDamper: this PrismaticSpring is associated with a joint, while the LinearSpringDamper connects two bodies.
- __init__(self: pydrake.multibody.tree.PrismaticSpring_[AutoDiffXd], joint: pydrake.multibody.tree.PrismaticJoint_[AutoDiffXd], nominal_position: float, stiffness: float) None
Constructor for a linear spring attached to the given prismatic joint.
- Parameter
nominal_position
: The nominal position of the spring x₀, in meters, at which the spring applies no force. This is measured the same way as the generalized position of the prismatic joint.
- Parameter
stiffness
: The stiffness k of the spring in N/m.
- Raises
RuntimeError if stiffness is (strictly) negative. –
- Parameter
- joint(self: pydrake.multibody.tree.PrismaticSpring_[AutoDiffXd]) pydrake.multibody.tree.PrismaticJoint_[AutoDiffXd]
- nominal_position(self: pydrake.multibody.tree.PrismaticSpring_[AutoDiffXd]) float
- stiffness(self: pydrake.multibody.tree.PrismaticSpring_[AutoDiffXd]) float
- class pydrake.multibody.tree.PrismaticSpring_[Expression]
Bases:
pydrake.multibody.tree.ForceElement_[Expression]
This ForceElement models a linear spring attached to a PrismaticJoint and applies a force to that joint according to
Click to expand C++ code...
f = -k⋅(x - x₀)
where x₀ is the nominal (zero spring force) position in meters, x is the joint position in meters, f is the spring force in Newtons and k is the spring constant in N/m. Note that joint damping exists within the PrismaticJoint itself, and so is not included here.
Note
This is different from the LinearSpringDamper: this PrismaticSpring is associated with a joint, while the LinearSpringDamper connects two bodies.
- __init__(self: pydrake.multibody.tree.PrismaticSpring_[Expression], joint: pydrake.multibody.tree.PrismaticJoint_[Expression], nominal_position: float, stiffness: float) None
Constructor for a linear spring attached to the given prismatic joint.
- Parameter
nominal_position
: The nominal position of the spring x₀, in meters, at which the spring applies no force. This is measured the same way as the generalized position of the prismatic joint.
- Parameter
stiffness
: The stiffness k of the spring in N/m.
- Raises
RuntimeError if stiffness is (strictly) negative. –
- Parameter
- joint(self: pydrake.multibody.tree.PrismaticSpring_[Expression]) pydrake.multibody.tree.PrismaticJoint_[Expression]
- nominal_position(self: pydrake.multibody.tree.PrismaticSpring_[Expression]) float
- stiffness(self: pydrake.multibody.tree.PrismaticSpring_[Expression]) float
- class pydrake.multibody.tree.QuaternionFloatingJoint
Bases:
pydrake.multibody.tree.Joint
This Joint allows two bodies to move freely relatively to one another. That is, given a frame F attached to the parent body P and a frame M attached to the child body B (see the Joint class’s documentation), this Joint allows frame M to translate and rotate freely with respect to F, introducing six degrees of freedom. This Joint introduces four generalized positions to describe the orientation
R_FM
of frame M in F with a quaternionq_FM
, and three generalized positions to describe the translation of frame M’s origin in F with a position vectorp_FM
. The seven entries of the configuration vector q are ordered(q_FM, p_FM)
with the quaternion, ordered wxyz (scalar then vector), preceding the translation vector. As generalized velocities, this Joint introduces the angular velocityw_FM
of frame M in F and the linear velocityv_FM
of frame M’s origin in frame F, ordered(w_FM, v_FM)
.Note
This class is templated; see
QuaternionFloatingJoint_
for the list of instantiations.- __init__(self: pydrake.multibody.tree.QuaternionFloatingJoint, name: str, frame_on_parent: pydrake.multibody.tree.Frame, frame_on_child: pydrake.multibody.tree.Frame, angular_damping: float = 0, translational_damping: float = 0) None
Constructor for a QuaternionFloatingJoint granting six degrees of freedom to an outboard frame M attached to the child body B with respect to an inboard frame F attached to the parent body P. The orientation of frame M in F is represented by a quaternion
q_FM
while the position of F in M is given by a position vectorp_FM
expressed in frame F. See this class’s documentation for further details on the definition of these frames, get_quaternion() and get_translation() for an explanation of the configuration of this joint, and get_angular_velocity() and get_translational_velocity() for an explanation of the generalized velocities.This constructor signature creates a joint with no joint limits, i.e. the joint position, velocity and acceleration limits are the pair
(-∞, ∞)
. These can be set using the Joint methods set_position_limits(), set_velocity_limits() and set_acceleration_limits().The first three arguments to this constructor are those of the Joint class constructor. See the Joint class’s documentation for details. The additional parameters are:
- Parameter
angular_damping
: Viscous damping coefficient in N⋅m⋅s for the angular component of this joint’s velocity, used to model losses within the joint. See documentation of default_angular_damping() for details on modelling of the damping force.
- Parameter
translational_damping
: Viscous damping coefficient in N⋅s/m for the translational component of this joint’s velocity, used to model losses within the joint. See documentation of default_translational_damping() for details on modelling of the damping force.
- Raises
RuntimeError if angular_damping is negative. –
RuntimeError if translational_damping is negative. –
- Parameter
- default_angular_damping(self: pydrake.multibody.tree.QuaternionFloatingJoint) float
Returns
this
joint’s default angular damping constant in N⋅m⋅s. The damping torque (in N⋅m) is modeled asτ = -damping⋅ω
, i.e. opposing motion, with ω the angular velocity of frame M in F (see get_angular_velocity()) and τ the torque on child body B (to which M is rigidly attached).
- default_translational_damping(self: pydrake.multibody.tree.QuaternionFloatingJoint) float
Returns
this
joint’s default translational damping constant in N⋅s/m. The damping force (in N) is modeled asf = -damping⋅v
i.e. opposing motion, with v the translational velocity of frame M in F (see get_translational_velocity()) and f the force on child body B at Mo.
- get_angular_velocity(self: pydrake.multibody.tree.QuaternionFloatingJoint, context: pydrake.systems.framework.Context) numpy.ndarray[numpy.float64[3, 1]]
Retrieves from
context
the angular velocityw_FM
of the child frame M in the parent frame F, expressed in F.- Parameter
context
: A Context for the MultibodyPlant this joint belongs to.
- Returns
w_FM
: A vector in ℝ³ with the angular velocity of the child frame M in the parent frame F, expressed in F. Refer to this class’s documentation for further details and definitions of these frames.
- Parameter
- get_default_quaternion(self: pydrake.multibody.tree.QuaternionFloatingJoint) pydrake.common.eigen_geometry.Quaternion
Gets the default quaternion
q_FM
forthis
joint.- Returns
The default quaternion
q_FM
ofthis
.
- get_default_translation(self: pydrake.multibody.tree.QuaternionFloatingJoint) numpy.ndarray[numpy.float64[3, 1]]
Returns this joint’s default translation as the position vector p_FoMo_F from Fo (inboard frame F’s origin) to Mo (outboard frame M’s origin), expressed in inboard frame F.
- Returns
This
: joint’s default translation as the position vector p_FM.
- Returns
- get_quaternion(self: pydrake.multibody.tree.QuaternionFloatingJoint, context: pydrake.systems.framework.Context) pydrake.common.eigen_geometry.Quaternion
Gets the quaternion
q_FM
that represents the orientation of outboard frame M in the inboard frame F. Refer to the documentation for this class for details.- Parameter
context
: A Context for the MultibodyPlant this joint belongs to.
- Returns
q_FM
: The quaternion representing the orientation of frame M in F.
- Parameter
- get_translation(self: pydrake.multibody.tree.QuaternionFloatingJoint, context: pydrake.systems.framework.Context) numpy.ndarray[numpy.float64[3, 1]]
Returns the position vector p_FoMo_F from Fo (inboard frame F’s origin) to Mo (outboard frame M’s origin), expressed in inboard frame F.
- Parameter
context
: contains the state of the multibody system.
Note
Class documentation describes inboard frame F and outboard frame M.
- Returns
p_FM
: The position vector from Fo (frame F’s origin) to Mo (frame M’s origin), expressed in frame F.
- Parameter
- get_translational_velocity(self: pydrake.multibody.tree.QuaternionFloatingJoint, context: pydrake.systems.framework.Context) numpy.ndarray[numpy.float64[3, 1]]
Retrieves from
context
the translational velocityv_FM
of the child frame M’s origin as measured and expressed in the parent frame F.- Parameter
context
: A Context for the MultibodyPlant this joint belongs to.
- Returns
v_FM
: A vector in ℝ³ with the translational velocity of the origin of child frame M in the parent frame F, expressed in F. Refer to this class’s documentation for further details and definitions of these frames.
- Parameter
- GetPose(self: pydrake.multibody.tree.QuaternionFloatingJoint, context: pydrake.systems.framework.Context) pydrake.math.RigidTransform
Returns the pose
X_FM
of the outboard frame M as measured and expressed in the inboard frame F. Refer to the documentation for this class for details.- Parameter
context
: A Context for the MultibodyPlant this joint belongs to.
- Returns
X_FM
: The pose of frame M in frame F.
- Parameter
- kTypeName = 'quaternion_floating'
- set_angular_velocity(self: pydrake.multibody.tree.QuaternionFloatingJoint, context: pydrake.systems.framework.Context, w_FM: numpy.ndarray[numpy.float64[3, 1]]) pydrake.multibody.tree.QuaternionFloatingJoint
Sets in
context
the state forthis
joint so that the angular velocity of the child frame M in the parent frame F isw_FM
.- Parameter
context
: A Context for the MultibodyPlant this joint belongs to.
- Parameter
w_FM
: A vector in ℝ³ with the angular velocity of the child frame M in the parent frame F, expressed in F. Refer to this class’s documentation for further details and definitions of these frames.
- Returns
a constant reference to
this
joint.
- Parameter
- set_default_quaternion(self: pydrake.multibody.tree.QuaternionFloatingJoint, q_FM: pydrake.common.eigen_geometry.Quaternion) None
Sets the default quaternion
q_FM
of this joint.- Parameter
q_FM
: The desired default quaternion of the joint.
- Parameter
- set_default_translation(self: pydrake.multibody.tree.QuaternionFloatingJoint, translation: numpy.ndarray[numpy.float64[3, 1]]) None
Sets this joint’s default position vector
p_FM
.- Parameter
p_FM
: position vector p_FoMo_F from Fo (inboard frame F’s origin) to Mo (outboard frame M’s origin), expressed in frame F.
- Parameter
- set_random_quaternion_distribution(self: pydrake.multibody.tree.QuaternionFloatingJoint, q_FM: pydrake.common.eigen_geometry.Quaternion_[Expression]) None
(Advanced) Sets the random distribution that the orientation of this joint will be randomly sampled from. If a translation (position) distribution has already been set with stochastic variables, it will remain so. Otherwise translation will be set to this joint’s zero configuration. See get_quaternion() for details on the orientation representation.
Note
Use caution when setting a quaternion distribution. A naive uniform sampling of each component will not lead to a uniform sampling of the unit sphere. See
set_random_quaternion_distribution_to_uniform()
for the most common case of uniformly sampling rotations.
- set_random_quaternion_distribution_to_uniform(self: pydrake.multibody.tree.QuaternionFloatingJoint) None
Sets the random distribution such that the orientation of this joint will be randomly sampled using uniformly sampled rotations.
- set_random_translation_distribution(self: pydrake.multibody.tree.QuaternionFloatingJoint, translation: numpy.ndarray[object[3, 1]]) None
For this joint, sets the random distribution that the translation of this joint will be randomly sampled from. If a quaternion distribution has already been set with stochastic variables, it will remain so. Otherwise the quaternion will be set to this joint’s zero orientation. See get_translation() for details on the translation representation.
- set_translational_velocity(self: pydrake.multibody.tree.QuaternionFloatingJoint, context: pydrake.systems.framework.Context, v_FM: numpy.ndarray[numpy.float64[3, 1]]) pydrake.multibody.tree.QuaternionFloatingJoint
Sets in
context
the state forthis
joint so that the translational velocity of the child frame M’s origin in the parent frame F isv_FM
.- Parameter
context
: A Context for the MultibodyPlant this joint belongs to.
- Parameter
w_FM
: A vector in ℝ³ with the translational velocity of the child frame M’s origin in the parent frame F, expressed in F. Refer to this class’s documentation for further details and definitions of these frames.
- Returns
a constant reference to
this
joint.
- Parameter
- SetOrientation(self: pydrake.multibody.tree.QuaternionFloatingJoint, context: pydrake.systems.framework.Context, R: pydrake.math.RotationMatrix) pydrake.multibody.tree.QuaternionFloatingJoint
Sets the quaternion in
context
so this joint’s orientation is consistent with the givenR_FM
rotation matrix.- Parameter
context
: A Context for the MultibodyPlant this joint belongs to.
- Parameter
R_FM
: The rotation matrix relating the orientation of frame F and frame M.
- Returns
a constant reference to
this
joint.
- Parameter
- SetPose(self: pydrake.multibody.tree.QuaternionFloatingJoint, context: pydrake.systems.framework.Context, X_FM: pydrake.math.RigidTransform) pydrake.multibody.tree.QuaternionFloatingJoint
Sets
context
to storeX_FM
the pose of frame M measured and expressed in frame F.- Parameter
context
: A Context for the MultibodyPlant this joint belongs to.
- Parameter
X_FM
: The desired pose of frame M in frame F to be stored in
context
.
- Returns
a constant reference to
this
joint.
- Parameter
- SetQuaternion(self: pydrake.multibody.tree.QuaternionFloatingJoint, context: pydrake.systems.framework.Context, q_FM: pydrake.common.eigen_geometry.Quaternion) pydrake.multibody.tree.QuaternionFloatingJoint
Sets
context
so that the orientation of frame M in F is given by the input quaternionq_FM
.- Parameter
context
: A Context for the MultibodyPlant this joint belongs to.
- Parameter
q_FM
: Quaternion relating frames F and M to be stored in
context
.
- Returns
a constant reference to
this
joint.
- Parameter
- SetTranslation(self: pydrake.multibody.tree.QuaternionFloatingJoint, context: pydrake.systems.framework.Context, p_FM: numpy.ndarray[numpy.float64[3, 1]]) pydrake.multibody.tree.QuaternionFloatingJoint
For this joint, stores the position vector
p_FM
incontext
.- Parameter
context
: A Context for the MultibodyPlant this joint belongs to.
- Parameter
p_FM
: position vector p_FoMo_F from Fo (inboard frame F’s origin) to Mo (outboard frame M’s origin), expressed in frame F.
- Returns
a constant reference to
this
joint.
- Parameter
- template pydrake.multibody.tree.QuaternionFloatingJoint_
Instantiations:
QuaternionFloatingJoint_[float]
,QuaternionFloatingJoint_[AutoDiffXd]
,QuaternionFloatingJoint_[Expression]
- class pydrake.multibody.tree.QuaternionFloatingJoint_[AutoDiffXd]
Bases:
pydrake.multibody.tree.Joint_[AutoDiffXd]
This Joint allows two bodies to move freely relatively to one another. That is, given a frame F attached to the parent body P and a frame M attached to the child body B (see the Joint class’s documentation), this Joint allows frame M to translate and rotate freely with respect to F, introducing six degrees of freedom. This Joint introduces four generalized positions to describe the orientation
R_FM
of frame M in F with a quaternionq_FM
, and three generalized positions to describe the translation of frame M’s origin in F with a position vectorp_FM
. The seven entries of the configuration vector q are ordered(q_FM, p_FM)
with the quaternion, ordered wxyz (scalar then vector), preceding the translation vector. As generalized velocities, this Joint introduces the angular velocityw_FM
of frame M in F and the linear velocityv_FM
of frame M’s origin in frame F, ordered(w_FM, v_FM)
.- __init__(self: pydrake.multibody.tree.QuaternionFloatingJoint_[AutoDiffXd], name: str, frame_on_parent: pydrake.multibody.tree.Frame_[AutoDiffXd], frame_on_child: pydrake.multibody.tree.Frame_[AutoDiffXd], angular_damping: float = 0, translational_damping: float = 0) None
Constructor for a QuaternionFloatingJoint granting six degrees of freedom to an outboard frame M attached to the child body B with respect to an inboard frame F attached to the parent body P. The orientation of frame M in F is represented by a quaternion
q_FM
while the position of F in M is given by a position vectorp_FM
expressed in frame F. See this class’s documentation for further details on the definition of these frames, get_quaternion() and get_translation() for an explanation of the configuration of this joint, and get_angular_velocity() and get_translational_velocity() for an explanation of the generalized velocities.This constructor signature creates a joint with no joint limits, i.e. the joint position, velocity and acceleration limits are the pair
(-∞, ∞)
. These can be set using the Joint methods set_position_limits(), set_velocity_limits() and set_acceleration_limits().The first three arguments to this constructor are those of the Joint class constructor. See the Joint class’s documentation for details. The additional parameters are:
- Parameter
angular_damping
: Viscous damping coefficient in N⋅m⋅s for the angular component of this joint’s velocity, used to model losses within the joint. See documentation of default_angular_damping() for details on modelling of the damping force.
- Parameter
translational_damping
: Viscous damping coefficient in N⋅s/m for the translational component of this joint’s velocity, used to model losses within the joint. See documentation of default_translational_damping() for details on modelling of the damping force.
- Raises
RuntimeError if angular_damping is negative. –
RuntimeError if translational_damping is negative. –
- Parameter
- default_angular_damping(self: pydrake.multibody.tree.QuaternionFloatingJoint_[AutoDiffXd]) float
Returns
this
joint’s default angular damping constant in N⋅m⋅s. The damping torque (in N⋅m) is modeled asτ = -damping⋅ω
, i.e. opposing motion, with ω the angular velocity of frame M in F (see get_angular_velocity()) and τ the torque on child body B (to which M is rigidly attached).
- default_translational_damping(self: pydrake.multibody.tree.QuaternionFloatingJoint_[AutoDiffXd]) float
Returns
this
joint’s default translational damping constant in N⋅s/m. The damping force (in N) is modeled asf = -damping⋅v
i.e. opposing motion, with v the translational velocity of frame M in F (see get_translational_velocity()) and f the force on child body B at Mo.
- get_angular_velocity(self: pydrake.multibody.tree.QuaternionFloatingJoint_[AutoDiffXd], context: pydrake.systems.framework.Context_[AutoDiffXd]) numpy.ndarray[object[3, 1]]
Retrieves from
context
the angular velocityw_FM
of the child frame M in the parent frame F, expressed in F.- Parameter
context
: A Context for the MultibodyPlant this joint belongs to.
- Returns
w_FM
: A vector in ℝ³ with the angular velocity of the child frame M in the parent frame F, expressed in F. Refer to this class’s documentation for further details and definitions of these frames.
- Parameter
- get_default_quaternion(self: pydrake.multibody.tree.QuaternionFloatingJoint_[AutoDiffXd]) pydrake.common.eigen_geometry.Quaternion
Gets the default quaternion
q_FM
forthis
joint.- Returns
The default quaternion
q_FM
ofthis
.
- get_default_translation(self: pydrake.multibody.tree.QuaternionFloatingJoint_[AutoDiffXd]) numpy.ndarray[numpy.float64[3, 1]]
Returns this joint’s default translation as the position vector p_FoMo_F from Fo (inboard frame F’s origin) to Mo (outboard frame M’s origin), expressed in inboard frame F.
- Returns
This
: joint’s default translation as the position vector p_FM.
- Returns
- get_quaternion(self: pydrake.multibody.tree.QuaternionFloatingJoint_[AutoDiffXd], context: pydrake.systems.framework.Context_[AutoDiffXd]) pydrake.common.eigen_geometry.Quaternion_[AutoDiffXd]
Gets the quaternion
q_FM
that represents the orientation of outboard frame M in the inboard frame F. Refer to the documentation for this class for details.- Parameter
context
: A Context for the MultibodyPlant this joint belongs to.
- Returns
q_FM
: The quaternion representing the orientation of frame M in F.
- Parameter
- get_translation(self: pydrake.multibody.tree.QuaternionFloatingJoint_[AutoDiffXd], context: pydrake.systems.framework.Context_[AutoDiffXd]) numpy.ndarray[object[3, 1]]
Returns the position vector p_FoMo_F from Fo (inboard frame F’s origin) to Mo (outboard frame M’s origin), expressed in inboard frame F.
- Parameter
context
: contains the state of the multibody system.
Note
Class documentation describes inboard frame F and outboard frame M.
- Returns
p_FM
: The position vector from Fo (frame F’s origin) to Mo (frame M’s origin), expressed in frame F.
- Parameter
- get_translational_velocity(self: pydrake.multibody.tree.QuaternionFloatingJoint_[AutoDiffXd], context: pydrake.systems.framework.Context_[AutoDiffXd]) numpy.ndarray[object[3, 1]]
Retrieves from
context
the translational velocityv_FM
of the child frame M’s origin as measured and expressed in the parent frame F.- Parameter
context
: A Context for the MultibodyPlant this joint belongs to.
- Returns
v_FM
: A vector in ℝ³ with the translational velocity of the origin of child frame M in the parent frame F, expressed in F. Refer to this class’s documentation for further details and definitions of these frames.
- Parameter
- GetPose(self: pydrake.multibody.tree.QuaternionFloatingJoint_[AutoDiffXd], context: pydrake.systems.framework.Context_[AutoDiffXd]) pydrake.math.RigidTransform_[AutoDiffXd]
Returns the pose
X_FM
of the outboard frame M as measured and expressed in the inboard frame F. Refer to the documentation for this class for details.- Parameter
context
: A Context for the MultibodyPlant this joint belongs to.
- Returns
X_FM
: The pose of frame M in frame F.
- Parameter
- kTypeName = 'quaternion_floating'
- set_angular_velocity(self: pydrake.multibody.tree.QuaternionFloatingJoint_[AutoDiffXd], context: pydrake.systems.framework.Context_[AutoDiffXd], w_FM: numpy.ndarray[object[3, 1]]) pydrake.multibody.tree.QuaternionFloatingJoint_[AutoDiffXd]
Sets in
context
the state forthis
joint so that the angular velocity of the child frame M in the parent frame F isw_FM
.- Parameter
context
: A Context for the MultibodyPlant this joint belongs to.
- Parameter
w_FM
: A vector in ℝ³ with the angular velocity of the child frame M in the parent frame F, expressed in F. Refer to this class’s documentation for further details and definitions of these frames.
- Returns
a constant reference to
this
joint.
- Parameter
- set_default_quaternion(self: pydrake.multibody.tree.QuaternionFloatingJoint_[AutoDiffXd], q_FM: pydrake.common.eigen_geometry.Quaternion) None
Sets the default quaternion
q_FM
of this joint.- Parameter
q_FM
: The desired default quaternion of the joint.
- Parameter
- set_default_translation(self: pydrake.multibody.tree.QuaternionFloatingJoint_[AutoDiffXd], translation: numpy.ndarray[numpy.float64[3, 1]]) None
Sets this joint’s default position vector
p_FM
.- Parameter
p_FM
: position vector p_FoMo_F from Fo (inboard frame F’s origin) to Mo (outboard frame M’s origin), expressed in frame F.
- Parameter
- set_random_quaternion_distribution(self: pydrake.multibody.tree.QuaternionFloatingJoint_[AutoDiffXd], q_FM: pydrake.common.eigen_geometry.Quaternion_[Expression]) None
(Advanced) Sets the random distribution that the orientation of this joint will be randomly sampled from. If a translation (position) distribution has already been set with stochastic variables, it will remain so. Otherwise translation will be set to this joint’s zero configuration. See get_quaternion() for details on the orientation representation.
Note
Use caution when setting a quaternion distribution. A naive uniform sampling of each component will not lead to a uniform sampling of the unit sphere. See
set_random_quaternion_distribution_to_uniform()
for the most common case of uniformly sampling rotations.
- set_random_quaternion_distribution_to_uniform(self: pydrake.multibody.tree.QuaternionFloatingJoint_[AutoDiffXd]) None
Sets the random distribution such that the orientation of this joint will be randomly sampled using uniformly sampled rotations.
- set_random_translation_distribution(self: pydrake.multibody.tree.QuaternionFloatingJoint_[AutoDiffXd], translation: numpy.ndarray[object[3, 1]]) None
For this joint, sets the random distribution that the translation of this joint will be randomly sampled from. If a quaternion distribution has already been set with stochastic variables, it will remain so. Otherwise the quaternion will be set to this joint’s zero orientation. See get_translation() for details on the translation representation.
- set_translational_velocity(self: pydrake.multibody.tree.QuaternionFloatingJoint_[AutoDiffXd], context: pydrake.systems.framework.Context_[AutoDiffXd], v_FM: numpy.ndarray[object[3, 1]]) pydrake.multibody.tree.QuaternionFloatingJoint_[AutoDiffXd]
Sets in
context
the state forthis
joint so that the translational velocity of the child frame M’s origin in the parent frame F isv_FM
.- Parameter
context
: A Context for the MultibodyPlant this joint belongs to.
- Parameter
w_FM
: A vector in ℝ³ with the translational velocity of the child frame M’s origin in the parent frame F, expressed in F. Refer to this class’s documentation for further details and definitions of these frames.
- Returns
a constant reference to
this
joint.
- Parameter
- SetOrientation(self: pydrake.multibody.tree.QuaternionFloatingJoint_[AutoDiffXd], context: pydrake.systems.framework.Context_[AutoDiffXd], R: pydrake.math.RotationMatrix_[AutoDiffXd]) pydrake.multibody.tree.QuaternionFloatingJoint_[AutoDiffXd]
Sets the quaternion in
context
so this joint’s orientation is consistent with the givenR_FM
rotation matrix.- Parameter
context
: A Context for the MultibodyPlant this joint belongs to.
- Parameter
R_FM
: The rotation matrix relating the orientation of frame F and frame M.
- Returns
a constant reference to
this
joint.
- Parameter
- SetPose(self: pydrake.multibody.tree.QuaternionFloatingJoint_[AutoDiffXd], context: pydrake.systems.framework.Context_[AutoDiffXd], X_FM: pydrake.math.RigidTransform_[AutoDiffXd]) pydrake.multibody.tree.QuaternionFloatingJoint_[AutoDiffXd]
Sets
context
to storeX_FM
the pose of frame M measured and expressed in frame F.- Parameter
context
: A Context for the MultibodyPlant this joint belongs to.
- Parameter
X_FM
: The desired pose of frame M in frame F to be stored in
context
.
- Returns
a constant reference to
this
joint.
- Parameter
- SetQuaternion(self: pydrake.multibody.tree.QuaternionFloatingJoint_[AutoDiffXd], context: pydrake.systems.framework.Context_[AutoDiffXd], q_FM: pydrake.common.eigen_geometry.Quaternion_[AutoDiffXd]) pydrake.multibody.tree.QuaternionFloatingJoint_[AutoDiffXd]
Sets
context
so that the orientation of frame M in F is given by the input quaternionq_FM
.- Parameter
context
: A Context for the MultibodyPlant this joint belongs to.
- Parameter
q_FM
: Quaternion relating frames F and M to be stored in
context
.
- Returns
a constant reference to
this
joint.
- Parameter
- SetTranslation(self: pydrake.multibody.tree.QuaternionFloatingJoint_[AutoDiffXd], context: pydrake.systems.framework.Context_[AutoDiffXd], p_FM: numpy.ndarray[object[3, 1]]) pydrake.multibody.tree.QuaternionFloatingJoint_[AutoDiffXd]
For this joint, stores the position vector
p_FM
incontext
.- Parameter
context
: A Context for the MultibodyPlant this joint belongs to.
- Parameter
p_FM
: position vector p_FoMo_F from Fo (inboard frame F’s origin) to Mo (outboard frame M’s origin), expressed in frame F.
- Returns
a constant reference to
this
joint.
- Parameter
- class pydrake.multibody.tree.QuaternionFloatingJoint_[Expression]
Bases:
pydrake.multibody.tree.Joint_[Expression]
This Joint allows two bodies to move freely relatively to one another. That is, given a frame F attached to the parent body P and a frame M attached to the child body B (see the Joint class’s documentation), this Joint allows frame M to translate and rotate freely with respect to F, introducing six degrees of freedom. This Joint introduces four generalized positions to describe the orientation
R_FM
of frame M in F with a quaternionq_FM
, and three generalized positions to describe the translation of frame M’s origin in F with a position vectorp_FM
. The seven entries of the configuration vector q are ordered(q_FM, p_FM)
with the quaternion, ordered wxyz (scalar then vector), preceding the translation vector. As generalized velocities, this Joint introduces the angular velocityw_FM
of frame M in F and the linear velocityv_FM
of frame M’s origin in frame F, ordered(w_FM, v_FM)
.- __init__(self: pydrake.multibody.tree.QuaternionFloatingJoint_[Expression], name: str, frame_on_parent: pydrake.multibody.tree.Frame_[Expression], frame_on_child: pydrake.multibody.tree.Frame_[Expression], angular_damping: float = 0, translational_damping: float = 0) None
Constructor for a QuaternionFloatingJoint granting six degrees of freedom to an outboard frame M attached to the child body B with respect to an inboard frame F attached to the parent body P. The orientation of frame M in F is represented by a quaternion
q_FM
while the position of F in M is given by a position vectorp_FM
expressed in frame F. See this class’s documentation for further details on the definition of these frames, get_quaternion() and get_translation() for an explanation of the configuration of this joint, and get_angular_velocity() and get_translational_velocity() for an explanation of the generalized velocities.This constructor signature creates a joint with no joint limits, i.e. the joint position, velocity and acceleration limits are the pair
(-∞, ∞)
. These can be set using the Joint methods set_position_limits(), set_velocity_limits() and set_acceleration_limits().The first three arguments to this constructor are those of the Joint class constructor. See the Joint class’s documentation for details. The additional parameters are:
- Parameter
angular_damping
: Viscous damping coefficient in N⋅m⋅s for the angular component of this joint’s velocity, used to model losses within the joint. See documentation of default_angular_damping() for details on modelling of the damping force.
- Parameter
translational_damping
: Viscous damping coefficient in N⋅s/m for the translational component of this joint’s velocity, used to model losses within the joint. See documentation of default_translational_damping() for details on modelling of the damping force.
- Raises
RuntimeError if angular_damping is negative. –
RuntimeError if translational_damping is negative. –
- Parameter
- default_angular_damping(self: pydrake.multibody.tree.QuaternionFloatingJoint_[Expression]) float
Returns
this
joint’s default angular damping constant in N⋅m⋅s. The damping torque (in N⋅m) is modeled asτ = -damping⋅ω
, i.e. opposing motion, with ω the angular velocity of frame M in F (see get_angular_velocity()) and τ the torque on child body B (to which M is rigidly attached).
- default_translational_damping(self: pydrake.multibody.tree.QuaternionFloatingJoint_[Expression]) float
Returns
this
joint’s default translational damping constant in N⋅s/m. The damping force (in N) is modeled asf = -damping⋅v
i.e. opposing motion, with v the translational velocity of frame M in F (see get_translational_velocity()) and f the force on child body B at Mo.
- get_angular_velocity(self: pydrake.multibody.tree.QuaternionFloatingJoint_[Expression], context: pydrake.systems.framework.Context_[Expression]) numpy.ndarray[object[3, 1]]
Retrieves from
context
the angular velocityw_FM
of the child frame M in the parent frame F, expressed in F.- Parameter
context
: A Context for the MultibodyPlant this joint belongs to.
- Returns
w_FM
: A vector in ℝ³ with the angular velocity of the child frame M in the parent frame F, expressed in F. Refer to this class’s documentation for further details and definitions of these frames.
- Parameter
- get_default_quaternion(self: pydrake.multibody.tree.QuaternionFloatingJoint_[Expression]) pydrake.common.eigen_geometry.Quaternion
Gets the default quaternion
q_FM
forthis
joint.- Returns
The default quaternion
q_FM
ofthis
.
- get_default_translation(self: pydrake.multibody.tree.QuaternionFloatingJoint_[Expression]) numpy.ndarray[numpy.float64[3, 1]]
Returns this joint’s default translation as the position vector p_FoMo_F from Fo (inboard frame F’s origin) to Mo (outboard frame M’s origin), expressed in inboard frame F.
- Returns
This
: joint’s default translation as the position vector p_FM.
- Returns
- get_quaternion(self: pydrake.multibody.tree.QuaternionFloatingJoint_[Expression], context: pydrake.systems.framework.Context_[Expression]) pydrake.common.eigen_geometry.Quaternion_[Expression]
Gets the quaternion
q_FM
that represents the orientation of outboard frame M in the inboard frame F. Refer to the documentation for this class for details.- Parameter
context
: A Context for the MultibodyPlant this joint belongs to.
- Returns
q_FM
: The quaternion representing the orientation of frame M in F.
- Parameter
- get_translation(self: pydrake.multibody.tree.QuaternionFloatingJoint_[Expression], context: pydrake.systems.framework.Context_[Expression]) numpy.ndarray[object[3, 1]]
Returns the position vector p_FoMo_F from Fo (inboard frame F’s origin) to Mo (outboard frame M’s origin), expressed in inboard frame F.
- Parameter
context
: contains the state of the multibody system.
Note
Class documentation describes inboard frame F and outboard frame M.
- Returns
p_FM
: The position vector from Fo (frame F’s origin) to Mo (frame M’s origin), expressed in frame F.
- Parameter
- get_translational_velocity(self: pydrake.multibody.tree.QuaternionFloatingJoint_[Expression], context: pydrake.systems.framework.Context_[Expression]) numpy.ndarray[object[3, 1]]
Retrieves from
context
the translational velocityv_FM
of the child frame M’s origin as measured and expressed in the parent frame F.- Parameter
context
: A Context for the MultibodyPlant this joint belongs to.
- Returns
v_FM
: A vector in ℝ³ with the translational velocity of the origin of child frame M in the parent frame F, expressed in F. Refer to this class’s documentation for further details and definitions of these frames.
- Parameter
- GetPose(self: pydrake.multibody.tree.QuaternionFloatingJoint_[Expression], context: pydrake.systems.framework.Context_[Expression]) pydrake.math.RigidTransform_[Expression]
Returns the pose
X_FM
of the outboard frame M as measured and expressed in the inboard frame F. Refer to the documentation for this class for details.- Parameter
context
: A Context for the MultibodyPlant this joint belongs to.
- Returns
X_FM
: The pose of frame M in frame F.
- Parameter
- kTypeName = 'quaternion_floating'
- set_angular_velocity(self: pydrake.multibody.tree.QuaternionFloatingJoint_[Expression], context: pydrake.systems.framework.Context_[Expression], w_FM: numpy.ndarray[object[3, 1]]) pydrake.multibody.tree.QuaternionFloatingJoint_[Expression]
Sets in
context
the state forthis
joint so that the angular velocity of the child frame M in the parent frame F isw_FM
.- Parameter
context
: A Context for the MultibodyPlant this joint belongs to.
- Parameter
w_FM
: A vector in ℝ³ with the angular velocity of the child frame M in the parent frame F, expressed in F. Refer to this class’s documentation for further details and definitions of these frames.
- Returns
a constant reference to
this
joint.
- Parameter
- set_default_quaternion(self: pydrake.multibody.tree.QuaternionFloatingJoint_[Expression], q_FM: pydrake.common.eigen_geometry.Quaternion) None
Sets the default quaternion
q_FM
of this joint.- Parameter
q_FM
: The desired default quaternion of the joint.
- Parameter
- set_default_translation(self: pydrake.multibody.tree.QuaternionFloatingJoint_[Expression], translation: numpy.ndarray[numpy.float64[3, 1]]) None
Sets this joint’s default position vector
p_FM
.- Parameter
p_FM
: position vector p_FoMo_F from Fo (inboard frame F’s origin) to Mo (outboard frame M’s origin), expressed in frame F.
- Parameter
- set_random_quaternion_distribution(self: pydrake.multibody.tree.QuaternionFloatingJoint_[Expression], q_FM: pydrake.common.eigen_geometry.Quaternion_[Expression]) None
(Advanced) Sets the random distribution that the orientation of this joint will be randomly sampled from. If a translation (position) distribution has already been set with stochastic variables, it will remain so. Otherwise translation will be set to this joint’s zero configuration. See get_quaternion() for details on the orientation representation.
Note
Use caution when setting a quaternion distribution. A naive uniform sampling of each component will not lead to a uniform sampling of the unit sphere. See
set_random_quaternion_distribution_to_uniform()
for the most common case of uniformly sampling rotations.
- set_random_quaternion_distribution_to_uniform(self: pydrake.multibody.tree.QuaternionFloatingJoint_[Expression]) None
Sets the random distribution such that the orientation of this joint will be randomly sampled using uniformly sampled rotations.
- set_random_translation_distribution(self: pydrake.multibody.tree.QuaternionFloatingJoint_[Expression], translation: numpy.ndarray[object[3, 1]]) None
For this joint, sets the random distribution that the translation of this joint will be randomly sampled from. If a quaternion distribution has already been set with stochastic variables, it will remain so. Otherwise the quaternion will be set to this joint’s zero orientation. See get_translation() for details on the translation representation.
- set_translational_velocity(self: pydrake.multibody.tree.QuaternionFloatingJoint_[Expression], context: pydrake.systems.framework.Context_[Expression], v_FM: numpy.ndarray[object[3, 1]]) pydrake.multibody.tree.QuaternionFloatingJoint_[Expression]
Sets in
context
the state forthis
joint so that the translational velocity of the child frame M’s origin in the parent frame F isv_FM
.- Parameter
context
: A Context for the MultibodyPlant this joint belongs to.
- Parameter
w_FM
: A vector in ℝ³ with the translational velocity of the child frame M’s origin in the parent frame F, expressed in F. Refer to this class’s documentation for further details and definitions of these frames.
- Returns
a constant reference to
this
joint.
- Parameter
- SetOrientation(self: pydrake.multibody.tree.QuaternionFloatingJoint_[Expression], context: pydrake.systems.framework.Context_[Expression], R: pydrake.math.RotationMatrix_[Expression]) pydrake.multibody.tree.QuaternionFloatingJoint_[Expression]
Sets the quaternion in
context
so this joint’s orientation is consistent with the givenR_FM
rotation matrix.- Parameter
context
: A Context for the MultibodyPlant this joint belongs to.
- Parameter
R_FM
: The rotation matrix relating the orientation of frame F and frame M.
- Returns
a constant reference to
this
joint.
- Parameter
- SetPose(self: pydrake.multibody.tree.QuaternionFloatingJoint_[Expression], context: pydrake.systems.framework.Context_[Expression], X_FM: pydrake.math.RigidTransform_[Expression]) pydrake.multibody.tree.QuaternionFloatingJoint_[Expression]
Sets
context
to storeX_FM
the pose of frame M measured and expressed in frame F.- Parameter
context
: A Context for the MultibodyPlant this joint belongs to.
- Parameter
X_FM
: The desired pose of frame M in frame F to be stored in
context
.
- Returns
a constant reference to
this
joint.
- Parameter
- SetQuaternion(self: pydrake.multibody.tree.QuaternionFloatingJoint_[Expression], context: pydrake.systems.framework.Context_[Expression], q_FM: pydrake.common.eigen_geometry.Quaternion_[Expression]) pydrake.multibody.tree.QuaternionFloatingJoint_[Expression]
Sets
context
so that the orientation of frame M in F is given by the input quaternionq_FM
.- Parameter
context
: A Context for the MultibodyPlant this joint belongs to.
- Parameter
q_FM
: Quaternion relating frames F and M to be stored in
context
.
- Returns
a constant reference to
this
joint.
- Parameter
- SetTranslation(self: pydrake.multibody.tree.QuaternionFloatingJoint_[Expression], context: pydrake.systems.framework.Context_[Expression], p_FM: numpy.ndarray[object[3, 1]]) pydrake.multibody.tree.QuaternionFloatingJoint_[Expression]
For this joint, stores the position vector
p_FM
incontext
.- Parameter
context
: A Context for the MultibodyPlant this joint belongs to.
- Parameter
p_FM
: position vector p_FoMo_F from Fo (inboard frame F’s origin) to Mo (outboard frame M’s origin), expressed in frame F.
- Returns
a constant reference to
this
joint.
- Parameter
- class pydrake.multibody.tree.RevoluteJoint
Bases:
pydrake.multibody.tree.Joint
This Joint allows two bodies to rotate relatively to one another around a common axis. That is, given a frame F attached to the parent body P and a frame M attached to the child body B (see the Joint class’s documentation), this Joint allows frames F and M to rotate with respect to each other about an axis â. The rotation angle’s sign is defined such that child body B rotates about axis â according to the right hand rule, with thumb aligned in the axis direction. Axis â is constant and has the same measures in both frames F and M, that is,
â_F = â_M
.Note
This class is templated; see
RevoluteJoint_
for the list of instantiations.- __init__(*args, **kwargs)
Overloaded function.
__init__(self: pydrake.multibody.tree.RevoluteJoint, name: str, frame_on_parent: pydrake.multibody.tree.Frame, frame_on_child: pydrake.multibody.tree.Frame, axis: numpy.ndarray[numpy.float64[3, 1]], damping: float = 0) -> None
Constructor to create a revolute joint between two bodies so that frame F attached to the parent body P and frame M attached to the child body B, rotate relatively to one another about a common axis. See this class’s documentation for further details on the definition of these frames and rotation angle. This constructor signature creates a joint with no joint limits, i.e. the joint position, velocity and acceleration limits are the pair
(-∞, ∞)
. The first three arguments to this constructor are those of the Joint class constructor. See the Joint class’s documentation for details. The additional parameters are:- Parameter
axis
: A vector in ℝ³ specifying the axis of revolution for this joint. Given that frame M only rotates with respect to F and their origins are coincident at all times, the measures of
axis
in either frame F or M are exactly the same, that is,axis_F = axis_M
. In other words,axis_F
(oraxis_M
) is the eigenvector ofR_FM
with eigenvalue equal to one. This vector can have any length, only the direction is used. This method aborts ifaxis
is the zero vector.- Parameter
damping
: Viscous damping coefficient, in N⋅m⋅s, used to model losses within the joint. The damping torque (in N⋅m) is modeled as
τ = -damping⋅ω
, i.e. opposing motion, with ω the angular rate forthis
joint (see get_angular_rate()).
- Raises
RuntimeError if damping is negative. –
__init__(self: pydrake.multibody.tree.RevoluteJoint, name: str, frame_on_parent: pydrake.multibody.tree.Frame, frame_on_child: pydrake.multibody.tree.Frame, axis: numpy.ndarray[numpy.float64[3, 1]], pos_lower_limit: float, pos_upper_limit: float, damping: float = 0.0) -> None
Constructor to create a revolute joint between two bodies so that frame F attached to the parent body P and frame M attached to the child body B, rotate relatively to one another about a common axis. See this class’s documentation for further details on the definition of these frames and rotation angle. The first three arguments to this constructor are those of the Joint class constructor. See the Joint class’s documentation for details. The additional parameters are:
- Parameter
axis
: A vector in ℝ³ specifying the axis of revolution for this joint. Given that frame M only rotates with respect to F and their origins are coincident at all times, the measures of
axis
in either frame F or M are exactly the same, that is,axis_F = axis_M
. In other words,axis_F
(oraxis_M
) is the eigenvector ofR_FM
with eigenvalue equal to one. This vector can have any length, only the direction is used.- Parameter
pos_lower_limit
: Lower position limit, in radians, for the rotation coordinate (see get_angle()).
- Parameter
pos_upper_limit
: Upper position limit, in radians, for the rotation coordinate (see get_angle()).
- Parameter
damping
: Viscous damping coefficient, in N⋅m⋅s, used to model losses within the joint. The damping torque (in N⋅m) is modeled as
τ = -damping⋅ω
, i.e. opposing motion, with ω the angular rate forthis
joint (see get_angular_rate()).
- Raises
RuntimeError if the L2 norm of axis is less than the square –
root of machine epsilon. –
RuntimeError if damping is negative. –
RuntimeError if pos_lower_limit > pos_upper_limit. –
- acceleration_lower_limit(self: pydrake.multibody.tree.RevoluteJoint) float
Returns the acceleration lower limit for
this
joint in radians / s².
- acceleration_upper_limit(self: pydrake.multibody.tree.RevoluteJoint) float
Returns the acceleration upper limit for
this
joint in radians / s².
- default_damping(self: pydrake.multibody.tree.RevoluteJoint) float
Returns
this
joint’s default damping constant in N⋅m⋅s.
- get_angle(self: pydrake.multibody.tree.RevoluteJoint, context: pydrake.systems.framework.Context) float
Gets the rotation angle of
this
mobilizer fromcontext
.- Parameter
context
: The context of the MultibodyTree this joint belongs to.
- Returns
The angle coordinate of
this
joint stored in thecontext
.
- Parameter
- get_angular_rate(self: pydrake.multibody.tree.RevoluteJoint, context: pydrake.systems.framework.Context) float
Gets the rate of change, in radians per second, of
this
joint’s angle (see get_angle()) fromcontext
.- Parameter
context
: The context of the MultibodyTree this joint belongs to.
- Returns
The rate of change of
this
joint’s angle as stored in thecontext
.
- Parameter
- get_default_angle(self: pydrake.multibody.tree.RevoluteJoint) float
Gets the default rotation angle. Wrapper for the more general
Joint::default_positions()
.- Returns
The default angle of
this
stored indefault_positions_
- GetDamping(self: pydrake.multibody.tree.RevoluteJoint, context: pydrake.systems.framework.Context) float
Returns the Context dependent damping coefficient stored as a parameter in
context
. Refer to default_damping() for details.- Parameter
context
: The context storing the state and parameters for the model to which
this
joint belongs.
- Parameter
- kTypeName = 'revolute'
- position_lower_limit(self: pydrake.multibody.tree.RevoluteJoint) float
Returns the position lower limit for
this
joint in radians.
- position_upper_limit(self: pydrake.multibody.tree.RevoluteJoint) float
Returns the position upper limit for
this
joint in radians.
- revolute_axis(self: pydrake.multibody.tree.RevoluteJoint) numpy.ndarray[numpy.float64[3, 1]]
Returns the axis of revolution of
this
joint as a unit vector. Since the measures of this axis in either frame F or M are the same (see this class’s documentation for frame definitions) then,axis = axis_F = axis_M
.
- set_angle(self: pydrake.multibody.tree.RevoluteJoint, context: pydrake.systems.framework.Context, angle: float) pydrake.multibody.tree.RevoluteJoint
Sets the
context
so that the generalized coordinate corresponding to the rotation angle ofthis
joint equalsangle
.- Parameter
context
: The context of the MultibodyTree this joint belongs to.
- Parameter
angle
: The desired angle in radians to be stored in
context
.
- Returns
a constant reference to
this
joint.
- Parameter
- set_angular_rate(self: pydrake.multibody.tree.RevoluteJoint, context: pydrake.systems.framework.Context, angle: float) pydrake.multibody.tree.RevoluteJoint
Sets the rate of change, in radians per second, of this
this
joint’s angle totheta_dot
. The new rate of changetheta_dot
gets stored incontext
.- Parameter
context
: The context of the MultibodyTree this joint belongs to.
- Parameter
theta_dot
: The desired rate of change of
this
joints’s angle in radians per second.
- Returns
a constant reference to
this
joint.
- Parameter
- set_default_angle(self: pydrake.multibody.tree.RevoluteJoint, angle: float) None
Sets the
default_positions
of this joint (in this case a single angle).- Parameter
angle
: The desired default angle of the joint
- Parameter
- set_default_damping(self: pydrake.multibody.tree.RevoluteJoint, damping: float) None
Sets the default value of viscous damping for this joint, in N⋅m⋅s.
- Raises
RuntimeError if damping is negative. –
- Precondition:
the MultibodyPlant must not be finalized.
- set_random_angle_distribution(self: pydrake.multibody.tree.RevoluteJoint, angle: pydrake.symbolic.Expression) None
- SetDamping(self: pydrake.multibody.tree.RevoluteJoint, context: pydrake.systems.framework.Context, damping: float) None
Sets the value of the viscous damping coefficient for this joint, stored as a parameter in
context
. Refer to default_damping() for details.- Parameter
context
: The context storing the state and parameters for the model to which
this
joint belongs.- Parameter
damping
: The damping value.
- Raises
RuntimeError if damping is negative. –
- Parameter
- velocity_lower_limit(self: pydrake.multibody.tree.RevoluteJoint) float
Returns the velocity lower limit for
this
joint in radians / s.
- velocity_upper_limit(self: pydrake.multibody.tree.RevoluteJoint) float
Returns the velocity upper limit for
this
joint in radians / s.
- template pydrake.multibody.tree.RevoluteJoint_
Instantiations:
RevoluteJoint_[float]
,RevoluteJoint_[AutoDiffXd]
,RevoluteJoint_[Expression]
- class pydrake.multibody.tree.RevoluteJoint_[AutoDiffXd]
Bases:
pydrake.multibody.tree.Joint_[AutoDiffXd]
This Joint allows two bodies to rotate relatively to one another around a common axis. That is, given a frame F attached to the parent body P and a frame M attached to the child body B (see the Joint class’s documentation), this Joint allows frames F and M to rotate with respect to each other about an axis â. The rotation angle’s sign is defined such that child body B rotates about axis â according to the right hand rule, with thumb aligned in the axis direction. Axis â is constant and has the same measures in both frames F and M, that is,
â_F = â_M
.- __init__(*args, **kwargs)
Overloaded function.
__init__(self: pydrake.multibody.tree.RevoluteJoint_[AutoDiffXd], name: str, frame_on_parent: pydrake.multibody.tree.Frame_[AutoDiffXd], frame_on_child: pydrake.multibody.tree.Frame_[AutoDiffXd], axis: numpy.ndarray[numpy.float64[3, 1]], damping: float = 0) -> None
Constructor to create a revolute joint between two bodies so that frame F attached to the parent body P and frame M attached to the child body B, rotate relatively to one another about a common axis. See this class’s documentation for further details on the definition of these frames and rotation angle. This constructor signature creates a joint with no joint limits, i.e. the joint position, velocity and acceleration limits are the pair
(-∞, ∞)
. The first three arguments to this constructor are those of the Joint class constructor. See the Joint class’s documentation for details. The additional parameters are:- Parameter
axis
: A vector in ℝ³ specifying the axis of revolution for this joint. Given that frame M only rotates with respect to F and their origins are coincident at all times, the measures of
axis
in either frame F or M are exactly the same, that is,axis_F = axis_M
. In other words,axis_F
(oraxis_M
) is the eigenvector ofR_FM
with eigenvalue equal to one. This vector can have any length, only the direction is used. This method aborts ifaxis
is the zero vector.- Parameter
damping
: Viscous damping coefficient, in N⋅m⋅s, used to model losses within the joint. The damping torque (in N⋅m) is modeled as
τ = -damping⋅ω
, i.e. opposing motion, with ω the angular rate forthis
joint (see get_angular_rate()).
- Raises
RuntimeError if damping is negative. –
__init__(self: pydrake.multibody.tree.RevoluteJoint_[AutoDiffXd], name: str, frame_on_parent: pydrake.multibody.tree.Frame_[AutoDiffXd], frame_on_child: pydrake.multibody.tree.Frame_[AutoDiffXd], axis: numpy.ndarray[numpy.float64[3, 1]], pos_lower_limit: float, pos_upper_limit: float, damping: float = 0.0) -> None
Constructor to create a revolute joint between two bodies so that frame F attached to the parent body P and frame M attached to the child body B, rotate relatively to one another about a common axis. See this class’s documentation for further details on the definition of these frames and rotation angle. The first three arguments to this constructor are those of the Joint class constructor. See the Joint class’s documentation for details. The additional parameters are:
- Parameter
axis
: A vector in ℝ³ specifying the axis of revolution for this joint. Given that frame M only rotates with respect to F and their origins are coincident at all times, the measures of
axis
in either frame F or M are exactly the same, that is,axis_F = axis_M
. In other words,axis_F
(oraxis_M
) is the eigenvector ofR_FM
with eigenvalue equal to one. This vector can have any length, only the direction is used.- Parameter
pos_lower_limit
: Lower position limit, in radians, for the rotation coordinate (see get_angle()).
- Parameter
pos_upper_limit
: Upper position limit, in radians, for the rotation coordinate (see get_angle()).
- Parameter
damping
: Viscous damping coefficient, in N⋅m⋅s, used to model losses within the joint. The damping torque (in N⋅m) is modeled as
τ = -damping⋅ω
, i.e. opposing motion, with ω the angular rate forthis
joint (see get_angular_rate()).
- Raises
RuntimeError if the L2 norm of axis is less than the square –
root of machine epsilon. –
RuntimeError if damping is negative. –
RuntimeError if pos_lower_limit > pos_upper_limit. –
- acceleration_lower_limit(self: pydrake.multibody.tree.RevoluteJoint_[AutoDiffXd]) float
Returns the acceleration lower limit for
this
joint in radians / s².
- acceleration_upper_limit(self: pydrake.multibody.tree.RevoluteJoint_[AutoDiffXd]) float
Returns the acceleration upper limit for
this
joint in radians / s².
- default_damping(self: pydrake.multibody.tree.RevoluteJoint_[AutoDiffXd]) float
Returns
this
joint’s default damping constant in N⋅m⋅s.
- get_angle(self: pydrake.multibody.tree.RevoluteJoint_[AutoDiffXd], context: pydrake.systems.framework.Context_[AutoDiffXd]) pydrake.autodiffutils.AutoDiffXd
Gets the rotation angle of
this
mobilizer fromcontext
.- Parameter
context
: The context of the MultibodyTree this joint belongs to.
- Returns
The angle coordinate of
this
joint stored in thecontext
.
- Parameter
- get_angular_rate(self: pydrake.multibody.tree.RevoluteJoint_[AutoDiffXd], context: pydrake.systems.framework.Context_[AutoDiffXd]) pydrake.autodiffutils.AutoDiffXd
Gets the rate of change, in radians per second, of
this
joint’s angle (see get_angle()) fromcontext
.- Parameter
context
: The context of the MultibodyTree this joint belongs to.
- Returns
The rate of change of
this
joint’s angle as stored in thecontext
.
- Parameter
- get_default_angle(self: pydrake.multibody.tree.RevoluteJoint_[AutoDiffXd]) float
Gets the default rotation angle. Wrapper for the more general
Joint::default_positions()
.- Returns
The default angle of
this
stored indefault_positions_
- GetDamping(self: pydrake.multibody.tree.RevoluteJoint_[AutoDiffXd], context: pydrake.systems.framework.Context_[AutoDiffXd]) pydrake.autodiffutils.AutoDiffXd
Returns the Context dependent damping coefficient stored as a parameter in
context
. Refer to default_damping() for details.- Parameter
context
: The context storing the state and parameters for the model to which
this
joint belongs.
- Parameter
- kTypeName = 'revolute'
- position_lower_limit(self: pydrake.multibody.tree.RevoluteJoint_[AutoDiffXd]) float
Returns the position lower limit for
this
joint in radians.
- position_upper_limit(self: pydrake.multibody.tree.RevoluteJoint_[AutoDiffXd]) float
Returns the position upper limit for
this
joint in radians.
- revolute_axis(self: pydrake.multibody.tree.RevoluteJoint_[AutoDiffXd]) numpy.ndarray[numpy.float64[3, 1]]
Returns the axis of revolution of
this
joint as a unit vector. Since the measures of this axis in either frame F or M are the same (see this class’s documentation for frame definitions) then,axis = axis_F = axis_M
.
- set_angle(self: pydrake.multibody.tree.RevoluteJoint_[AutoDiffXd], context: pydrake.systems.framework.Context_[AutoDiffXd], angle: pydrake.autodiffutils.AutoDiffXd) pydrake.multibody.tree.RevoluteJoint_[AutoDiffXd]
Sets the
context
so that the generalized coordinate corresponding to the rotation angle ofthis
joint equalsangle
.- Parameter
context
: The context of the MultibodyTree this joint belongs to.
- Parameter
angle
: The desired angle in radians to be stored in
context
.
- Returns
a constant reference to
this
joint.
- Parameter
- set_angular_rate(self: pydrake.multibody.tree.RevoluteJoint_[AutoDiffXd], context: pydrake.systems.framework.Context_[AutoDiffXd], angle: pydrake.autodiffutils.AutoDiffXd) pydrake.multibody.tree.RevoluteJoint_[AutoDiffXd]
Sets the rate of change, in radians per second, of this
this
joint’s angle totheta_dot
. The new rate of changetheta_dot
gets stored incontext
.- Parameter
context
: The context of the MultibodyTree this joint belongs to.
- Parameter
theta_dot
: The desired rate of change of
this
joints’s angle in radians per second.
- Returns
a constant reference to
this
joint.
- Parameter
- set_default_angle(self: pydrake.multibody.tree.RevoluteJoint_[AutoDiffXd], angle: float) None
Sets the
default_positions
of this joint (in this case a single angle).- Parameter
angle
: The desired default angle of the joint
- Parameter
- set_default_damping(self: pydrake.multibody.tree.RevoluteJoint_[AutoDiffXd], damping: float) None
Sets the default value of viscous damping for this joint, in N⋅m⋅s.
- Raises
RuntimeError if damping is negative. –
- Precondition:
the MultibodyPlant must not be finalized.
- set_random_angle_distribution(self: pydrake.multibody.tree.RevoluteJoint_[AutoDiffXd], angle: pydrake.symbolic.Expression) None
- SetDamping(self: pydrake.multibody.tree.RevoluteJoint_[AutoDiffXd], context: pydrake.systems.framework.Context_[AutoDiffXd], damping: pydrake.autodiffutils.AutoDiffXd) None
Sets the value of the viscous damping coefficient for this joint, stored as a parameter in
context
. Refer to default_damping() for details.- Parameter
context
: The context storing the state and parameters for the model to which
this
joint belongs.- Parameter
damping
: The damping value.
- Raises
RuntimeError if damping is negative. –
- Parameter
- velocity_lower_limit(self: pydrake.multibody.tree.RevoluteJoint_[AutoDiffXd]) float
Returns the velocity lower limit for
this
joint in radians / s.
- velocity_upper_limit(self: pydrake.multibody.tree.RevoluteJoint_[AutoDiffXd]) float
Returns the velocity upper limit for
this
joint in radians / s.
- class pydrake.multibody.tree.RevoluteJoint_[Expression]
Bases:
pydrake.multibody.tree.Joint_[Expression]
This Joint allows two bodies to rotate relatively to one another around a common axis. That is, given a frame F attached to the parent body P and a frame M attached to the child body B (see the Joint class’s documentation), this Joint allows frames F and M to rotate with respect to each other about an axis â. The rotation angle’s sign is defined such that child body B rotates about axis â according to the right hand rule, with thumb aligned in the axis direction. Axis â is constant and has the same measures in both frames F and M, that is,
â_F = â_M
.- __init__(*args, **kwargs)
Overloaded function.
__init__(self: pydrake.multibody.tree.RevoluteJoint_[Expression], name: str, frame_on_parent: pydrake.multibody.tree.Frame_[Expression], frame_on_child: pydrake.multibody.tree.Frame_[Expression], axis: numpy.ndarray[numpy.float64[3, 1]], damping: float = 0) -> None
Constructor to create a revolute joint between two bodies so that frame F attached to the parent body P and frame M attached to the child body B, rotate relatively to one another about a common axis. See this class’s documentation for further details on the definition of these frames and rotation angle. This constructor signature creates a joint with no joint limits, i.e. the joint position, velocity and acceleration limits are the pair
(-∞, ∞)
. The first three arguments to this constructor are those of the Joint class constructor. See the Joint class’s documentation for details. The additional parameters are:- Parameter
axis
: A vector in ℝ³ specifying the axis of revolution for this joint. Given that frame M only rotates with respect to F and their origins are coincident at all times, the measures of
axis
in either frame F or M are exactly the same, that is,axis_F = axis_M
. In other words,axis_F
(oraxis_M
) is the eigenvector ofR_FM
with eigenvalue equal to one. This vector can have any length, only the direction is used. This method aborts ifaxis
is the zero vector.- Parameter
damping
: Viscous damping coefficient, in N⋅m⋅s, used to model losses within the joint. The damping torque (in N⋅m) is modeled as
τ = -damping⋅ω
, i.e. opposing motion, with ω the angular rate forthis
joint (see get_angular_rate()).
- Raises
RuntimeError if damping is negative. –
__init__(self: pydrake.multibody.tree.RevoluteJoint_[Expression], name: str, frame_on_parent: pydrake.multibody.tree.Frame_[Expression], frame_on_child: pydrake.multibody.tree.Frame_[Expression], axis: numpy.ndarray[numpy.float64[3, 1]], pos_lower_limit: float, pos_upper_limit: float, damping: float = 0.0) -> None
Constructor to create a revolute joint between two bodies so that frame F attached to the parent body P and frame M attached to the child body B, rotate relatively to one another about a common axis. See this class’s documentation for further details on the definition of these frames and rotation angle. The first three arguments to this constructor are those of the Joint class constructor. See the Joint class’s documentation for details. The additional parameters are:
- Parameter
axis
: A vector in ℝ³ specifying the axis of revolution for this joint. Given that frame M only rotates with respect to F and their origins are coincident at all times, the measures of
axis
in either frame F or M are exactly the same, that is,axis_F = axis_M
. In other words,axis_F
(oraxis_M
) is the eigenvector ofR_FM
with eigenvalue equal to one. This vector can have any length, only the direction is used.- Parameter
pos_lower_limit
: Lower position limit, in radians, for the rotation coordinate (see get_angle()).
- Parameter
pos_upper_limit
: Upper position limit, in radians, for the rotation coordinate (see get_angle()).
- Parameter
damping
: Viscous damping coefficient, in N⋅m⋅s, used to model losses within the joint. The damping torque (in N⋅m) is modeled as
τ = -damping⋅ω
, i.e. opposing motion, with ω the angular rate forthis
joint (see get_angular_rate()).
- Raises
RuntimeError if the L2 norm of axis is less than the square –
root of machine epsilon. –
RuntimeError if damping is negative. –
RuntimeError if pos_lower_limit > pos_upper_limit. –
- acceleration_lower_limit(self: pydrake.multibody.tree.RevoluteJoint_[Expression]) float
Returns the acceleration lower limit for
this
joint in radians / s².
- acceleration_upper_limit(self: pydrake.multibody.tree.RevoluteJoint_[Expression]) float
Returns the acceleration upper limit for
this
joint in radians / s².
- default_damping(self: pydrake.multibody.tree.RevoluteJoint_[Expression]) float
Returns
this
joint’s default damping constant in N⋅m⋅s.
- get_angle(self: pydrake.multibody.tree.RevoluteJoint_[Expression], context: pydrake.systems.framework.Context_[Expression]) pydrake.symbolic.Expression
Gets the rotation angle of
this
mobilizer fromcontext
.- Parameter
context
: The context of the MultibodyTree this joint belongs to.
- Returns
The angle coordinate of
this
joint stored in thecontext
.
- Parameter
- get_angular_rate(self: pydrake.multibody.tree.RevoluteJoint_[Expression], context: pydrake.systems.framework.Context_[Expression]) pydrake.symbolic.Expression
Gets the rate of change, in radians per second, of
this
joint’s angle (see get_angle()) fromcontext
.- Parameter
context
: The context of the MultibodyTree this joint belongs to.
- Returns
The rate of change of
this
joint’s angle as stored in thecontext
.
- Parameter
- get_default_angle(self: pydrake.multibody.tree.RevoluteJoint_[Expression]) float
Gets the default rotation angle. Wrapper for the more general
Joint::default_positions()
.- Returns
The default angle of
this
stored indefault_positions_
- GetDamping(self: pydrake.multibody.tree.RevoluteJoint_[Expression], context: pydrake.systems.framework.Context_[Expression]) pydrake.symbolic.Expression
Returns the Context dependent damping coefficient stored as a parameter in
context
. Refer to default_damping() for details.- Parameter
context
: The context storing the state and parameters for the model to which
this
joint belongs.
- Parameter
- kTypeName = 'revolute'
- position_lower_limit(self: pydrake.multibody.tree.RevoluteJoint_[Expression]) float
Returns the position lower limit for
this
joint in radians.
- position_upper_limit(self: pydrake.multibody.tree.RevoluteJoint_[Expression]) float
Returns the position upper limit for
this
joint in radians.
- revolute_axis(self: pydrake.multibody.tree.RevoluteJoint_[Expression]) numpy.ndarray[numpy.float64[3, 1]]
Returns the axis of revolution of
this
joint as a unit vector. Since the measures of this axis in either frame F or M are the same (see this class’s documentation for frame definitions) then,axis = axis_F = axis_M
.
- set_angle(self: pydrake.multibody.tree.RevoluteJoint_[Expression], context: pydrake.systems.framework.Context_[Expression], angle: pydrake.symbolic.Expression) pydrake.multibody.tree.RevoluteJoint_[Expression]
Sets the
context
so that the generalized coordinate corresponding to the rotation angle ofthis
joint equalsangle
.- Parameter
context
: The context of the MultibodyTree this joint belongs to.
- Parameter
angle
: The desired angle in radians to be stored in
context
.
- Returns
a constant reference to
this
joint.
- Parameter
- set_angular_rate(self: pydrake.multibody.tree.RevoluteJoint_[Expression], context: pydrake.systems.framework.Context_[Expression], angle: pydrake.symbolic.Expression) pydrake.multibody.tree.RevoluteJoint_[Expression]
Sets the rate of change, in radians per second, of this
this
joint’s angle totheta_dot
. The new rate of changetheta_dot
gets stored incontext
.- Parameter
context
: The context of the MultibodyTree this joint belongs to.
- Parameter
theta_dot
: The desired rate of change of
this
joints’s angle in radians per second.
- Returns
a constant reference to
this
joint.
- Parameter
- set_default_angle(self: pydrake.multibody.tree.RevoluteJoint_[Expression], angle: float) None
Sets the
default_positions
of this joint (in this case a single angle).- Parameter
angle
: The desired default angle of the joint
- Parameter
- set_default_damping(self: pydrake.multibody.tree.RevoluteJoint_[Expression], damping: float) None
Sets the default value of viscous damping for this joint, in N⋅m⋅s.
- Raises
RuntimeError if damping is negative. –
- Precondition:
the MultibodyPlant must not be finalized.
- set_random_angle_distribution(self: pydrake.multibody.tree.RevoluteJoint_[Expression], angle: pydrake.symbolic.Expression) None
- SetDamping(self: pydrake.multibody.tree.RevoluteJoint_[Expression], context: pydrake.systems.framework.Context_[Expression], damping: pydrake.symbolic.Expression) None
Sets the value of the viscous damping coefficient for this joint, stored as a parameter in
context
. Refer to default_damping() for details.- Parameter
context
: The context storing the state and parameters for the model to which
this
joint belongs.- Parameter
damping
: The damping value.
- Raises
RuntimeError if damping is negative. –
- Parameter
- velocity_lower_limit(self: pydrake.multibody.tree.RevoluteJoint_[Expression]) float
Returns the velocity lower limit for
this
joint in radians / s.
- velocity_upper_limit(self: pydrake.multibody.tree.RevoluteJoint_[Expression]) float
Returns the velocity upper limit for
this
joint in radians / s.
- class pydrake.multibody.tree.RevoluteSpring
Bases:
pydrake.multibody.tree.ForceElement
This ForceElement models a torsional spring attached to a RevoluteJoint and applies a torque to that joint
Click to expand C++ code...
τ = -k⋅(θ - θ₀)
where θ₀ is the nominal joint position. Note that joint damping exists within the RevoluteJoint itself, and so is not included here.
Note
This class is templated; see
RevoluteSpring_
for the list of instantiations.- __init__(self: pydrake.multibody.tree.RevoluteSpring, joint: pydrake.multibody.tree.RevoluteJoint, nominal_angle: float, stiffness: float) None
Constructor for a spring attached to the given joint
- Parameter
nominal_angle
: The nominal angle of the spring θ₀, in radians, at which the spring applies no moment.
- Parameter
stiffness
: The stiffness k of the spring in N⋅m/rad.
- Raises
RuntimeError if stiffness is negative. –
- Parameter
- nominal_angle(self: pydrake.multibody.tree.RevoluteSpring) float
- stiffness(self: pydrake.multibody.tree.RevoluteSpring) float
- template pydrake.multibody.tree.RevoluteSpring_
Instantiations:
RevoluteSpring_[float]
,RevoluteSpring_[AutoDiffXd]
,RevoluteSpring_[Expression]
- class pydrake.multibody.tree.RevoluteSpring_[AutoDiffXd]
Bases:
pydrake.multibody.tree.ForceElement_[AutoDiffXd]
This ForceElement models a torsional spring attached to a RevoluteJoint and applies a torque to that joint
Click to expand C++ code...
τ = -k⋅(θ - θ₀)
where θ₀ is the nominal joint position. Note that joint damping exists within the RevoluteJoint itself, and so is not included here.
- __init__(self: pydrake.multibody.tree.RevoluteSpring_[AutoDiffXd], joint: pydrake.multibody.tree.RevoluteJoint_[AutoDiffXd], nominal_angle: float, stiffness: float) None
Constructor for a spring attached to the given joint
- Parameter
nominal_angle
: The nominal angle of the spring θ₀, in radians, at which the spring applies no moment.
- Parameter
stiffness
: The stiffness k of the spring in N⋅m/rad.
- Raises
RuntimeError if stiffness is negative. –
- Parameter
- joint(self: pydrake.multibody.tree.RevoluteSpring_[AutoDiffXd]) pydrake.multibody.tree.RevoluteJoint_[AutoDiffXd]
- nominal_angle(self: pydrake.multibody.tree.RevoluteSpring_[AutoDiffXd]) float
- stiffness(self: pydrake.multibody.tree.RevoluteSpring_[AutoDiffXd]) float
- class pydrake.multibody.tree.RevoluteSpring_[Expression]
Bases:
pydrake.multibody.tree.ForceElement_[Expression]
This ForceElement models a torsional spring attached to a RevoluteJoint and applies a torque to that joint
Click to expand C++ code...
τ = -k⋅(θ - θ₀)
where θ₀ is the nominal joint position. Note that joint damping exists within the RevoluteJoint itself, and so is not included here.
- __init__(self: pydrake.multibody.tree.RevoluteSpring_[Expression], joint: pydrake.multibody.tree.RevoluteJoint_[Expression], nominal_angle: float, stiffness: float) None
Constructor for a spring attached to the given joint
- Parameter
nominal_angle
: The nominal angle of the spring θ₀, in radians, at which the spring applies no moment.
- Parameter
stiffness
: The stiffness k of the spring in N⋅m/rad.
- Raises
RuntimeError if stiffness is negative. –
- Parameter
- joint(self: pydrake.multibody.tree.RevoluteSpring_[Expression]) pydrake.multibody.tree.RevoluteJoint_[Expression]
- nominal_angle(self: pydrake.multibody.tree.RevoluteSpring_[Expression]) float
- stiffness(self: pydrake.multibody.tree.RevoluteSpring_[Expression]) float
- class pydrake.multibody.tree.RigidBody
The term rigid body implies that the deformations of the body under consideration are so small that they have no significant effect on the overall motions of the body and therefore deformations can be neglected. If deformations are neglected, the distance between any two points on the rigid body remains constant at all times. This invariance of the distance between two arbitrary points is often taken as the definition of a rigid body in classical treatments of multibody mechanics [Goldstein 2001]. It can be demonstrated that the unconstrained three-dimensional motions of a rigid body can be described by six coordinates and thus it is often said that a free body in space has six degrees of freedom. These degrees of freedom obey the Newton-Euler equations of motion. However, within a MultibodyTree, a RigidBody is not free in space; instead, it is assigned a limited number of degrees of freedom (0-6) with respect to its parent body in the multibody tree by its Mobilizer (also called a “tree joint” or “inboard joint”). Additional constraints on permissible motion can be added using Constraint objects to remove more degrees of freedom.
- [Goldstein 2001] H Goldstein, CP Poole, JL Safko, Classical Mechanics
(3rd Edition), Addison-Wesley, 2001.
Note
This class is templated; see
RigidBody_
for the list of instantiations.- __init__(*args, **kwargs)
Overloaded function.
__init__(self: pydrake.multibody.tree.RigidBody, body_name: str, M_BBo_B: pydrake.multibody.tree.SpatialInertia = SpatialInertia.Zero()) -> None
Constructs a RigidBody named
body_name
with the given default SpatialInertia.- Parameter
body_name
: A name associated with this body.
- Parameter
M_BBo_B
: Spatial inertia of this body B about the frame’s origin
Bo
and expressed in the body frame B. When not provided, defaults to zero.
Note
See multibody_spatial_inertia for details on the monogram notation used for spatial inertia quantities.
__init__(self: pydrake.multibody.tree.RigidBody, body_name: str, model_instance: pydrake.multibody.tree.ModelInstanceIndex, M_BBo_B: pydrake.multibody.tree.SpatialInertia = SpatialInertia.Zero()) -> None
Constructs a RigidBody named
body_name
with the given default SpatialInertia.- Parameter
body_name
: A name associated with this body.
- Parameter
model_instance
: The model instance associated with this body.
- Parameter
M_BBo_B
: Spatial inertia of this body B about the frame’s origin
Bo
and expressed in the body frame B. When not provided, defaults to zero.
Note
See multibody_spatial_inertia for details on the monogram notation used for spatial inertia quantities.
- AddInForce(self: pydrake.multibody.tree.RigidBody, context: pydrake.systems.framework.Context, p_BP_E: numpy.ndarray[numpy.float64[3, 1]], F_Bp_E: pydrake.multibody.math.SpatialForce, frame_E: pydrake.multibody.tree.Frame, forces: pydrake.multibody.tree.MultibodyForces) None
Adds the SpatialForce on this RigidBody B, applied at point P and expressed in a frame E into
forces
.- Parameter
context
: The context containing the current state of the model.
- Parameter
p_BP_E
: The position of point P in B, expressed in a frame E.
- Parameter
F_Bp_E
: The spatial force to be applied on body B at point P, expressed in frame E.
- Parameter
frame_E
: The expressed-in frame E.
- Parameter
forces
: A multibody forces objects that on output will have
F_Bp_E
added.
- Raises
RuntimeError if forces is nullptr or if it is not consistent –
with the model to which this body belongs. –
- Parameter
- AddInForceInWorld(self: pydrake.multibody.tree.RigidBody, context: pydrake.systems.framework.Context, F_Bo_W: pydrake.multibody.math.SpatialForce, forces: pydrake.multibody.tree.MultibodyForces) None
Adds the SpatialForce on this RigidBody B, applied at body B’s origin Bo and expressed in the world frame W into
forces
.
- body_frame(self: pydrake.multibody.tree.RigidBody) pydrake.multibody.tree.RigidBodyFrame
Returns a const reference to the associated BodyFrame.
- CalcCenterOfMassInBodyFrame(self: pydrake.multibody.tree.RigidBody, context: pydrake.systems.framework.Context) numpy.ndarray[numpy.float64[3, 1]]
Gets this body’s center of mass position from the given context.
- Parameter
context
: contains the state of the multibody system.
- Returns
p_BoBcm_B position vector from Bo (this rigid body B’s origin) to Bcm (B’s center of mass), expressed in B.
- Precondition:
the context makes sense for use by this RigidBody.
- Parameter
- CalcCenterOfMassTranslationalAccelerationInWorld(self: pydrake.multibody.tree.RigidBody, context: pydrake.systems.framework.Context) numpy.ndarray[numpy.float64[3, 1]]
Calculates Bcm’s translational acceleration in the world frame W.
- Parameter
context
: The context contains the state of the model.
- Returns
a_WBcm_W
: The translational acceleration of Bcm (this rigid body’s center of mass) in the world frame W, expressed in W.
Note
When cached values are out of sync with the state stored in context, this method performs an expensive forward dynamics computation, whereas once evaluated, successive calls to this method are inexpensive.
- Parameter
- CalcCenterOfMassTranslationalVelocityInWorld(self: pydrake.multibody.tree.RigidBody, context: pydrake.systems.framework.Context) numpy.ndarray[numpy.float64[3, 1]]
Calculates Bcm’s translational velocity in the world frame W.
- Parameter
context
: The context contains the state of the model.
- Returns
v_WBcm_W
: The translational velocity of Bcm (this rigid body’s center of mass) in the world frame W, expressed in W.
- Parameter
- CalcSpatialInertiaInBodyFrame(self: pydrake.multibody.tree.RigidBody, context: pydrake.systems.framework.Context) pydrake.multibody.tree.SpatialInertia
Gets this body’s spatial inertia about its origin from the given context.
- Parameter
context
: contains the state of the multibody system.
- Returns
M_BBo_B spatial inertia of this rigid body B about Bo (B’s origin), expressed in B. M_BBo_B contains properties related to B’s mass, the position vector from Bo to Bcm (B’s center of mass), and G_BBo_B (B’s unit inertia about Bo expressed in B).
- Precondition:
the context makes sense for use by this RigidBody.
- Parameter
- default_com(self: pydrake.multibody.tree.RigidBody) numpy.ndarray[numpy.float64[3, 1]]
Returns the default value of this RigidBody’s center of mass as measured and expressed in its body frame. This value is initially supplied at construction when specifying this body’s SpatialInertia.
- Returns
p_BoBcm_B
: The position of this rigid body B’s center of mass
Bcm
measured from Bo (B’s frame origin) and expressed in B (body B’s frame).
- Returns
- default_mass(*args, **kwargs)
Overloaded function.
default_mass(self: pydrake.multibody.tree.RigidBody) -> float
Returns this RigidBody’s default mass, which is initially supplied at construction when specifying this body’s SpatialInertia.
Note
In general, a rigid body’s mass can be a constant property stored in this rigid body’s SpatialInertia or a parameter that is stored in a Context. The default constant mass value is used to initialize the mass parameter in the Context.
default_mass(self: pydrake.multibody.tree.RigidBody) -> float
Returns this RigidBody’s default mass, which is initially supplied at construction when specifying this body’s SpatialInertia.
Note
In general, a rigid body’s mass can be a constant property stored in this rigid body’s SpatialInertia or a parameter that is stored in a Context. The default constant mass value is used to initialize the mass parameter in the Context.
- default_rotational_inertia(self: pydrake.multibody.tree.RigidBody) pydrake.multibody.tree.RotationalInertia
Gets the default value of this body B’s rotational inertia about Bo (B’s origin), expressed in B (this body’s body frame). This value is calculated from the SpatialInertia supplied at construction of this body.
- Returns
I_BBo_B
: body B’s rotational inertia about Bo, expressed in B.
- Returns
- default_spatial_inertia(self: pydrake.multibody.tree.RigidBody) pydrake.multibody.tree.SpatialInertia
Gets the default value of this body B’s SpatialInertia about Bo (B’s origin) and expressed in B (this body’s frame).
- Returns
M_BBo_B
: body B’s spatial inertia about Bo, expressed in B.
- Returns
- default_unit_inertia(self: pydrake.multibody.tree.RigidBody) pydrake.multibody.tree.UnitInertia
Returns the default value of this body B’s unit inertia about Bo (body B’s origin), expressed in B (this body’s body frame). This value is initially supplied at construction when specifying this body’s SpatialInertia.
- Returns
G_BBo_B
: rigid body B’s unit inertia about Bo, expressed in B.
- Returns
- EvalPoseInWorld(self: pydrake.multibody.tree.RigidBody, context: pydrake.systems.framework.Context) pydrake.math.RigidTransform
Returns the pose
X_WB
of this RigidBody B in the world frame W as a function of the state of the model stored incontext
.
- EvalSpatialAccelerationInWorld(self: pydrake.multibody.tree.RigidBody, context: pydrake.systems.framework.Context) pydrake.multibody.math.SpatialAcceleration
Evaluates A_WB, this body B’s SpatialAcceleration in the world frame W.
- Parameter
context
: Contains the state of the model.
- Returns
A_WB_W
: this body B’s spatial acceleration in the world frame W, expressed in W (for point Bo, the body’s origin).
Note
When cached values are out of sync with the state stored in context, this method performs an expensive forward dynamics computation, whereas once evaluated, successive calls to this method are inexpensive.
- Parameter
- EvalSpatialVelocityInWorld(self: pydrake.multibody.tree.RigidBody, context: pydrake.systems.framework.Context) pydrake.multibody.math.SpatialVelocity
Evaluates V_WB, this body B’s SpatialVelocity in the world frame W.
- Parameter
context
: Contains the state of the model.
- Returns
V_WB_W
: this body B’s spatial velocity in the world frame W, expressed in W (for point Bo, the body frame’s origin).
- Parameter
- floating_position_suffix(self: pydrake.multibody.tree.RigidBody, arg0: int) str
Returns a string suffix (e.g. to be appended to the name()) to identify the
k`th position in the floating base. `position_index_in_body
must be in [0, 7) ifhas_quaternion_dofs()
is true, otherwise in [0, 6).- Raises
RuntimeError if called pre-finalize –
- Precondition:
this is a floating base body
See also
is_floating(), has_quaternion_dofs(), MultibodyPlant::Finalize()
- floating_positions_start(self: pydrake.multibody.tree.RigidBody) int
(Advanced) For floating base bodies (see is_floating()) this method returns the index of this RigidBody’s first generalized position in the vector q of generalized position coordinates for a MultibodyPlant model. Positions q for this RigidBody are then contiguous starting at this index. When a floating RigidBody is modeled with quaternion coordinates (see has_quaternion_dofs()), the four consecutive entries in the state starting at this index correspond to the quaternion that parametrizes this RigidBody’s orientation.
- Raises
RuntimeError if called pre-finalize –
- Precondition:
this is a floating base body
See also
is_floating(), has_quaternion_dofs(), MultibodyPlant::Finalize()
- floating_velocities_start_in_v(self: pydrake.multibody.tree.RigidBody) int
(Advanced) For floating base bodies (see is_floating()) this method returns the index of this RigidBody’s first generalized velocity in the vector v of generalized velocities for a MultibodyPlant model. Velocities v for this RigidBody are then contiguous starting at this index.
- Raises
RuntimeError if called pre-finalize –
- Precondition:
this is a floating base body
See also
is_floating(), MultibodyPlant::Finalize()
- floating_velocity_suffix(self: pydrake.multibody.tree.RigidBody, arg0: int) str
Returns a string suffix (e.g. to be appended to the name()) to identify the
k`th velocity in the floating base. `velocity_index_in_body
must be in [0,6).- Raises
RuntimeError if called pre-finalize –
- Precondition:
this is a floating base body
See also
is_floating(), MultibodyPlant::Finalize()
- get_mass(self: pydrake.multibody.tree.RigidBody, context: pydrake.systems.framework.Context) float
Gets this body’s mass from the given context.
- Parameter
context
: contains the state of the multibody system.
- Precondition:
the context makes sense for use by this RigidBody.
- Parameter
- GetForceInWorld(self: pydrake.multibody.tree.RigidBody, context: pydrake.systems.framework.Context, forces: pydrake.multibody.tree.MultibodyForces) pydrake.multibody.math.SpatialForce
Gets the SpatialForce on this RigidBody B from
forces
as F_BBo_W: applied at body B’s origin Bo and expressed in world frame W.
- GetParentPlant(self: pydrake.multibody.tree.RigidBody) drake::multibody::MultibodyPlant<double>
- has_quaternion_dofs(self: pydrake.multibody.tree.RigidBody) bool
(Advanced) If
True
, this body’s generalized position coordinates q include a quaternion, which occupies the first four elements of q. Note that this does not imply that the body is floating base body since it may have fewer than 6 dofs or its inboard body could be something other than World.- Raises
RuntimeError if called pre-finalize –
See also
is_floating(), MultibodyPlant::Finalize()
- is_floating(self: pydrake.multibody.tree.RigidBody) bool
(Advanced) Returns
True
if this body is granted 6-dofs by a Mobilizer and the parent body of this body’s associated 6-dof joint isworld
.Note
A floating base body is not necessarily modeled with a quaternion mobilizer, see has_quaternion_dofs(). Alternative options include a roll-pitch-yaw (rpy) parametrization of rotations, see RpyFloatingMobilizer.
- Raises
RuntimeError if called pre-finalize, –
See also
MultibodyPlant::Finalize()
- is_locked(self: pydrake.multibody.tree.RigidBody, context: pydrake.systems.framework.Context) bool
Determines whether this RigidBody is currently locked to its inboard (parent) RigidBody. This is not limited to floating base bodies but generally Joint::is_locked() is preferable otherwise.
- Returns
true if the body is locked, false otherwise.
- Lock(self: pydrake.multibody.tree.RigidBody, context: pydrake.systems.framework.Context) None
For a floating base RigidBody, lock its inboard joint. Its generalized velocities will be 0 until it is unlocked.
- Raises
RuntimeError if this body is not a floating base body. –
- model_instance(self: pydrake.multibody.tree.RigidBody) pydrake.multibody.tree.ModelInstanceIndex
- name(self: pydrake.multibody.tree.RigidBody) str
Gets the
name
associated with this rigid body. The name will never be empty.
- scoped_name(self: pydrake.multibody.tree.RigidBody) pydrake.multibody.tree.ScopedName
Returns scoped name of this frame. Neither of the two pieces of the name will be empty (the scope name and the element name).
- SetCenterOfMassInBodyFrame(self: pydrake.multibody.tree.RigidBody, context: pydrake.systems.framework.Context, com: numpy.ndarray[numpy.float64[3, 1]]) None
(Advanced) Sets this body’s center of mass position while preserving its inertia about its body origin.
- Parameter
out
: ] context contains the state of the multibody system. It is modified to store the updated com (center of mass position).
- Parameter
com
: position vector from Bo (this body B’s origin) to Bcm (B’s center of mass), expressed in B.
Note
This function changes B’s center of mass position without modifying G_BBo_B (B’s unit inertia about Bo, expressed in B). Since this use case is very unlikely, consider using SetSpatialInertiaInBodyFrame() or SetCenterOfMassInBodyFrameAndPreserveCentralInertia().
- Precondition:
the context makes sense for use by this RigidBody.
- Raises
RuntimeError if context is null. –
Warning
Do not use this function unless it is needed (think twice).
- Parameter
- SetMass(self: pydrake.multibody.tree.RigidBody, context: pydrake.systems.framework.Context, mass: float) None
For this RigidBody B, sets its mass stored in
context
tomass
.- Parameter
context
: contains the state of the multibody system.
- Parameter
mass
: mass of this rigid body B.
Note
This function changes this body B’s mass and appropriately scales I_BBo_B (B’s rotational inertia about Bo, expressed in B).
- Precondition:
the context makes sense for use by this RigidBody.
- Raises
RuntimeError if context is null. –
- Parameter
- SetSpatialInertiaInBodyFrame(self: pydrake.multibody.tree.RigidBody, context: pydrake.systems.framework.Context, M_Bo_B: pydrake.multibody.tree.SpatialInertia) None
For this RigidBody B, sets its SpatialInertia that is stored in
context
toM_Bo_B
.- Parameter
context
: contains the state of the multibody system.
- Parameter
M_Bo_B
: spatial inertia of this rigid body B about Bo (B’s origin), expressed in B. M_Bo_B contains properties related to B’s mass, the position vector from Bo to Bcm (B’s center of mass), and G_Bo_B (B’s unit inertia about Bo expressed in B).
- Precondition:
the context makes sense for use by this RigidBody.
- Raises
RuntimeError if context is null. –
- Parameter
- Unlock(self: pydrake.multibody.tree.RigidBody, context: pydrake.systems.framework.Context) None
For a floating base RigidBody, unlock its inboard joint.
- Raises
RuntimeError if this body is not a floating base body. –
- template pydrake.multibody.tree.RigidBody_
Instantiations:
RigidBody_[float]
,RigidBody_[AutoDiffXd]
,RigidBody_[Expression]
- class pydrake.multibody.tree.RigidBody_[AutoDiffXd]
The term rigid body implies that the deformations of the body under consideration are so small that they have no significant effect on the overall motions of the body and therefore deformations can be neglected. If deformations are neglected, the distance between any two points on the rigid body remains constant at all times. This invariance of the distance between two arbitrary points is often taken as the definition of a rigid body in classical treatments of multibody mechanics [Goldstein 2001]. It can be demonstrated that the unconstrained three-dimensional motions of a rigid body can be described by six coordinates and thus it is often said that a free body in space has six degrees of freedom. These degrees of freedom obey the Newton-Euler equations of motion. However, within a MultibodyTree, a RigidBody is not free in space; instead, it is assigned a limited number of degrees of freedom (0-6) with respect to its parent body in the multibody tree by its Mobilizer (also called a “tree joint” or “inboard joint”). Additional constraints on permissible motion can be added using Constraint objects to remove more degrees of freedom.
- [Goldstein 2001] H Goldstein, CP Poole, JL Safko, Classical Mechanics
(3rd Edition), Addison-Wesley, 2001.
- __init__(*args, **kwargs)
Overloaded function.
__init__(self: pydrake.multibody.tree.RigidBody_[AutoDiffXd], body_name: str, M_BBo_B: pydrake.multibody.tree.SpatialInertia = SpatialInertia.Zero()) -> None
Constructs a RigidBody named
body_name
with the given default SpatialInertia.- Parameter
body_name
: A name associated with this body.
- Parameter
M_BBo_B
: Spatial inertia of this body B about the frame’s origin
Bo
and expressed in the body frame B. When not provided, defaults to zero.
Note
See multibody_spatial_inertia for details on the monogram notation used for spatial inertia quantities.
__init__(self: pydrake.multibody.tree.RigidBody_[AutoDiffXd], body_name: str, model_instance: pydrake.multibody.tree.ModelInstanceIndex, M_BBo_B: pydrake.multibody.tree.SpatialInertia = SpatialInertia.Zero()) -> None
Constructs a RigidBody named
body_name
with the given default SpatialInertia.- Parameter
body_name
: A name associated with this body.
- Parameter
model_instance
: The model instance associated with this body.
- Parameter
M_BBo_B
: Spatial inertia of this body B about the frame’s origin
Bo
and expressed in the body frame B. When not provided, defaults to zero.
Note
See multibody_spatial_inertia for details on the monogram notation used for spatial inertia quantities.
- AddInForce(self: pydrake.multibody.tree.RigidBody_[AutoDiffXd], context: pydrake.systems.framework.Context_[AutoDiffXd], p_BP_E: numpy.ndarray[object[3, 1]], F_Bp_E: pydrake.multibody.math.SpatialForce_[AutoDiffXd], frame_E: pydrake.multibody.tree.Frame_[AutoDiffXd], forces: pydrake.multibody.tree.MultibodyForces_[AutoDiffXd]) None
Adds the SpatialForce on this RigidBody B, applied at point P and expressed in a frame E into
forces
.- Parameter
context
: The context containing the current state of the model.
- Parameter
p_BP_E
: The position of point P in B, expressed in a frame E.
- Parameter
F_Bp_E
: The spatial force to be applied on body B at point P, expressed in frame E.
- Parameter
frame_E
: The expressed-in frame E.
- Parameter
forces
: A multibody forces objects that on output will have
F_Bp_E
added.
- Raises
RuntimeError if forces is nullptr or if it is not consistent –
with the model to which this body belongs. –
- Parameter
- AddInForceInWorld(self: pydrake.multibody.tree.RigidBody_[AutoDiffXd], context: pydrake.systems.framework.Context_[AutoDiffXd], F_Bo_W: pydrake.multibody.math.SpatialForce_[AutoDiffXd], forces: pydrake.multibody.tree.MultibodyForces_[AutoDiffXd]) None
Adds the SpatialForce on this RigidBody B, applied at body B’s origin Bo and expressed in the world frame W into
forces
.
- body_frame(self: pydrake.multibody.tree.RigidBody_[AutoDiffXd]) pydrake.multibody.tree.RigidBodyFrame_[AutoDiffXd]
Returns a const reference to the associated BodyFrame.
- CalcCenterOfMassInBodyFrame(self: pydrake.multibody.tree.RigidBody_[AutoDiffXd], context: pydrake.systems.framework.Context_[AutoDiffXd]) numpy.ndarray[object[3, 1]]
Gets this body’s center of mass position from the given context.
- Parameter
context
: contains the state of the multibody system.
- Returns
p_BoBcm_B position vector from Bo (this rigid body B’s origin) to Bcm (B’s center of mass), expressed in B.
- Precondition:
the context makes sense for use by this RigidBody.
- Parameter
- CalcCenterOfMassTranslationalAccelerationInWorld(self: pydrake.multibody.tree.RigidBody_[AutoDiffXd], context: pydrake.systems.framework.Context_[AutoDiffXd]) numpy.ndarray[object[3, 1]]
Calculates Bcm’s translational acceleration in the world frame W.
- Parameter
context
: The context contains the state of the model.
- Returns
a_WBcm_W
: The translational acceleration of Bcm (this rigid body’s center of mass) in the world frame W, expressed in W.
Note
When cached values are out of sync with the state stored in context, this method performs an expensive forward dynamics computation, whereas once evaluated, successive calls to this method are inexpensive.
- Parameter
- CalcCenterOfMassTranslationalVelocityInWorld(self: pydrake.multibody.tree.RigidBody_[AutoDiffXd], context: pydrake.systems.framework.Context_[AutoDiffXd]) numpy.ndarray[object[3, 1]]
Calculates Bcm’s translational velocity in the world frame W.
- Parameter
context
: The context contains the state of the model.
- Returns
v_WBcm_W
: The translational velocity of Bcm (this rigid body’s center of mass) in the world frame W, expressed in W.
- Parameter
- CalcSpatialInertiaInBodyFrame(self: pydrake.multibody.tree.RigidBody_[AutoDiffXd], context: pydrake.systems.framework.Context_[AutoDiffXd]) pydrake.multibody.tree.SpatialInertia_[AutoDiffXd]
Gets this body’s spatial inertia about its origin from the given context.
- Parameter
context
: contains the state of the multibody system.
- Returns
M_BBo_B spatial inertia of this rigid body B about Bo (B’s origin), expressed in B. M_BBo_B contains properties related to B’s mass, the position vector from Bo to Bcm (B’s center of mass), and G_BBo_B (B’s unit inertia about Bo expressed in B).
- Precondition:
the context makes sense for use by this RigidBody.
- Parameter
- default_com(self: pydrake.multibody.tree.RigidBody_[AutoDiffXd]) numpy.ndarray[numpy.float64[3, 1]]
Returns the default value of this RigidBody’s center of mass as measured and expressed in its body frame. This value is initially supplied at construction when specifying this body’s SpatialInertia.
- Returns
p_BoBcm_B
: The position of this rigid body B’s center of mass
Bcm
measured from Bo (B’s frame origin) and expressed in B (body B’s frame).
- Returns
- default_mass(*args, **kwargs)
Overloaded function.
default_mass(self: pydrake.multibody.tree.RigidBody_[AutoDiffXd]) -> float
Returns this RigidBody’s default mass, which is initially supplied at construction when specifying this body’s SpatialInertia.
Note
In general, a rigid body’s mass can be a constant property stored in this rigid body’s SpatialInertia or a parameter that is stored in a Context. The default constant mass value is used to initialize the mass parameter in the Context.
default_mass(self: pydrake.multibody.tree.RigidBody_[AutoDiffXd]) -> float
Returns this RigidBody’s default mass, which is initially supplied at construction when specifying this body’s SpatialInertia.
Note
In general, a rigid body’s mass can be a constant property stored in this rigid body’s SpatialInertia or a parameter that is stored in a Context. The default constant mass value is used to initialize the mass parameter in the Context.
- default_rotational_inertia(self: pydrake.multibody.tree.RigidBody_[AutoDiffXd]) pydrake.multibody.tree.RotationalInertia
Gets the default value of this body B’s rotational inertia about Bo (B’s origin), expressed in B (this body’s body frame). This value is calculated from the SpatialInertia supplied at construction of this body.
- Returns
I_BBo_B
: body B’s rotational inertia about Bo, expressed in B.
- Returns
- default_spatial_inertia(self: pydrake.multibody.tree.RigidBody_[AutoDiffXd]) pydrake.multibody.tree.SpatialInertia
Gets the default value of this body B’s SpatialInertia about Bo (B’s origin) and expressed in B (this body’s frame).
- Returns
M_BBo_B
: body B’s spatial inertia about Bo, expressed in B.
- Returns
- default_unit_inertia(self: pydrake.multibody.tree.RigidBody_[AutoDiffXd]) pydrake.multibody.tree.UnitInertia
Returns the default value of this body B’s unit inertia about Bo (body B’s origin), expressed in B (this body’s body frame). This value is initially supplied at construction when specifying this body’s SpatialInertia.
- Returns
G_BBo_B
: rigid body B’s unit inertia about Bo, expressed in B.
- Returns
- EvalPoseInWorld(self: pydrake.multibody.tree.RigidBody_[AutoDiffXd], context: pydrake.systems.framework.Context_[AutoDiffXd]) pydrake.math.RigidTransform_[AutoDiffXd]
Returns the pose
X_WB
of this RigidBody B in the world frame W as a function of the state of the model stored incontext
.
- EvalSpatialAccelerationInWorld(self: pydrake.multibody.tree.RigidBody_[AutoDiffXd], context: pydrake.systems.framework.Context_[AutoDiffXd]) pydrake.multibody.math.SpatialAcceleration_[AutoDiffXd]
Evaluates A_WB, this body B’s SpatialAcceleration in the world frame W.
- Parameter
context
: Contains the state of the model.
- Returns
A_WB_W
: this body B’s spatial acceleration in the world frame W, expressed in W (for point Bo, the body’s origin).
Note
When cached values are out of sync with the state stored in context, this method performs an expensive forward dynamics computation, whereas once evaluated, successive calls to this method are inexpensive.
- Parameter
- EvalSpatialVelocityInWorld(self: pydrake.multibody.tree.RigidBody_[AutoDiffXd], context: pydrake.systems.framework.Context_[AutoDiffXd]) pydrake.multibody.math.SpatialVelocity_[AutoDiffXd]
Evaluates V_WB, this body B’s SpatialVelocity in the world frame W.
- Parameter
context
: Contains the state of the model.
- Returns
V_WB_W
: this body B’s spatial velocity in the world frame W, expressed in W (for point Bo, the body frame’s origin).
- Parameter
- floating_position_suffix(self: pydrake.multibody.tree.RigidBody_[AutoDiffXd], arg0: int) str
Returns a string suffix (e.g. to be appended to the name()) to identify the
k`th position in the floating base. `position_index_in_body
must be in [0, 7) ifhas_quaternion_dofs()
is true, otherwise in [0, 6).- Raises
RuntimeError if called pre-finalize –
- Precondition:
this is a floating base body
See also
is_floating(), has_quaternion_dofs(), MultibodyPlant::Finalize()
- floating_positions_start(self: pydrake.multibody.tree.RigidBody_[AutoDiffXd]) int
(Advanced) For floating base bodies (see is_floating()) this method returns the index of this RigidBody’s first generalized position in the vector q of generalized position coordinates for a MultibodyPlant model. Positions q for this RigidBody are then contiguous starting at this index. When a floating RigidBody is modeled with quaternion coordinates (see has_quaternion_dofs()), the four consecutive entries in the state starting at this index correspond to the quaternion that parametrizes this RigidBody’s orientation.
- Raises
RuntimeError if called pre-finalize –
- Precondition:
this is a floating base body
See also
is_floating(), has_quaternion_dofs(), MultibodyPlant::Finalize()
- floating_velocities_start_in_v(self: pydrake.multibody.tree.RigidBody_[AutoDiffXd]) int
(Advanced) For floating base bodies (see is_floating()) this method returns the index of this RigidBody’s first generalized velocity in the vector v of generalized velocities for a MultibodyPlant model. Velocities v for this RigidBody are then contiguous starting at this index.
- Raises
RuntimeError if called pre-finalize –
- Precondition:
this is a floating base body
See also
is_floating(), MultibodyPlant::Finalize()
- floating_velocity_suffix(self: pydrake.multibody.tree.RigidBody_[AutoDiffXd], arg0: int) str
Returns a string suffix (e.g. to be appended to the name()) to identify the
k`th velocity in the floating base. `velocity_index_in_body
must be in [0,6).- Raises
RuntimeError if called pre-finalize –
- Precondition:
this is a floating base body
See also
is_floating(), MultibodyPlant::Finalize()
- get_mass(self: pydrake.multibody.tree.RigidBody_[AutoDiffXd], context: pydrake.systems.framework.Context_[AutoDiffXd]) pydrake.autodiffutils.AutoDiffXd
Gets this body’s mass from the given context.
- Parameter
context
: contains the state of the multibody system.
- Precondition:
the context makes sense for use by this RigidBody.
- Parameter
- GetForceInWorld(self: pydrake.multibody.tree.RigidBody_[AutoDiffXd], context: pydrake.systems.framework.Context_[AutoDiffXd], forces: pydrake.multibody.tree.MultibodyForces_[AutoDiffXd]) pydrake.multibody.math.SpatialForce_[AutoDiffXd]
Gets the SpatialForce on this RigidBody B from
forces
as F_BBo_W: applied at body B’s origin Bo and expressed in world frame W.
- GetParentPlant(self: pydrake.multibody.tree.RigidBody_[AutoDiffXd]) drake::multibody::MultibodyPlant<Eigen::AutoDiffScalar<Eigen::Matrix<double, -1, 1, 0, -1, 1> > >
- has_quaternion_dofs(self: pydrake.multibody.tree.RigidBody_[AutoDiffXd]) bool
(Advanced) If
True
, this body’s generalized position coordinates q include a quaternion, which occupies the first four elements of q. Note that this does not imply that the body is floating base body since it may have fewer than 6 dofs or its inboard body could be something other than World.- Raises
RuntimeError if called pre-finalize –
See also
is_floating(), MultibodyPlant::Finalize()
- index(self: pydrake.multibody.tree.RigidBody_[AutoDiffXd]) pydrake.multibody.tree.BodyIndex
- is_floating(self: pydrake.multibody.tree.RigidBody_[AutoDiffXd]) bool
(Advanced) Returns
True
if this body is granted 6-dofs by a Mobilizer and the parent body of this body’s associated 6-dof joint isworld
.Note
A floating base body is not necessarily modeled with a quaternion mobilizer, see has_quaternion_dofs(). Alternative options include a roll-pitch-yaw (rpy) parametrization of rotations, see RpyFloatingMobilizer.
- Raises
RuntimeError if called pre-finalize, –
See also
MultibodyPlant::Finalize()
- is_locked(self: pydrake.multibody.tree.RigidBody_[AutoDiffXd], context: pydrake.systems.framework.Context_[AutoDiffXd]) bool
Determines whether this RigidBody is currently locked to its inboard (parent) RigidBody. This is not limited to floating base bodies but generally Joint::is_locked() is preferable otherwise.
- Returns
true if the body is locked, false otherwise.
- Lock(self: pydrake.multibody.tree.RigidBody_[AutoDiffXd], context: pydrake.systems.framework.Context_[AutoDiffXd]) None
For a floating base RigidBody, lock its inboard joint. Its generalized velocities will be 0 until it is unlocked.
- Raises
RuntimeError if this body is not a floating base body. –
- model_instance(self: pydrake.multibody.tree.RigidBody_[AutoDiffXd]) pydrake.multibody.tree.ModelInstanceIndex
- name(self: pydrake.multibody.tree.RigidBody_[AutoDiffXd]) str
Gets the
name
associated with this rigid body. The name will never be empty.
- scoped_name(self: pydrake.multibody.tree.RigidBody_[AutoDiffXd]) pydrake.multibody.tree.ScopedName
Returns scoped name of this frame. Neither of the two pieces of the name will be empty (the scope name and the element name).
- SetCenterOfMassInBodyFrame(self: pydrake.multibody.tree.RigidBody_[AutoDiffXd], context: pydrake.systems.framework.Context_[AutoDiffXd], com: numpy.ndarray[object[3, 1]]) None
(Advanced) Sets this body’s center of mass position while preserving its inertia about its body origin.
- Parameter
out
: ] context contains the state of the multibody system. It is modified to store the updated com (center of mass position).
- Parameter
com
: position vector from Bo (this body B’s origin) to Bcm (B’s center of mass), expressed in B.
Note
This function changes B’s center of mass position without modifying G_BBo_B (B’s unit inertia about Bo, expressed in B). Since this use case is very unlikely, consider using SetSpatialInertiaInBodyFrame() or SetCenterOfMassInBodyFrameAndPreserveCentralInertia().
- Precondition:
the context makes sense for use by this RigidBody.
- Raises
RuntimeError if context is null. –
Warning
Do not use this function unless it is needed (think twice).
- Parameter
- SetMass(self: pydrake.multibody.tree.RigidBody_[AutoDiffXd], context: pydrake.systems.framework.Context_[AutoDiffXd], mass: pydrake.autodiffutils.AutoDiffXd) None
For this RigidBody B, sets its mass stored in
context
tomass
.- Parameter
context
: contains the state of the multibody system.
- Parameter
mass
: mass of this rigid body B.
Note
This function changes this body B’s mass and appropriately scales I_BBo_B (B’s rotational inertia about Bo, expressed in B).
- Precondition:
the context makes sense for use by this RigidBody.
- Raises
RuntimeError if context is null. –
- Parameter
- SetSpatialInertiaInBodyFrame(self: pydrake.multibody.tree.RigidBody_[AutoDiffXd], context: pydrake.systems.framework.Context_[AutoDiffXd], M_Bo_B: pydrake.multibody.tree.SpatialInertia_[AutoDiffXd]) None
For this RigidBody B, sets its SpatialInertia that is stored in
context
toM_Bo_B
.- Parameter
context
: contains the state of the multibody system.
- Parameter
M_Bo_B
: spatial inertia of this rigid body B about Bo (B’s origin), expressed in B. M_Bo_B contains properties related to B’s mass, the position vector from Bo to Bcm (B’s center of mass), and G_Bo_B (B’s unit inertia about Bo expressed in B).
- Precondition:
the context makes sense for use by this RigidBody.
- Raises
RuntimeError if context is null. –
- Parameter
- Unlock(self: pydrake.multibody.tree.RigidBody_[AutoDiffXd], context: pydrake.systems.framework.Context_[AutoDiffXd]) None
For a floating base RigidBody, unlock its inboard joint.
- Raises
RuntimeError if this body is not a floating base body. –
- class pydrake.multibody.tree.RigidBody_[Expression]
The term rigid body implies that the deformations of the body under consideration are so small that they have no significant effect on the overall motions of the body and therefore deformations can be neglected. If deformations are neglected, the distance between any two points on the rigid body remains constant at all times. This invariance of the distance between two arbitrary points is often taken as the definition of a rigid body in classical treatments of multibody mechanics [Goldstein 2001]. It can be demonstrated that the unconstrained three-dimensional motions of a rigid body can be described by six coordinates and thus it is often said that a free body in space has six degrees of freedom. These degrees of freedom obey the Newton-Euler equations of motion. However, within a MultibodyTree, a RigidBody is not free in space; instead, it is assigned a limited number of degrees of freedom (0-6) with respect to its parent body in the multibody tree by its Mobilizer (also called a “tree joint” or “inboard joint”). Additional constraints on permissible motion can be added using Constraint objects to remove more degrees of freedom.
- [Goldstein 2001] H Goldstein, CP Poole, JL Safko, Classical Mechanics
(3rd Edition), Addison-Wesley, 2001.
- __init__(*args, **kwargs)
Overloaded function.
__init__(self: pydrake.multibody.tree.RigidBody_[Expression], body_name: str, M_BBo_B: pydrake.multibody.tree.SpatialInertia = SpatialInertia.Zero()) -> None
Constructs a RigidBody named
body_name
with the given default SpatialInertia.- Parameter
body_name
: A name associated with this body.
- Parameter
M_BBo_B
: Spatial inertia of this body B about the frame’s origin
Bo
and expressed in the body frame B. When not provided, defaults to zero.
Note
See multibody_spatial_inertia for details on the monogram notation used for spatial inertia quantities.
__init__(self: pydrake.multibody.tree.RigidBody_[Expression], body_name: str, model_instance: pydrake.multibody.tree.ModelInstanceIndex, M_BBo_B: pydrake.multibody.tree.SpatialInertia = SpatialInertia.Zero()) -> None
Constructs a RigidBody named
body_name
with the given default SpatialInertia.- Parameter
body_name
: A name associated with this body.
- Parameter
model_instance
: The model instance associated with this body.
- Parameter
M_BBo_B
: Spatial inertia of this body B about the frame’s origin
Bo
and expressed in the body frame B. When not provided, defaults to zero.
Note
See multibody_spatial_inertia for details on the monogram notation used for spatial inertia quantities.
- AddInForce(self: pydrake.multibody.tree.RigidBody_[Expression], context: pydrake.systems.framework.Context_[Expression], p_BP_E: numpy.ndarray[object[3, 1]], F_Bp_E: pydrake.multibody.math.SpatialForce_[Expression], frame_E: pydrake.multibody.tree.Frame_[Expression], forces: pydrake.multibody.tree.MultibodyForces_[Expression]) None
Adds the SpatialForce on this RigidBody B, applied at point P and expressed in a frame E into
forces
.- Parameter
context
: The context containing the current state of the model.
- Parameter
p_BP_E
: The position of point P in B, expressed in a frame E.
- Parameter
F_Bp_E
: The spatial force to be applied on body B at point P, expressed in frame E.
- Parameter
frame_E
: The expressed-in frame E.
- Parameter
forces
: A multibody forces objects that on output will have
F_Bp_E
added.
- Raises
RuntimeError if forces is nullptr or if it is not consistent –
with the model to which this body belongs. –
- Parameter
- AddInForceInWorld(self: pydrake.multibody.tree.RigidBody_[Expression], context: pydrake.systems.framework.Context_[Expression], F_Bo_W: pydrake.multibody.math.SpatialForce_[Expression], forces: pydrake.multibody.tree.MultibodyForces_[Expression]) None
Adds the SpatialForce on this RigidBody B, applied at body B’s origin Bo and expressed in the world frame W into
forces
.
- body_frame(self: pydrake.multibody.tree.RigidBody_[Expression]) pydrake.multibody.tree.RigidBodyFrame_[Expression]
Returns a const reference to the associated BodyFrame.
- CalcCenterOfMassInBodyFrame(self: pydrake.multibody.tree.RigidBody_[Expression], context: pydrake.systems.framework.Context_[Expression]) numpy.ndarray[object[3, 1]]
Gets this body’s center of mass position from the given context.
- Parameter
context
: contains the state of the multibody system.
- Returns
p_BoBcm_B position vector from Bo (this rigid body B’s origin) to Bcm (B’s center of mass), expressed in B.
- Precondition:
the context makes sense for use by this RigidBody.
- Parameter
- CalcCenterOfMassTranslationalAccelerationInWorld(self: pydrake.multibody.tree.RigidBody_[Expression], context: pydrake.systems.framework.Context_[Expression]) numpy.ndarray[object[3, 1]]
Calculates Bcm’s translational acceleration in the world frame W.
- Parameter
context
: The context contains the state of the model.
- Returns
a_WBcm_W
: The translational acceleration of Bcm (this rigid body’s center of mass) in the world frame W, expressed in W.
Note
When cached values are out of sync with the state stored in context, this method performs an expensive forward dynamics computation, whereas once evaluated, successive calls to this method are inexpensive.
- Parameter
- CalcCenterOfMassTranslationalVelocityInWorld(self: pydrake.multibody.tree.RigidBody_[Expression], context: pydrake.systems.framework.Context_[Expression]) numpy.ndarray[object[3, 1]]
Calculates Bcm’s translational velocity in the world frame W.
- Parameter
context
: The context contains the state of the model.
- Returns
v_WBcm_W
: The translational velocity of Bcm (this rigid body’s center of mass) in the world frame W, expressed in W.
- Parameter
- CalcSpatialInertiaInBodyFrame(self: pydrake.multibody.tree.RigidBody_[Expression], context: pydrake.systems.framework.Context_[Expression]) pydrake.multibody.tree.SpatialInertia_[Expression]
Gets this body’s spatial inertia about its origin from the given context.
- Parameter
context
: contains the state of the multibody system.
- Returns
M_BBo_B spatial inertia of this rigid body B about Bo (B’s origin), expressed in B. M_BBo_B contains properties related to B’s mass, the position vector from Bo to Bcm (B’s center of mass), and G_BBo_B (B’s unit inertia about Bo expressed in B).
- Precondition:
the context makes sense for use by this RigidBody.
- Parameter
- default_com(self: pydrake.multibody.tree.RigidBody_[Expression]) numpy.ndarray[numpy.float64[3, 1]]
Returns the default value of this RigidBody’s center of mass as measured and expressed in its body frame. This value is initially supplied at construction when specifying this body’s SpatialInertia.
- Returns
p_BoBcm_B
: The position of this rigid body B’s center of mass
Bcm
measured from Bo (B’s frame origin) and expressed in B (body B’s frame).
- Returns
- default_mass(*args, **kwargs)
Overloaded function.
default_mass(self: pydrake.multibody.tree.RigidBody_[Expression]) -> float
Returns this RigidBody’s default mass, which is initially supplied at construction when specifying this body’s SpatialInertia.
Note
In general, a rigid body’s mass can be a constant property stored in this rigid body’s SpatialInertia or a parameter that is stored in a Context. The default constant mass value is used to initialize the mass parameter in the Context.
default_mass(self: pydrake.multibody.tree.RigidBody_[Expression]) -> float
Returns this RigidBody’s default mass, which is initially supplied at construction when specifying this body’s SpatialInertia.
Note
In general, a rigid body’s mass can be a constant property stored in this rigid body’s SpatialInertia or a parameter that is stored in a Context. The default constant mass value is used to initialize the mass parameter in the Context.
- default_rotational_inertia(self: pydrake.multibody.tree.RigidBody_[Expression]) pydrake.multibody.tree.RotationalInertia
Gets the default value of this body B’s rotational inertia about Bo (B’s origin), expressed in B (this body’s body frame). This value is calculated from the SpatialInertia supplied at construction of this body.
- Returns
I_BBo_B
: body B’s rotational inertia about Bo, expressed in B.
- Returns
- default_spatial_inertia(self: pydrake.multibody.tree.RigidBody_[Expression]) pydrake.multibody.tree.SpatialInertia
Gets the default value of this body B’s SpatialInertia about Bo (B’s origin) and expressed in B (this body’s frame).
- Returns
M_BBo_B
: body B’s spatial inertia about Bo, expressed in B.
- Returns
- default_unit_inertia(self: pydrake.multibody.tree.RigidBody_[Expression]) pydrake.multibody.tree.UnitInertia
Returns the default value of this body B’s unit inertia about Bo (body B’s origin), expressed in B (this body’s body frame). This value is initially supplied at construction when specifying this body’s SpatialInertia.
- Returns
G_BBo_B
: rigid body B’s unit inertia about Bo, expressed in B.
- Returns
- EvalPoseInWorld(self: pydrake.multibody.tree.RigidBody_[Expression], context: pydrake.systems.framework.Context_[Expression]) pydrake.math.RigidTransform_[Expression]
Returns the pose
X_WB
of this RigidBody B in the world frame W as a function of the state of the model stored incontext
.
- EvalSpatialAccelerationInWorld(self: pydrake.multibody.tree.RigidBody_[Expression], context: pydrake.systems.framework.Context_[Expression]) pydrake.multibody.math.SpatialAcceleration_[Expression]
Evaluates A_WB, this body B’s SpatialAcceleration in the world frame W.
- Parameter
context
: Contains the state of the model.
- Returns
A_WB_W
: this body B’s spatial acceleration in the world frame W, expressed in W (for point Bo, the body’s origin).
Note
When cached values are out of sync with the state stored in context, this method performs an expensive forward dynamics computation, whereas once evaluated, successive calls to this method are inexpensive.
- Parameter
- EvalSpatialVelocityInWorld(self: pydrake.multibody.tree.RigidBody_[Expression], context: pydrake.systems.framework.Context_[Expression]) pydrake.multibody.math.SpatialVelocity_[Expression]
Evaluates V_WB, this body B’s SpatialVelocity in the world frame W.
- Parameter
context
: Contains the state of the model.
- Returns
V_WB_W
: this body B’s spatial velocity in the world frame W, expressed in W (for point Bo, the body frame’s origin).
- Parameter
- floating_position_suffix(self: pydrake.multibody.tree.RigidBody_[Expression], arg0: int) str
Returns a string suffix (e.g. to be appended to the name()) to identify the
k`th position in the floating base. `position_index_in_body
must be in [0, 7) ifhas_quaternion_dofs()
is true, otherwise in [0, 6).- Raises
RuntimeError if called pre-finalize –
- Precondition:
this is a floating base body
See also
is_floating(), has_quaternion_dofs(), MultibodyPlant::Finalize()
- floating_positions_start(self: pydrake.multibody.tree.RigidBody_[Expression]) int
(Advanced) For floating base bodies (see is_floating()) this method returns the index of this RigidBody’s first generalized position in the vector q of generalized position coordinates for a MultibodyPlant model. Positions q for this RigidBody are then contiguous starting at this index. When a floating RigidBody is modeled with quaternion coordinates (see has_quaternion_dofs()), the four consecutive entries in the state starting at this index correspond to the quaternion that parametrizes this RigidBody’s orientation.
- Raises
RuntimeError if called pre-finalize –
- Precondition:
this is a floating base body
See also
is_floating(), has_quaternion_dofs(), MultibodyPlant::Finalize()
- floating_velocities_start_in_v(self: pydrake.multibody.tree.RigidBody_[Expression]) int
(Advanced) For floating base bodies (see is_floating()) this method returns the index of this RigidBody’s first generalized velocity in the vector v of generalized velocities for a MultibodyPlant model. Velocities v for this RigidBody are then contiguous starting at this index.
- Raises
RuntimeError if called pre-finalize –
- Precondition:
this is a floating base body
See also
is_floating(), MultibodyPlant::Finalize()
- floating_velocity_suffix(self: pydrake.multibody.tree.RigidBody_[Expression], arg0: int) str
Returns a string suffix (e.g. to be appended to the name()) to identify the
k`th velocity in the floating base. `velocity_index_in_body
must be in [0,6).- Raises
RuntimeError if called pre-finalize –
- Precondition:
this is a floating base body
See also
is_floating(), MultibodyPlant::Finalize()
- get_mass(self: pydrake.multibody.tree.RigidBody_[Expression], context: pydrake.systems.framework.Context_[Expression]) pydrake.symbolic.Expression
Gets this body’s mass from the given context.
- Parameter
context
: contains the state of the multibody system.
- Precondition:
the context makes sense for use by this RigidBody.
- Parameter
- GetForceInWorld(self: pydrake.multibody.tree.RigidBody_[Expression], context: pydrake.systems.framework.Context_[Expression], forces: pydrake.multibody.tree.MultibodyForces_[Expression]) pydrake.multibody.math.SpatialForce_[Expression]
Gets the SpatialForce on this RigidBody B from
forces
as F_BBo_W: applied at body B’s origin Bo and expressed in world frame W.
- GetParentPlant(self: pydrake.multibody.tree.RigidBody_[Expression]) drake::multibody::MultibodyPlant<drake::symbolic::Expression>
- has_quaternion_dofs(self: pydrake.multibody.tree.RigidBody_[Expression]) bool
(Advanced) If
True
, this body’s generalized position coordinates q include a quaternion, which occupies the first four elements of q. Note that this does not imply that the body is floating base body since it may have fewer than 6 dofs or its inboard body could be something other than World.- Raises
RuntimeError if called pre-finalize –
See also
is_floating(), MultibodyPlant::Finalize()
- index(self: pydrake.multibody.tree.RigidBody_[Expression]) pydrake.multibody.tree.BodyIndex
- is_floating(self: pydrake.multibody.tree.RigidBody_[Expression]) bool
(Advanced) Returns
True
if this body is granted 6-dofs by a Mobilizer and the parent body of this body’s associated 6-dof joint isworld
.Note
A floating base body is not necessarily modeled with a quaternion mobilizer, see has_quaternion_dofs(). Alternative options include a roll-pitch-yaw (rpy) parametrization of rotations, see RpyFloatingMobilizer.
- Raises
RuntimeError if called pre-finalize, –
See also
MultibodyPlant::Finalize()
- is_locked(self: pydrake.multibody.tree.RigidBody_[Expression], context: pydrake.systems.framework.Context_[Expression]) bool
Determines whether this RigidBody is currently locked to its inboard (parent) RigidBody. This is not limited to floating base bodies but generally Joint::is_locked() is preferable otherwise.
- Returns
true if the body is locked, false otherwise.
- Lock(self: pydrake.multibody.tree.RigidBody_[Expression], context: pydrake.systems.framework.Context_[Expression]) None
For a floating base RigidBody, lock its inboard joint. Its generalized velocities will be 0 until it is unlocked.
- Raises
RuntimeError if this body is not a floating base body. –
- model_instance(self: pydrake.multibody.tree.RigidBody_[Expression]) pydrake.multibody.tree.ModelInstanceIndex
- name(self: pydrake.multibody.tree.RigidBody_[Expression]) str
Gets the
name
associated with this rigid body. The name will never be empty.
- scoped_name(self: pydrake.multibody.tree.RigidBody_[Expression]) pydrake.multibody.tree.ScopedName
Returns scoped name of this frame. Neither of the two pieces of the name will be empty (the scope name and the element name).
- SetCenterOfMassInBodyFrame(self: pydrake.multibody.tree.RigidBody_[Expression], context: pydrake.systems.framework.Context_[Expression], com: numpy.ndarray[object[3, 1]]) None
(Advanced) Sets this body’s center of mass position while preserving its inertia about its body origin.
- Parameter
out
: ] context contains the state of the multibody system. It is modified to store the updated com (center of mass position).
- Parameter
com
: position vector from Bo (this body B’s origin) to Bcm (B’s center of mass), expressed in B.
Note
This function changes B’s center of mass position without modifying G_BBo_B (B’s unit inertia about Bo, expressed in B). Since this use case is very unlikely, consider using SetSpatialInertiaInBodyFrame() or SetCenterOfMassInBodyFrameAndPreserveCentralInertia().
- Precondition:
the context makes sense for use by this RigidBody.
- Raises
RuntimeError if context is null. –
Warning
Do not use this function unless it is needed (think twice).
- Parameter
- SetMass(self: pydrake.multibody.tree.RigidBody_[Expression], context: pydrake.systems.framework.Context_[Expression], mass: pydrake.symbolic.Expression) None
For this RigidBody B, sets its mass stored in
context
tomass
.- Parameter
context
: contains the state of the multibody system.
- Parameter
mass
: mass of this rigid body B.
Note
This function changes this body B’s mass and appropriately scales I_BBo_B (B’s rotational inertia about Bo, expressed in B).
- Precondition:
the context makes sense for use by this RigidBody.
- Raises
RuntimeError if context is null. –
- Parameter
- SetSpatialInertiaInBodyFrame(self: pydrake.multibody.tree.RigidBody_[Expression], context: pydrake.systems.framework.Context_[Expression], M_Bo_B: pydrake.multibody.tree.SpatialInertia_[Expression]) None
For this RigidBody B, sets its SpatialInertia that is stored in
context
toM_Bo_B
.- Parameter
context
: contains the state of the multibody system.
- Parameter
M_Bo_B
: spatial inertia of this rigid body B about Bo (B’s origin), expressed in B. M_Bo_B contains properties related to B’s mass, the position vector from Bo to Bcm (B’s center of mass), and G_Bo_B (B’s unit inertia about Bo expressed in B).
- Precondition:
the context makes sense for use by this RigidBody.
- Raises
RuntimeError if context is null. –
- Parameter
- Unlock(self: pydrake.multibody.tree.RigidBody_[Expression], context: pydrake.systems.framework.Context_[Expression]) None
For a floating base RigidBody, unlock its inboard joint.
- Raises
RuntimeError if this body is not a floating base body. –
- class pydrake.multibody.tree.RigidBodyFrame
Bases:
pydrake.multibody.tree.Frame
A RigidBodyFrame is a material Frame that serves as the unique reference frame for a RigidBody.
Each RigidBody B has a unique body frame for which we use the same symbol B (with meaning clear from context). We represent a body frame by a RigidBodyFrame object that is created whenever a RigidBody is constructed and is owned by the RigidBody. All properties of a RigidBody are defined with respect to its RigidBodyFrame, including its mass properties and attachment locations for joints, constraints, actuators, geometry and so on. Run time motion of the body is defined with respect to the motion of its body frame.
Note that the body frame associated with a rigid body does not necessarily need to be located at its center of mass nor does it need to be aligned with the body’s principal axes, although, in practice, it frequently is.
A RigidBodyFrame and RigidBody are tightly coupled concepts; neither makes sense without the other. Therefore, a RigidBodyFrame instance is constructed in conjunction with its RigidBody and cannot be constructed anywhere else. However, you can still access the frame associated with a body, see RigidBody::body_frame(). This access is more than a convenience; you can use the RigidBodyFrame to define other frames on the body and to attach other multibody elements to it.
Note
This class is templated; see
RigidBodyFrame_
for the list of instantiations.- __init__(*args, **kwargs)
- template pydrake.multibody.tree.RigidBodyFrame_
Instantiations:
RigidBodyFrame_[float]
,RigidBodyFrame_[AutoDiffXd]
,RigidBodyFrame_[Expression]
- class pydrake.multibody.tree.RigidBodyFrame_[AutoDiffXd]
Bases:
pydrake.multibody.tree.Frame_[AutoDiffXd]
A RigidBodyFrame is a material Frame that serves as the unique reference frame for a RigidBody.
Each RigidBody B has a unique body frame for which we use the same symbol B (with meaning clear from context). We represent a body frame by a RigidBodyFrame object that is created whenever a RigidBody is constructed and is owned by the RigidBody. All properties of a RigidBody are defined with respect to its RigidBodyFrame, including its mass properties and attachment locations for joints, constraints, actuators, geometry and so on. Run time motion of the body is defined with respect to the motion of its body frame.
Note that the body frame associated with a rigid body does not necessarily need to be located at its center of mass nor does it need to be aligned with the body’s principal axes, although, in practice, it frequently is.
A RigidBodyFrame and RigidBody are tightly coupled concepts; neither makes sense without the other. Therefore, a RigidBodyFrame instance is constructed in conjunction with its RigidBody and cannot be constructed anywhere else. However, you can still access the frame associated with a body, see RigidBody::body_frame(). This access is more than a convenience; you can use the RigidBodyFrame to define other frames on the body and to attach other multibody elements to it.
- __init__(*args, **kwargs)
- class pydrake.multibody.tree.RigidBodyFrame_[Expression]
Bases:
pydrake.multibody.tree.Frame_[Expression]
A RigidBodyFrame is a material Frame that serves as the unique reference frame for a RigidBody.
Each RigidBody B has a unique body frame for which we use the same symbol B (with meaning clear from context). We represent a body frame by a RigidBodyFrame object that is created whenever a RigidBody is constructed and is owned by the RigidBody. All properties of a RigidBody are defined with respect to its RigidBodyFrame, including its mass properties and attachment locations for joints, constraints, actuators, geometry and so on. Run time motion of the body is defined with respect to the motion of its body frame.
Note that the body frame associated with a rigid body does not necessarily need to be located at its center of mass nor does it need to be aligned with the body’s principal axes, although, in practice, it frequently is.
A RigidBodyFrame and RigidBody are tightly coupled concepts; neither makes sense without the other. Therefore, a RigidBodyFrame instance is constructed in conjunction with its RigidBody and cannot be constructed anywhere else. However, you can still access the frame associated with a body, see RigidBody::body_frame(). This access is more than a convenience; you can use the RigidBodyFrame to define other frames on the body and to attach other multibody elements to it.
- __init__(*args, **kwargs)
- class pydrake.multibody.tree.RotationalInertia
This class describes the mass distribution (inertia properties) of a body or composite body about a particular point. Herein, “composite body” means one body or a collection of bodies that are welded together. In this documentation, “body” and “composite body” are used interchangeably.
A rigid body’s mass distribution is described by three quantities: the body’s mass; the body’s center of mass; and the body’s rotational inertia about a particular point. The term rotational inertia is used here and by [Jain 2010] to distinguish from a body’s spatial inertia. In this class, a 3x3 inertia matrix I represents a body’s rotational inertia about a point and expressed in a frame. More specifically,
I_BP_E
is the inertia matrix of a body B about-point P and expressed-in frame E (herein frame E’s orthogonal unit vectors Ex, Ey, Ez are denoted 𝐱̂, 𝐲̂, 𝐳̂).Click to expand C++ code...
| Ixx Ixy Ixz | I = | Ixy Iyy Iyz | | Ixz Iyz Izz |
The moments of inertia Ixx, Iyy, Izz and products of inertia Ixy, Ixz, Iyz are defined in terms of the mass dm of a differential volume of the body. The position of dm from about-point P is xx̂ + yŷ + zẑ = [x, y, z]_E.
Click to expand C++ code...
Ixx = ∫ (y² + z²) dm Iyy = ∫ (x² + z²) dm Izz = ∫ (x² + y²) dm Ixy = - ∫ x y dm Ixz = - ∫ x z dm Iyz = - ∫ y z dm
We use the negated convention for products of inertia, so that I serves to relate angular velocity ω and angular momentum h via
h = I ⋅ ω
. Ensure your products of inertia follow this negative sign convention.The 3x3 inertia matrix is symmetric and its diagonal elements (moments of inertia) and off-diagonal elements (products of inertia) are associated with a body (or composite body) S, an about-point P, and an expressed-in frame E (𝐱̂, 𝐲̂, 𝐳̂̂). A rotational inertia is ill-defined unless there is a body S, about-point P, and expressed-in frame E. The user of this class is responsible for tracking the body S, about-point P and expressed-in frame E (none of these are stored in this class).
Note
This class does not store the about-point nor the expressed-in frame, nor does this class help enforce consistency of the about-point or expressed-in frame. To help users of this class track the about-point and expressed-in frame, we strongly recommend the following notation.
Note
In typeset material, use the symbol \([I^{S/P}]_E\) to represent the rotational inertia (inertia matrix) of a body (or composite body) S about-point P, expressed in frame E. In code and comments, use the monogram notation
I_SP_E
(e.g., as described in multibody_spatial_inertia). If the about-point P is fixed to a body B, the point is named \(B_P\) and this appears in code/comments asBp
. Examples:I_BBp_E
is rigid body B’s rotational inertia about-point Bp expressed-in frame E; I_BBo_E is B’s rotational inertia about-pointBo
(body B’s origin) expressed-in frame E; and I_BBcm_E is B’s inertia matrix about-pointBcm
(B’s center of mass) expressed-in frame E.Note
The rotational inertia (inertia matrix) can be re-expressed in terms of a special frame whose orthogonal unit vectors are parallel to principal axes of inertia so that the inertia matrix is diagonalized with elements called principal moments of inertia.
Note
The formal definition of the inertia matrix \(I^{S/P}\) of a system S about a point P follows the definition of the inertia dyadic 𝐈 of S about P, which begins by modeling S with n particles S₁ … Sₙ (e.g., 12 grams of carbon can be modeled with n = 6.02 * 10²³ molecules/particles). The inertia dyadic 𝐈₁ of one particle S₁ about point P is defined [Kane, 1985] in terms of m₁ (mass of S₁), ᴾ𝐩ˢ¹ (position vector from P to S₁), and the unit dyadic 𝐔 which is defined by the property 𝐔 ⋅ 𝐯 = 𝐯 where 𝐯 is is any vector (this definition of 𝐔 is analogous to defining the identity matrix by the property 𝑰𝒅𝒆𝒏𝒕𝒊𝒕𝒚𝑴𝒂𝒕𝒓𝒊𝒙 * 𝒂𝒏𝒚𝑴𝒂𝒕𝒓𝒊𝒙 = 𝒂𝒏𝒚𝑴𝒂𝒕𝒓𝒊𝒙).
Click to expand C++ code...
𝐈₁ = m₁ * [𝐔 * (ᴾ𝐩ˢ¹ ⋅ ᴾ𝐩ˢ¹) - ᴾ𝐩ˢ¹ * ᴾ𝐩ˢ¹]
Note: The vector dot-product (⋅) above produces a scalar whereas the vector multiply (*) produces a dyadic which is a 2nd-order tensor (ᴾ𝐩ˢ¹ * ᴾ𝐩ˢ¹ is similar to the matrix outer-product of a 3x1 matrix multiplied by a 1x3 matrix). An example inertia dyadic for a single particle is shown further below. The inertia dyadic 𝐈 of the entire system S is defined by summing the inertia dyadic of each particle Sᵢ about P (i = 1, … n), i.e.,
Click to expand C++ code...
𝐈 = 𝐈₁ + 𝐈₂ + ... 𝐈ₙ
The elements of the inertia matrix \([I^{S/P}]_E\) expressed in frame E (in terms of orthogonal unit vectors 𝐱̂, 𝐲̂, 𝐳̂̂) are found by pre-dot multiplying and post-dot multiplying 𝐈 with appropriate unit vectors.
Click to expand C++ code...
Ixx = 𝐱̂ ⋅ 𝐈 ⋅ 𝐱̂ Ixy = 𝐱̂ ⋅ 𝐈 ⋅ 𝐲̂ Ixz = 𝐱̂ ⋅ 𝐈 ⋅ 𝐳̂̂ Iyx = 𝐲̂ ⋅ 𝐈 ⋅ 𝐱̂ Iyy = 𝐲̂ ⋅ 𝐈 ⋅ 𝐲̂ Iyz = 𝐲̂ ⋅ 𝐈 ⋅ 𝐳̂̂ Izx = 𝐳̂̂ ⋅ 𝐈 ⋅ 𝐱̂ Izy = 𝐳̂̂ ⋅ 𝐈 ⋅ 𝐲̂ Izz = 𝐳̂̂ ⋅ 𝐈 ⋅ 𝐳̂̂
The inertia dyadic 𝐈ᴮ of a rigid body B about Bcm (B’s center of mass) is related to various dynamic quantities. For example, B’s angular momentum 𝐇 about Bcm in a frame N and B’s kinetic energy KE in N relate to 𝐈ᴮ by
Click to expand C++ code...
𝐇 = 𝐈ᴮ ⋅ 𝛚 KE = 1/2 𝛚 ⋅ 𝐈ᴮ ⋅ 𝛚 + 1/2 mᴮ 𝐯 ⋅ 𝐯
where 𝛚 is B’s angular velocity in N, 𝐯 is Bcm’s translational velocity in N, and mᴮ is B’s mass. When frame N happens to be a Newtonian frame (also called an inertial frame or non-rotating/non-accelerating frame), the moment 𝐓 of all forces on B about Bcm relates to 𝐈ᴮ and 𝛂 (B’s angular acceleration in N) by Euler’s rigid body equation as
Click to expand C++ code...
𝐓 = 𝐈ᴮ ⋅ 𝛂 + 𝛚 × 𝐈ᴮ ⋅ 𝛚
Example: For a particle Q of mass m whose position vector from a point O is written in terms of right-handed orthogonal unit vectors 𝐱̂, 𝐲̂, 𝐳̂ (below), the inertia dyadic 𝐈 of particle Q about point O is defined and calculated
Click to expand C++ code...
𝐩 = x 𝐱̂ + y 𝐲̂ (given) 𝐈 = m * [𝐔 * (𝐩 ⋅ 𝐩) - 𝐩 * 𝐩] (definition) = m * [𝐔 * (x² + y²) - (x𝐱̂ + y𝐲̂̂) * (x𝐱̂ + y𝐲̂) = m * [(𝐱̂𝐱̂ + 𝐲̂𝐲̂ + 𝐳̂𝐳̂) * (x² + y²) - (x²𝐱̂𝐱̂ + xy𝐱̂𝐲̂̂ + xy𝐲̂̂𝐱̂ + y²𝐲̂̂𝐲̂̂)] = m * [y²𝐱̂𝐱̂ + x²𝐲̂𝐲̂ + (x² + y²)𝐳̂𝐳̂ - xy𝐱̂𝐲̂̂ - xy𝐲̂̂𝐱̂]
which means the inertia matrix for particle Q about point O for 𝐱̂, 𝐲̂, 𝐳̂ is
Click to expand C++ code...
| m y² -m x y 0 | I = | -m x y m x² 0 | | 0 0 m (x² + y²) |
[Kane, 1985] pg. 68. “Dynamics: Theory and Applications,” McGraw-Hill Co., New York, 1985 (with D. A. Levinson). Available for free .pdf download: https://ecommons.cornell.edu/handle/1813/637
Note
Several methods in this class throw a RuntimeError for invalid rotational inertia operations in debug releases only. This provides speed in a release build while facilitating debugging in debug builds. In addition, these validity tests are only performed for scalar types for which drake::scalar_predicate<T>::is_bool is
True
. For instance, validity checks are not performed when T is symbolic::Expression.Note
The methods of this class satisfy the “basic exception guarantee”: if an exception is thrown, the program will still be in a valid state. Specifically, no resources are leaked, and all objects’ invariants are intact. Be aware that RotationalInertia objects may contain invalid inertia data in cases where input checking is skipped.
Various methods in this class require numerical (not symbolic) data types.
Note
This class is templated; see
RotationalInertia_
for the list of instantiations.- __init__(*args, **kwargs)
Overloaded function.
__init__(self: pydrake.multibody.tree.RotationalInertia) -> None
Constructs a rotational inertia that has all its moments/products of inertia equal to NaN (helps quickly detect uninitialized values).
__init__(self: pydrake.multibody.tree.RotationalInertia, Ixx: float, Iyy: float, Izz: float) -> None
Creates a rotational inertia with moments of inertia
Ixx
, Iyy,Izz
, and with each product of inertia set to zero.- Raises
RuntimeError for Debug builds if not CouldBePhysicallyValid() –
__init__(self: pydrake.multibody.tree.RotationalInertia, Ixx: float, Iyy: float, Izz: float, Ixy: float, Ixz: float, Iyz: float) -> None
Creates a rotational inertia with moments of inertia
Ixx
, Iyy,Izz
, and with products of inertiaIxy
, Ixz,Iyz
.- Raises
RuntimeError for Debug builds if not CouldBePhysicallyValid() –
__init__(self: pydrake.multibody.tree.RotationalInertia, mass: float, p_PQ_E: numpy.ndarray[numpy.float64[3, 1]]) -> None
Constructs a rotational inertia for a particle Q of mass
mass
, whose position vector from about-point P is p_PQ_E (E is expressed-in frame). This RuntimeError exception only occurs ifmass
< 0.- Parameter
mass
: The mass of particle Q.
- Parameter
p_PQ_E
: Position from about-point P to Q, expressed-in frame E.
- Returns
I_QP_E
: , Q’s rotational inertia about-point P expressed-in frame E.
- Remark:
Negating the position vector p_PQ_E has no affect on the result.
- Raises
RuntimeError for Debug builds if not CouldBePhysicallyValid() –
- CalcMaximumPossibleMomentOfInertia(self: pydrake.multibody.tree.RotationalInertia) float
Returns the maximum possible moment of inertia for
this
rotational inertia about-point P for any expressed-in frame E.- Remark:
The maximum moment Imax has range: trace / 3 <= Imax <= trace / 2.
See also
Trace()
- CalcPrincipalMomentsAndAxesOfInertia(self: pydrake.multibody.tree.RotationalInertia) tuple[numpy.ndarray[numpy.float64[3, 1]], pydrake.math.RotationMatrix]
Forms the 3 principal moments of inertia and their 3 associated principal directions for
this
rotational inertia.- Returns
3 principal moments of inertia [Ixx Iyy Izz], sorted in ascending order (Ixx ≤ Iyy ≤ Izz) and a rotation matrix R_EA whose columns are the 3 associated principal directions that relate the expressed-in frame E to a frame A, where frame E is the expressed-in frame for
this
rotational inertia I_BP_E (body B’s rotational inertia about-point P) and frame A contains right-handed orthonormal vectors Ax, Ay, Az. The 1ˢᵗ column of R_EA is Ax_E (Ax expressed in frame E) which is parallel to the principal axis associated with Ixx (the smallest principal moment of inertia). Similarly, the 2ⁿᵈ and 3ʳᵈ columns of R_EA are Ay_E and Az_E, which are parallel to principal axes associated with Iyy and Izz (the intermediate and largest principal moments of inertia). If all principal moments of inertia are equal (i.e., Ixx = Iyy = Izz), R_EA is the identity matrix.- Raises
RuntimeError if the elements of this rotational inertia cannot –
be converted to a real finite double. For example, an exception is –
thrown if this contains an erroneous NaN or if scalar type T –
is symbolic. –
See also
CalcPrincipalMomentsOfInertia() to calculate the principal moments of inertia [Ixx Iyy Izz], without calculating the principal directions.
- CalcPrincipalMomentsOfInertia(self: pydrake.multibody.tree.RotationalInertia) numpy.ndarray[numpy.float64[3, 1]]
Forms the 3 principal moments of inertia for
this
rotational inertia.- Returns
The
: 3 principal moments of inertia [Imin Imed Imax], sorted in ascending order (Imin ≤ Imed ≤ Imax).
- Raises
RuntimeError if the elements of this rotational inertia cannot –
be converted to a real finite double. For example, an exception is –
thrown if this contains an erroneous NaN or if scalar type T –
is symbolic. –
See also
CalcPrincipalMomentsAndAxesOfInertia() to also calculate principal moment of inertia directions associated with
this
rotational inertia.- Returns
- cols(self: pydrake.multibody.tree.RotationalInertia) int
For consistency with Eigen’s API, the cols() method returns 3.
- CopyToFullMatrix3(self: pydrake.multibody.tree.RotationalInertia) numpy.ndarray[numpy.float64[3, 3]]
Gets a full 3x3 matrix copy of this rotational inertia. The returned copy is symmetric and includes both lower and upper parts of the matrix.
- CouldBePhysicallyValid(self: pydrake.multibody.tree.RotationalInertia) bool
Performs several necessary checks to verify whether
this
rotational inertia could be physically valid, including:No NaN moments or products of inertia.
Ixx, Iyy, Izz and principal moments are all non-negative.
Ixx, Iyy Izz and principal moments satisfy the triangle inequality: -
Ixx + Iyy >= Izz
- Ixx + Izz >= Iyy -Iyy + Izz >= Ixx
Warning
These checks are necessary (but NOT sufficient) conditions for a rotational inertia to be physically valid. The sufficient condition requires a rotational inertia to satisfy the above checks after
this
is shifted to the center of mass, i.e., the sufficient condition requires calling CouldBePhysicallyValid() when the about-point is Bcm (the body’s center of mass). Note: this class does not know its about-point or its center of mass location.- Returns
True
for a plausible rotational inertia passing the above necessary but insufficient checks andFalse
otherwise.- Raises
RuntimeError if principal moments of inertia cannot be calculated –
(eigenvalue solver) or if scalar type T cannot be converted to a –
double. –
- get_moments(self: pydrake.multibody.tree.RotationalInertia) numpy.ndarray[numpy.float64[3, 1]]
Returns 3-element vector with moments of inertia [Ixx, Iyy, Izz].
- get_products(self: pydrake.multibody.tree.RotationalInertia) numpy.ndarray[numpy.float64[3, 1]]
Returns 3-element vector with products of inertia [Ixy, Ixz, Iyz].
- IsNaN(self: pydrake.multibody.tree.RotationalInertia) bool
Returns
True
if any moment/product inthis
rotational inertia is NaN. Otherwise returnsFalse
.
- IsNearlyEqualTo(self: pydrake.multibody.tree.RotationalInertia, other: pydrake.multibody.tree.RotationalInertia, precision: float) bool
Compares
this
rotational inertia toother
rotational inertia within the specifiedprecision
(which is a dimensionless number specifying the relative precision to which the comparison is performed). DenotingI_maxA
as the largest element value that can appear in a validthis
rotational inertia (independent of the expressed-in frame E) and denotingI_maxB
as the largest element value that can appear in a validother
rotational inertia (independent of the expressed-in frame E),this
andother
are considered nearly equal to each other, if: ‖this - other‖∞ < precision * min(I_maxA, I_maxB)- Parameter
other
: Rotational inertia to compare with
this
rotational inertia.- Parameter
precision
: is a dimensionless real positive number that is usually based on two factors, namely expected accuracy of moments/products of inertia (e.g., from end-user or CAD) and/or machine-precision.
- Returns
True
if the absolute value of each moment/product of inertia inthis
is withinepsilon
of the corresponding moment/ product absolute value inother
. Otherwise returnsFalse
.
Note
: This method only works if all moments of inertia with scalar type T in
this
andother
can be converted to a double (discarding supplemental scalar data such as derivatives of an AutoDiffXd). It fails at runtime if type T cannot be converted todouble
.- Parameter
- IsZero(self: pydrake.multibody.tree.RotationalInertia) bool
Returns
True
if all moments and products of inertia are exactly zero.
- ReExpress(self: pydrake.multibody.tree.RotationalInertia, R_AE: pydrake.math.RotationMatrix) pydrake.multibody.tree.RotationalInertia
Re-expresses
this
rotational inertiaI_BP_E
toI_BP_A
i.e., re-expresses body B’s rotational inertia from frame E to frame A.- Parameter
R_AE
: RotationMatrix relating frames A and E.
- Returns
I_BP_A
: Rotational inertia of B about-point P expressed-in frame A.
- Raises
RuntimeError for Debug builds if the rotational inertia that is –
re-expressed-in frame A violates CouldBePhysicallyValid() –
See also
ReExpressInPlace()
- Parameter
- rows(self: pydrake.multibody.tree.RotationalInertia) int
For consistency with Eigen’s API, the rows() method returns 3.
- SetToNaN(self: pydrake.multibody.tree.RotationalInertia) None
Sets
this
rotational inertia so all its elements are equal to NaN. This helps quickly detect uninitialized moments/products of inertia.
- SetZero(self: pydrake.multibody.tree.RotationalInertia) None
Sets
this
rotational inertia so all its moments/products of inertia are zero, e.g., for convenient initialization before a computation or for inertia calculations involving a particle (point-mass). Note: Real 3D massive physical objects have non-zero moments of inertia.
- ShiftFromCenterOfMass(self: pydrake.multibody.tree.RotationalInertia, mass: float, p_BcmQ_E: numpy.ndarray[numpy.float64[3, 1]]) pydrake.multibody.tree.RotationalInertia
Calculates the rotational inertia that results from shifting
this
rotational inertia for a body (or composite body) B from about-point Bcm (B’s center of mass) to about-point Q. I.e., shiftsI_BBcm_E
toI_BQ_E
(both are expressed-in frame E).- Parameter
mass
: The mass of body (or composite body) B.
- Parameter
p_BcmQ_E
: Position vector from Bcm to Q, expressed-in frame E.
- Returns
I_BQ_E
: B’s rotational inertia about-point Q expressed-in frame E.
- Raises
RuntimeError for Debug builds if the rotational inertia that is –
shifted to about-point Q violates CouldBePhysicallyValid() –
- Remark:
Negating the position vector p_BcmQ_E has no affect on the result.
- Parameter
- ShiftToCenterOfMass(self: pydrake.multibody.tree.RotationalInertia, mass: float, p_QBcm_E: numpy.ndarray[numpy.float64[3, 1]]) pydrake.multibody.tree.RotationalInertia
Calculates the rotational inertia that results from shifting
this
rotational inertia for a body (or composite body) B from about-point Q to about-pointBcm
(B’s center of mass). I.e., shiftsI_BQ_E
toI_BBcm_E
(both are expressed-in frame E).- Parameter
mass
: The mass of body (or composite body) B.
- Parameter
p_QBcm_E
: Position vector from Q to
Bcm
, expressed-in frame E.- Returns
I_BBcm_E
: B’s rotational inertia about-point
Bcm
expressed-in frame E.
- Raises
RuntimeError for Debug builds if the rotational inertia that is –
shifted to about-point Bcm violates CouldBePhysicallyValid() –
- Remark:
Negating the position vector
p_QBcm_E
has no affect on the result.
- Parameter
- ShiftToThenAwayFromCenterOfMass(self: pydrake.multibody.tree.RotationalInertia, mass: float, p_PBcm_E: numpy.ndarray[numpy.float64[3, 1]], p_QBcm_E: numpy.ndarray[numpy.float64[3, 1]]) pydrake.multibody.tree.RotationalInertia
Calculates the rotational inertia that results from shifting
this
rotational inertia for a body (or composite body) B from about-point P to about-point Q via Bcm (B’s center of mass). I.e., shiftsI_BP_E
toI_BQ_E
(both are expressed-in frame E).- Parameter
mass
: The mass of body (or composite body) B.
- Parameter
p_PBcm_E
: Position vector from P to Bcm, expressed-in frame E.
- Parameter
p_QBcm_E
: Position vector from Q to Bcm, expressed-in frame E.
- Returns
I_BQ_E
: , B’s rotational inertia about-point Q expressed-in frame E.
- Raises
RuntimeError for Debug builds if the rotational inertia that is –
shifted to about-point Q violates CouldBePhysicallyValid() –
- Remark:
Negating either (or both) position vectors p_PBcm_E and p_QBcm_E has no affect on the result.
- Parameter
- Trace(self: pydrake.multibody.tree.RotationalInertia) float
Returns a rotational inertia’s trace (i.e., Ixx + Iyy + Izz, the sum of the diagonal elements of the inertia matrix). The trace happens to be invariant to its expressed-in frame (i.e., the trace does not depend on the frame in which it is expressed). The trace is useful because the largest moment of inertia Imax has range: trace / 3 <= Imax <= trace / 2, and the largest possible product of inertia must be <= Imax / 2. Hence, trace / 3 and trace / 2 give a lower and upper bound on the largest possible element that can be in a valid rotational inertia.
- static TriaxiallySymmetric(I_triaxial: float) pydrake.multibody.tree.RotationalInertia
- template pydrake.multibody.tree.RotationalInertia_
Instantiations:
RotationalInertia_[float]
,RotationalInertia_[AutoDiffXd]
,RotationalInertia_[Expression]
- class pydrake.multibody.tree.RotationalInertia_[AutoDiffXd]
This class describes the mass distribution (inertia properties) of a body or composite body about a particular point. Herein, “composite body” means one body or a collection of bodies that are welded together. In this documentation, “body” and “composite body” are used interchangeably.
A rigid body’s mass distribution is described by three quantities: the body’s mass; the body’s center of mass; and the body’s rotational inertia about a particular point. The term rotational inertia is used here and by [Jain 2010] to distinguish from a body’s spatial inertia. In this class, a 3x3 inertia matrix I represents a body’s rotational inertia about a point and expressed in a frame. More specifically,
I_BP_E
is the inertia matrix of a body B about-point P and expressed-in frame E (herein frame E’s orthogonal unit vectors Ex, Ey, Ez are denoted 𝐱̂, 𝐲̂, 𝐳̂).Click to expand C++ code...
| Ixx Ixy Ixz | I = | Ixy Iyy Iyz | | Ixz Iyz Izz |
The moments of inertia Ixx, Iyy, Izz and products of inertia Ixy, Ixz, Iyz are defined in terms of the mass dm of a differential volume of the body. The position of dm from about-point P is xx̂ + yŷ + zẑ = [x, y, z]_E.
Click to expand C++ code...
Ixx = ∫ (y² + z²) dm Iyy = ∫ (x² + z²) dm Izz = ∫ (x² + y²) dm Ixy = - ∫ x y dm Ixz = - ∫ x z dm Iyz = - ∫ y z dm
We use the negated convention for products of inertia, so that I serves to relate angular velocity ω and angular momentum h via
h = I ⋅ ω
. Ensure your products of inertia follow this negative sign convention.The 3x3 inertia matrix is symmetric and its diagonal elements (moments of inertia) and off-diagonal elements (products of inertia) are associated with a body (or composite body) S, an about-point P, and an expressed-in frame E (𝐱̂, 𝐲̂, 𝐳̂̂). A rotational inertia is ill-defined unless there is a body S, about-point P, and expressed-in frame E. The user of this class is responsible for tracking the body S, about-point P and expressed-in frame E (none of these are stored in this class).
Note
This class does not store the about-point nor the expressed-in frame, nor does this class help enforce consistency of the about-point or expressed-in frame. To help users of this class track the about-point and expressed-in frame, we strongly recommend the following notation.
Note
In typeset material, use the symbol \([I^{S/P}]_E\) to represent the rotational inertia (inertia matrix) of a body (or composite body) S about-point P, expressed in frame E. In code and comments, use the monogram notation
I_SP_E
(e.g., as described in multibody_spatial_inertia). If the about-point P is fixed to a body B, the point is named \(B_P\) and this appears in code/comments asBp
. Examples:I_BBp_E
is rigid body B’s rotational inertia about-point Bp expressed-in frame E; I_BBo_E is B’s rotational inertia about-pointBo
(body B’s origin) expressed-in frame E; and I_BBcm_E is B’s inertia matrix about-pointBcm
(B’s center of mass) expressed-in frame E.Note
The rotational inertia (inertia matrix) can be re-expressed in terms of a special frame whose orthogonal unit vectors are parallel to principal axes of inertia so that the inertia matrix is diagonalized with elements called principal moments of inertia.
Note
The formal definition of the inertia matrix \(I^{S/P}\) of a system S about a point P follows the definition of the inertia dyadic 𝐈 of S about P, which begins by modeling S with n particles S₁ … Sₙ (e.g., 12 grams of carbon can be modeled with n = 6.02 * 10²³ molecules/particles). The inertia dyadic 𝐈₁ of one particle S₁ about point P is defined [Kane, 1985] in terms of m₁ (mass of S₁), ᴾ𝐩ˢ¹ (position vector from P to S₁), and the unit dyadic 𝐔 which is defined by the property 𝐔 ⋅ 𝐯 = 𝐯 where 𝐯 is is any vector (this definition of 𝐔 is analogous to defining the identity matrix by the property 𝑰𝒅𝒆𝒏𝒕𝒊𝒕𝒚𝑴𝒂𝒕𝒓𝒊𝒙 * 𝒂𝒏𝒚𝑴𝒂𝒕𝒓𝒊𝒙 = 𝒂𝒏𝒚𝑴𝒂𝒕𝒓𝒊𝒙).
Click to expand C++ code...
𝐈₁ = m₁ * [𝐔 * (ᴾ𝐩ˢ¹ ⋅ ᴾ𝐩ˢ¹) - ᴾ𝐩ˢ¹ * ᴾ𝐩ˢ¹]
Note: The vector dot-product (⋅) above produces a scalar whereas the vector multiply (*) produces a dyadic which is a 2nd-order tensor (ᴾ𝐩ˢ¹ * ᴾ𝐩ˢ¹ is similar to the matrix outer-product of a 3x1 matrix multiplied by a 1x3 matrix). An example inertia dyadic for a single particle is shown further below. The inertia dyadic 𝐈 of the entire system S is defined by summing the inertia dyadic of each particle Sᵢ about P (i = 1, … n), i.e.,
Click to expand C++ code...
𝐈 = 𝐈₁ + 𝐈₂ + ... 𝐈ₙ
The elements of the inertia matrix \([I^{S/P}]_E\) expressed in frame E (in terms of orthogonal unit vectors 𝐱̂, 𝐲̂, 𝐳̂̂) are found by pre-dot multiplying and post-dot multiplying 𝐈 with appropriate unit vectors.
Click to expand C++ code...
Ixx = 𝐱̂ ⋅ 𝐈 ⋅ 𝐱̂ Ixy = 𝐱̂ ⋅ 𝐈 ⋅ 𝐲̂ Ixz = 𝐱̂ ⋅ 𝐈 ⋅ 𝐳̂̂ Iyx = 𝐲̂ ⋅ 𝐈 ⋅ 𝐱̂ Iyy = 𝐲̂ ⋅ 𝐈 ⋅ 𝐲̂ Iyz = 𝐲̂ ⋅ 𝐈 ⋅ 𝐳̂̂ Izx = 𝐳̂̂ ⋅ 𝐈 ⋅ 𝐱̂ Izy = 𝐳̂̂ ⋅ 𝐈 ⋅ 𝐲̂ Izz = 𝐳̂̂ ⋅ 𝐈 ⋅ 𝐳̂̂
The inertia dyadic 𝐈ᴮ of a rigid body B about Bcm (B’s center of mass) is related to various dynamic quantities. For example, B’s angular momentum 𝐇 about Bcm in a frame N and B’s kinetic energy KE in N relate to 𝐈ᴮ by
Click to expand C++ code...
𝐇 = 𝐈ᴮ ⋅ 𝛚 KE = 1/2 𝛚 ⋅ 𝐈ᴮ ⋅ 𝛚 + 1/2 mᴮ 𝐯 ⋅ 𝐯
where 𝛚 is B’s angular velocity in N, 𝐯 is Bcm’s translational velocity in N, and mᴮ is B’s mass. When frame N happens to be a Newtonian frame (also called an inertial frame or non-rotating/non-accelerating frame), the moment 𝐓 of all forces on B about Bcm relates to 𝐈ᴮ and 𝛂 (B’s angular acceleration in N) by Euler’s rigid body equation as
Click to expand C++ code...
𝐓 = 𝐈ᴮ ⋅ 𝛂 + 𝛚 × 𝐈ᴮ ⋅ 𝛚
Example: For a particle Q of mass m whose position vector from a point O is written in terms of right-handed orthogonal unit vectors 𝐱̂, 𝐲̂, 𝐳̂ (below), the inertia dyadic 𝐈 of particle Q about point O is defined and calculated
Click to expand C++ code...
𝐩 = x 𝐱̂ + y 𝐲̂ (given) 𝐈 = m * [𝐔 * (𝐩 ⋅ 𝐩) - 𝐩 * 𝐩] (definition) = m * [𝐔 * (x² + y²) - (x𝐱̂ + y𝐲̂̂) * (x𝐱̂ + y𝐲̂) = m * [(𝐱̂𝐱̂ + 𝐲̂𝐲̂ + 𝐳̂𝐳̂) * (x² + y²) - (x²𝐱̂𝐱̂ + xy𝐱̂𝐲̂̂ + xy𝐲̂̂𝐱̂ + y²𝐲̂̂𝐲̂̂)] = m * [y²𝐱̂𝐱̂ + x²𝐲̂𝐲̂ + (x² + y²)𝐳̂𝐳̂ - xy𝐱̂𝐲̂̂ - xy𝐲̂̂𝐱̂]
which means the inertia matrix for particle Q about point O for 𝐱̂, 𝐲̂, 𝐳̂ is
Click to expand C++ code...
| m y² -m x y 0 | I = | -m x y m x² 0 | | 0 0 m (x² + y²) |
[Kane, 1985] pg. 68. “Dynamics: Theory and Applications,” McGraw-Hill Co., New York, 1985 (with D. A. Levinson). Available for free .pdf download: https://ecommons.cornell.edu/handle/1813/637
Note
Several methods in this class throw a RuntimeError for invalid rotational inertia operations in debug releases only. This provides speed in a release build while facilitating debugging in debug builds. In addition, these validity tests are only performed for scalar types for which drake::scalar_predicate<T>::is_bool is
True
. For instance, validity checks are not performed when T is symbolic::Expression.Note
The methods of this class satisfy the “basic exception guarantee”: if an exception is thrown, the program will still be in a valid state. Specifically, no resources are leaked, and all objects’ invariants are intact. Be aware that RotationalInertia objects may contain invalid inertia data in cases where input checking is skipped.
Various methods in this class require numerical (not symbolic) data types.
- __init__(*args, **kwargs)
Overloaded function.
__init__(self: pydrake.multibody.tree.RotationalInertia_[AutoDiffXd]) -> None
Constructs a rotational inertia that has all its moments/products of inertia equal to NaN (helps quickly detect uninitialized values).
__init__(self: pydrake.multibody.tree.RotationalInertia_[AutoDiffXd], Ixx: pydrake.autodiffutils.AutoDiffXd, Iyy: pydrake.autodiffutils.AutoDiffXd, Izz: pydrake.autodiffutils.AutoDiffXd) -> None
Creates a rotational inertia with moments of inertia
Ixx
, Iyy,Izz
, and with each product of inertia set to zero.- Raises
RuntimeError for Debug builds if not CouldBePhysicallyValid() –
__init__(self: pydrake.multibody.tree.RotationalInertia_[AutoDiffXd], Ixx: pydrake.autodiffutils.AutoDiffXd, Iyy: pydrake.autodiffutils.AutoDiffXd, Izz: pydrake.autodiffutils.AutoDiffXd, Ixy: pydrake.autodiffutils.AutoDiffXd, Ixz: pydrake.autodiffutils.AutoDiffXd, Iyz: pydrake.autodiffutils.AutoDiffXd) -> None
Creates a rotational inertia with moments of inertia
Ixx
, Iyy,Izz
, and with products of inertiaIxy
, Ixz,Iyz
.- Raises
RuntimeError for Debug builds if not CouldBePhysicallyValid() –
__init__(self: pydrake.multibody.tree.RotationalInertia_[AutoDiffXd], mass: pydrake.autodiffutils.AutoDiffXd, p_PQ_E: numpy.ndarray[object[3, 1]]) -> None
Constructs a rotational inertia for a particle Q of mass
mass
, whose position vector from about-point P is p_PQ_E (E is expressed-in frame). This RuntimeError exception only occurs ifmass
< 0.- Parameter
mass
: The mass of particle Q.
- Parameter
p_PQ_E
: Position from about-point P to Q, expressed-in frame E.
- Returns
I_QP_E
: , Q’s rotational inertia about-point P expressed-in frame E.
- Remark:
Negating the position vector p_PQ_E has no affect on the result.
- Raises
RuntimeError for Debug builds if not CouldBePhysicallyValid() –
- CalcMaximumPossibleMomentOfInertia(self: pydrake.multibody.tree.RotationalInertia_[AutoDiffXd]) pydrake.autodiffutils.AutoDiffXd
Returns the maximum possible moment of inertia for
this
rotational inertia about-point P for any expressed-in frame E.- Remark:
The maximum moment Imax has range: trace / 3 <= Imax <= trace / 2.
See also
Trace()
- CalcPrincipalMomentsAndAxesOfInertia(self: pydrake.multibody.tree.RotationalInertia_[AutoDiffXd]) tuple[numpy.ndarray[numpy.float64[3, 1]], pydrake.math.RotationMatrix]
Forms the 3 principal moments of inertia and their 3 associated principal directions for
this
rotational inertia.- Returns
3 principal moments of inertia [Ixx Iyy Izz], sorted in ascending order (Ixx ≤ Iyy ≤ Izz) and a rotation matrix R_EA whose columns are the 3 associated principal directions that relate the expressed-in frame E to a frame A, where frame E is the expressed-in frame for
this
rotational inertia I_BP_E (body B’s rotational inertia about-point P) and frame A contains right-handed orthonormal vectors Ax, Ay, Az. The 1ˢᵗ column of R_EA is Ax_E (Ax expressed in frame E) which is parallel to the principal axis associated with Ixx (the smallest principal moment of inertia). Similarly, the 2ⁿᵈ and 3ʳᵈ columns of R_EA are Ay_E and Az_E, which are parallel to principal axes associated with Iyy and Izz (the intermediate and largest principal moments of inertia). If all principal moments of inertia are equal (i.e., Ixx = Iyy = Izz), R_EA is the identity matrix.- Raises
RuntimeError if the elements of this rotational inertia cannot –
be converted to a real finite double. For example, an exception is –
thrown if this contains an erroneous NaN or if scalar type T –
is symbolic. –
See also
CalcPrincipalMomentsOfInertia() to calculate the principal moments of inertia [Ixx Iyy Izz], without calculating the principal directions.
- CalcPrincipalMomentsOfInertia(self: pydrake.multibody.tree.RotationalInertia_[AutoDiffXd]) numpy.ndarray[numpy.float64[3, 1]]
Forms the 3 principal moments of inertia for
this
rotational inertia.- Returns
The
: 3 principal moments of inertia [Imin Imed Imax], sorted in ascending order (Imin ≤ Imed ≤ Imax).
- Raises
RuntimeError if the elements of this rotational inertia cannot –
be converted to a real finite double. For example, an exception is –
thrown if this contains an erroneous NaN or if scalar type T –
is symbolic. –
See also
CalcPrincipalMomentsAndAxesOfInertia() to also calculate principal moment of inertia directions associated with
this
rotational inertia.- Returns
- cols(self: pydrake.multibody.tree.RotationalInertia_[AutoDiffXd]) int
For consistency with Eigen’s API, the cols() method returns 3.
- CopyToFullMatrix3(self: pydrake.multibody.tree.RotationalInertia_[AutoDiffXd]) numpy.ndarray[object[3, 3]]
Gets a full 3x3 matrix copy of this rotational inertia. The returned copy is symmetric and includes both lower and upper parts of the matrix.
- CouldBePhysicallyValid(self: pydrake.multibody.tree.RotationalInertia_[AutoDiffXd]) bool
Performs several necessary checks to verify whether
this
rotational inertia could be physically valid, including:No NaN moments or products of inertia.
Ixx, Iyy, Izz and principal moments are all non-negative.
Ixx, Iyy Izz and principal moments satisfy the triangle inequality: -
Ixx + Iyy >= Izz
- Ixx + Izz >= Iyy -Iyy + Izz >= Ixx
Warning
These checks are necessary (but NOT sufficient) conditions for a rotational inertia to be physically valid. The sufficient condition requires a rotational inertia to satisfy the above checks after
this
is shifted to the center of mass, i.e., the sufficient condition requires calling CouldBePhysicallyValid() when the about-point is Bcm (the body’s center of mass). Note: this class does not know its about-point or its center of mass location.- Returns
True
for a plausible rotational inertia passing the above necessary but insufficient checks andFalse
otherwise.- Raises
RuntimeError if principal moments of inertia cannot be calculated –
(eigenvalue solver) or if scalar type T cannot be converted to a –
double. –
- get_moments(self: pydrake.multibody.tree.RotationalInertia_[AutoDiffXd]) numpy.ndarray[object[3, 1]]
Returns 3-element vector with moments of inertia [Ixx, Iyy, Izz].
- get_products(self: pydrake.multibody.tree.RotationalInertia_[AutoDiffXd]) numpy.ndarray[object[3, 1]]
Returns 3-element vector with products of inertia [Ixy, Ixz, Iyz].
- IsNaN(self: pydrake.multibody.tree.RotationalInertia_[AutoDiffXd]) bool
Returns
True
if any moment/product inthis
rotational inertia is NaN. Otherwise returnsFalse
.
- IsNearlyEqualTo(self: pydrake.multibody.tree.RotationalInertia_[AutoDiffXd], other: pydrake.multibody.tree.RotationalInertia_[AutoDiffXd], precision: float) bool
Compares
this
rotational inertia toother
rotational inertia within the specifiedprecision
(which is a dimensionless number specifying the relative precision to which the comparison is performed). DenotingI_maxA
as the largest element value that can appear in a validthis
rotational inertia (independent of the expressed-in frame E) and denotingI_maxB
as the largest element value that can appear in a validother
rotational inertia (independent of the expressed-in frame E),this
andother
are considered nearly equal to each other, if: ‖this - other‖∞ < precision * min(I_maxA, I_maxB)- Parameter
other
: Rotational inertia to compare with
this
rotational inertia.- Parameter
precision
: is a dimensionless real positive number that is usually based on two factors, namely expected accuracy of moments/products of inertia (e.g., from end-user or CAD) and/or machine-precision.
- Returns
True
if the absolute value of each moment/product of inertia inthis
is withinepsilon
of the corresponding moment/ product absolute value inother
. Otherwise returnsFalse
.
Note
: This method only works if all moments of inertia with scalar type T in
this
andother
can be converted to a double (discarding supplemental scalar data such as derivatives of an AutoDiffXd). It fails at runtime if type T cannot be converted todouble
.- Parameter
- IsZero(self: pydrake.multibody.tree.RotationalInertia_[AutoDiffXd]) bool
Returns
True
if all moments and products of inertia are exactly zero.
- ReExpress(self: pydrake.multibody.tree.RotationalInertia_[AutoDiffXd], R_AE: pydrake.math.RotationMatrix_[AutoDiffXd]) pydrake.multibody.tree.RotationalInertia_[AutoDiffXd]
Re-expresses
this
rotational inertiaI_BP_E
toI_BP_A
i.e., re-expresses body B’s rotational inertia from frame E to frame A.- Parameter
R_AE
: RotationMatrix relating frames A and E.
- Returns
I_BP_A
: Rotational inertia of B about-point P expressed-in frame A.
- Raises
RuntimeError for Debug builds if the rotational inertia that is –
re-expressed-in frame A violates CouldBePhysicallyValid() –
See also
ReExpressInPlace()
- Parameter
- rows(self: pydrake.multibody.tree.RotationalInertia_[AutoDiffXd]) int
For consistency with Eigen’s API, the rows() method returns 3.
- SetToNaN(self: pydrake.multibody.tree.RotationalInertia_[AutoDiffXd]) None
Sets
this
rotational inertia so all its elements are equal to NaN. This helps quickly detect uninitialized moments/products of inertia.
- SetZero(self: pydrake.multibody.tree.RotationalInertia_[AutoDiffXd]) None
Sets
this
rotational inertia so all its moments/products of inertia are zero, e.g., for convenient initialization before a computation or for inertia calculations involving a particle (point-mass). Note: Real 3D massive physical objects have non-zero moments of inertia.
- ShiftFromCenterOfMass(self: pydrake.multibody.tree.RotationalInertia_[AutoDiffXd], mass: pydrake.autodiffutils.AutoDiffXd, p_BcmQ_E: numpy.ndarray[object[3, 1]]) pydrake.multibody.tree.RotationalInertia_[AutoDiffXd]
Calculates the rotational inertia that results from shifting
this
rotational inertia for a body (or composite body) B from about-point Bcm (B’s center of mass) to about-point Q. I.e., shiftsI_BBcm_E
toI_BQ_E
(both are expressed-in frame E).- Parameter
mass
: The mass of body (or composite body) B.
- Parameter
p_BcmQ_E
: Position vector from Bcm to Q, expressed-in frame E.
- Returns
I_BQ_E
: B’s rotational inertia about-point Q expressed-in frame E.
- Raises
RuntimeError for Debug builds if the rotational inertia that is –
shifted to about-point Q violates CouldBePhysicallyValid() –
- Remark:
Negating the position vector p_BcmQ_E has no affect on the result.
- Parameter
- ShiftToCenterOfMass(self: pydrake.multibody.tree.RotationalInertia_[AutoDiffXd], mass: pydrake.autodiffutils.AutoDiffXd, p_QBcm_E: numpy.ndarray[object[3, 1]]) pydrake.multibody.tree.RotationalInertia_[AutoDiffXd]
Calculates the rotational inertia that results from shifting
this
rotational inertia for a body (or composite body) B from about-point Q to about-pointBcm
(B’s center of mass). I.e., shiftsI_BQ_E
toI_BBcm_E
(both are expressed-in frame E).- Parameter
mass
: The mass of body (or composite body) B.
- Parameter
p_QBcm_E
: Position vector from Q to
Bcm
, expressed-in frame E.- Returns
I_BBcm_E
: B’s rotational inertia about-point
Bcm
expressed-in frame E.
- Raises
RuntimeError for Debug builds if the rotational inertia that is –
shifted to about-point Bcm violates CouldBePhysicallyValid() –
- Remark:
Negating the position vector
p_QBcm_E
has no affect on the result.
- Parameter
- ShiftToThenAwayFromCenterOfMass(self: pydrake.multibody.tree.RotationalInertia_[AutoDiffXd], mass: pydrake.autodiffutils.AutoDiffXd, p_PBcm_E: numpy.ndarray[object[3, 1]], p_QBcm_E: numpy.ndarray[object[3, 1]]) pydrake.multibody.tree.RotationalInertia_[AutoDiffXd]
Calculates the rotational inertia that results from shifting
this
rotational inertia for a body (or composite body) B from about-point P to about-point Q via Bcm (B’s center of mass). I.e., shiftsI_BP_E
toI_BQ_E
(both are expressed-in frame E).- Parameter
mass
: The mass of body (or composite body) B.
- Parameter
p_PBcm_E
: Position vector from P to Bcm, expressed-in frame E.
- Parameter
p_QBcm_E
: Position vector from Q to Bcm, expressed-in frame E.
- Returns
I_BQ_E
: , B’s rotational inertia about-point Q expressed-in frame E.
- Raises
RuntimeError for Debug builds if the rotational inertia that is –
shifted to about-point Q violates CouldBePhysicallyValid() –
- Remark:
Negating either (or both) position vectors p_PBcm_E and p_QBcm_E has no affect on the result.
- Parameter
- Trace(self: pydrake.multibody.tree.RotationalInertia_[AutoDiffXd]) pydrake.autodiffutils.AutoDiffXd
Returns a rotational inertia’s trace (i.e., Ixx + Iyy + Izz, the sum of the diagonal elements of the inertia matrix). The trace happens to be invariant to its expressed-in frame (i.e., the trace does not depend on the frame in which it is expressed). The trace is useful because the largest moment of inertia Imax has range: trace / 3 <= Imax <= trace / 2, and the largest possible product of inertia must be <= Imax / 2. Hence, trace / 3 and trace / 2 give a lower and upper bound on the largest possible element that can be in a valid rotational inertia.
- static TriaxiallySymmetric(I_triaxial: pydrake.autodiffutils.AutoDiffXd) pydrake.multibody.tree.RotationalInertia_[AutoDiffXd]
- class pydrake.multibody.tree.RotationalInertia_[Expression]
This class describes the mass distribution (inertia properties) of a body or composite body about a particular point. Herein, “composite body” means one body or a collection of bodies that are welded together. In this documentation, “body” and “composite body” are used interchangeably.
A rigid body’s mass distribution is described by three quantities: the body’s mass; the body’s center of mass; and the body’s rotational inertia about a particular point. The term rotational inertia is used here and by [Jain 2010] to distinguish from a body’s spatial inertia. In this class, a 3x3 inertia matrix I represents a body’s rotational inertia about a point and expressed in a frame. More specifically,
I_BP_E
is the inertia matrix of a body B about-point P and expressed-in frame E (herein frame E’s orthogonal unit vectors Ex, Ey, Ez are denoted 𝐱̂, 𝐲̂, 𝐳̂).Click to expand C++ code...
| Ixx Ixy Ixz | I = | Ixy Iyy Iyz | | Ixz Iyz Izz |
The moments of inertia Ixx, Iyy, Izz and products of inertia Ixy, Ixz, Iyz are defined in terms of the mass dm of a differential volume of the body. The position of dm from about-point P is xx̂ + yŷ + zẑ = [x, y, z]_E.
Click to expand C++ code...
Ixx = ∫ (y² + z²) dm Iyy = ∫ (x² + z²) dm Izz = ∫ (x² + y²) dm Ixy = - ∫ x y dm Ixz = - ∫ x z dm Iyz = - ∫ y z dm
We use the negated convention for products of inertia, so that I serves to relate angular velocity ω and angular momentum h via
h = I ⋅ ω
. Ensure your products of inertia follow this negative sign convention.The 3x3 inertia matrix is symmetric and its diagonal elements (moments of inertia) and off-diagonal elements (products of inertia) are associated with a body (or composite body) S, an about-point P, and an expressed-in frame E (𝐱̂, 𝐲̂, 𝐳̂̂). A rotational inertia is ill-defined unless there is a body S, about-point P, and expressed-in frame E. The user of this class is responsible for tracking the body S, about-point P and expressed-in frame E (none of these are stored in this class).
Note
This class does not store the about-point nor the expressed-in frame, nor does this class help enforce consistency of the about-point or expressed-in frame. To help users of this class track the about-point and expressed-in frame, we strongly recommend the following notation.
Note
In typeset material, use the symbol \([I^{S/P}]_E\) to represent the rotational inertia (inertia matrix) of a body (or composite body) S about-point P, expressed in frame E. In code and comments, use the monogram notation
I_SP_E
(e.g., as described in multibody_spatial_inertia). If the about-point P is fixed to a body B, the point is named \(B_P\) and this appears in code/comments asBp
. Examples:I_BBp_E
is rigid body B’s rotational inertia about-point Bp expressed-in frame E; I_BBo_E is B’s rotational inertia about-pointBo
(body B’s origin) expressed-in frame E; and I_BBcm_E is B’s inertia matrix about-pointBcm
(B’s center of mass) expressed-in frame E.Note
The rotational inertia (inertia matrix) can be re-expressed in terms of a special frame whose orthogonal unit vectors are parallel to principal axes of inertia so that the inertia matrix is diagonalized with elements called principal moments of inertia.
Note
The formal definition of the inertia matrix \(I^{S/P}\) of a system S about a point P follows the definition of the inertia dyadic 𝐈 of S about P, which begins by modeling S with n particles S₁ … Sₙ (e.g., 12 grams of carbon can be modeled with n = 6.02 * 10²³ molecules/particles). The inertia dyadic 𝐈₁ of one particle S₁ about point P is defined [Kane, 1985] in terms of m₁ (mass of S₁), ᴾ𝐩ˢ¹ (position vector from P to S₁), and the unit dyadic 𝐔 which is defined by the property 𝐔 ⋅ 𝐯 = 𝐯 where 𝐯 is is any vector (this definition of 𝐔 is analogous to defining the identity matrix by the property 𝑰𝒅𝒆𝒏𝒕𝒊𝒕𝒚𝑴𝒂𝒕𝒓𝒊𝒙 * 𝒂𝒏𝒚𝑴𝒂𝒕𝒓𝒊𝒙 = 𝒂𝒏𝒚𝑴𝒂𝒕𝒓𝒊𝒙).
Click to expand C++ code...
𝐈₁ = m₁ * [𝐔 * (ᴾ𝐩ˢ¹ ⋅ ᴾ𝐩ˢ¹) - ᴾ𝐩ˢ¹ * ᴾ𝐩ˢ¹]
Note: The vector dot-product (⋅) above produces a scalar whereas the vector multiply (*) produces a dyadic which is a 2nd-order tensor (ᴾ𝐩ˢ¹ * ᴾ𝐩ˢ¹ is similar to the matrix outer-product of a 3x1 matrix multiplied by a 1x3 matrix). An example inertia dyadic for a single particle is shown further below. The inertia dyadic 𝐈 of the entire system S is defined by summing the inertia dyadic of each particle Sᵢ about P (i = 1, … n), i.e.,
Click to expand C++ code...
𝐈 = 𝐈₁ + 𝐈₂ + ... 𝐈ₙ
The elements of the inertia matrix \([I^{S/P}]_E\) expressed in frame E (in terms of orthogonal unit vectors 𝐱̂, 𝐲̂, 𝐳̂̂) are found by pre-dot multiplying and post-dot multiplying 𝐈 with appropriate unit vectors.
Click to expand C++ code...
Ixx = 𝐱̂ ⋅ 𝐈 ⋅ 𝐱̂ Ixy = 𝐱̂ ⋅ 𝐈 ⋅ 𝐲̂ Ixz = 𝐱̂ ⋅ 𝐈 ⋅ 𝐳̂̂ Iyx = 𝐲̂ ⋅ 𝐈 ⋅ 𝐱̂ Iyy = 𝐲̂ ⋅ 𝐈 ⋅ 𝐲̂ Iyz = 𝐲̂ ⋅ 𝐈 ⋅ 𝐳̂̂ Izx = 𝐳̂̂ ⋅ 𝐈 ⋅ 𝐱̂ Izy = 𝐳̂̂ ⋅ 𝐈 ⋅ 𝐲̂ Izz = 𝐳̂̂ ⋅ 𝐈 ⋅ 𝐳̂̂
The inertia dyadic 𝐈ᴮ of a rigid body B about Bcm (B’s center of mass) is related to various dynamic quantities. For example, B’s angular momentum 𝐇 about Bcm in a frame N and B’s kinetic energy KE in N relate to 𝐈ᴮ by
Click to expand C++ code...
𝐇 = 𝐈ᴮ ⋅ 𝛚 KE = 1/2 𝛚 ⋅ 𝐈ᴮ ⋅ 𝛚 + 1/2 mᴮ 𝐯 ⋅ 𝐯
where 𝛚 is B’s angular velocity in N, 𝐯 is Bcm’s translational velocity in N, and mᴮ is B’s mass. When frame N happens to be a Newtonian frame (also called an inertial frame or non-rotating/non-accelerating frame), the moment 𝐓 of all forces on B about Bcm relates to 𝐈ᴮ and 𝛂 (B’s angular acceleration in N) by Euler’s rigid body equation as
Click to expand C++ code...
𝐓 = 𝐈ᴮ ⋅ 𝛂 + 𝛚 × 𝐈ᴮ ⋅ 𝛚
Example: For a particle Q of mass m whose position vector from a point O is written in terms of right-handed orthogonal unit vectors 𝐱̂, 𝐲̂, 𝐳̂ (below), the inertia dyadic 𝐈 of particle Q about point O is defined and calculated
Click to expand C++ code...
𝐩 = x 𝐱̂ + y 𝐲̂ (given) 𝐈 = m * [𝐔 * (𝐩 ⋅ 𝐩) - 𝐩 * 𝐩] (definition) = m * [𝐔 * (x² + y²) - (x𝐱̂ + y𝐲̂̂) * (x𝐱̂ + y𝐲̂) = m * [(𝐱̂𝐱̂ + 𝐲̂𝐲̂ + 𝐳̂𝐳̂) * (x² + y²) - (x²𝐱̂𝐱̂ + xy𝐱̂𝐲̂̂ + xy𝐲̂̂𝐱̂ + y²𝐲̂̂𝐲̂̂)] = m * [y²𝐱̂𝐱̂ + x²𝐲̂𝐲̂ + (x² + y²)𝐳̂𝐳̂ - xy𝐱̂𝐲̂̂ - xy𝐲̂̂𝐱̂]
which means the inertia matrix for particle Q about point O for 𝐱̂, 𝐲̂, 𝐳̂ is
Click to expand C++ code...
| m y² -m x y 0 | I = | -m x y m x² 0 | | 0 0 m (x² + y²) |
[Kane, 1985] pg. 68. “Dynamics: Theory and Applications,” McGraw-Hill Co., New York, 1985 (with D. A. Levinson). Available for free .pdf download: https://ecommons.cornell.edu/handle/1813/637
Note
Several methods in this class throw a RuntimeError for invalid rotational inertia operations in debug releases only. This provides speed in a release build while facilitating debugging in debug builds. In addition, these validity tests are only performed for scalar types for which drake::scalar_predicate<T>::is_bool is
True
. For instance, validity checks are not performed when T is symbolic::Expression.Note
The methods of this class satisfy the “basic exception guarantee”: if an exception is thrown, the program will still be in a valid state. Specifically, no resources are leaked, and all objects’ invariants are intact. Be aware that RotationalInertia objects may contain invalid inertia data in cases where input checking is skipped.
Various methods in this class require numerical (not symbolic) data types.
- __init__(*args, **kwargs)
Overloaded function.
__init__(self: pydrake.multibody.tree.RotationalInertia_[Expression]) -> None
Constructs a rotational inertia that has all its moments/products of inertia equal to NaN (helps quickly detect uninitialized values).
__init__(self: pydrake.multibody.tree.RotationalInertia_[Expression], Ixx: pydrake.symbolic.Expression, Iyy: pydrake.symbolic.Expression, Izz: pydrake.symbolic.Expression) -> None
Creates a rotational inertia with moments of inertia
Ixx
, Iyy,Izz
, and with each product of inertia set to zero.- Raises
RuntimeError for Debug builds if not CouldBePhysicallyValid() –
__init__(self: pydrake.multibody.tree.RotationalInertia_[Expression], Ixx: pydrake.symbolic.Expression, Iyy: pydrake.symbolic.Expression, Izz: pydrake.symbolic.Expression, Ixy: pydrake.symbolic.Expression, Ixz: pydrake.symbolic.Expression, Iyz: pydrake.symbolic.Expression) -> None
Creates a rotational inertia with moments of inertia
Ixx
, Iyy,Izz
, and with products of inertiaIxy
, Ixz,Iyz
.- Raises
RuntimeError for Debug builds if not CouldBePhysicallyValid() –
__init__(self: pydrake.multibody.tree.RotationalInertia_[Expression], mass: pydrake.symbolic.Expression, p_PQ_E: numpy.ndarray[object[3, 1]]) -> None
Constructs a rotational inertia for a particle Q of mass
mass
, whose position vector from about-point P is p_PQ_E (E is expressed-in frame). This RuntimeError exception only occurs ifmass
< 0.- Parameter
mass
: The mass of particle Q.
- Parameter
p_PQ_E
: Position from about-point P to Q, expressed-in frame E.
- Returns
I_QP_E
: , Q’s rotational inertia about-point P expressed-in frame E.
- Remark:
Negating the position vector p_PQ_E has no affect on the result.
- Raises
RuntimeError for Debug builds if not CouldBePhysicallyValid() –
- CalcMaximumPossibleMomentOfInertia(self: pydrake.multibody.tree.RotationalInertia_[Expression]) pydrake.symbolic.Expression
Returns the maximum possible moment of inertia for
this
rotational inertia about-point P for any expressed-in frame E.- Remark:
The maximum moment Imax has range: trace / 3 <= Imax <= trace / 2.
See also
Trace()
- CalcPrincipalMomentsAndAxesOfInertia(self: pydrake.multibody.tree.RotationalInertia_[Expression]) tuple[numpy.ndarray[numpy.float64[3, 1]], pydrake.math.RotationMatrix]
Forms the 3 principal moments of inertia and their 3 associated principal directions for
this
rotational inertia.- Returns
3 principal moments of inertia [Ixx Iyy Izz], sorted in ascending order (Ixx ≤ Iyy ≤ Izz) and a rotation matrix R_EA whose columns are the 3 associated principal directions that relate the expressed-in frame E to a frame A, where frame E is the expressed-in frame for
this
rotational inertia I_BP_E (body B’s rotational inertia about-point P) and frame A contains right-handed orthonormal vectors Ax, Ay, Az. The 1ˢᵗ column of R_EA is Ax_E (Ax expressed in frame E) which is parallel to the principal axis associated with Ixx (the smallest principal moment of inertia). Similarly, the 2ⁿᵈ and 3ʳᵈ columns of R_EA are Ay_E and Az_E, which are parallel to principal axes associated with Iyy and Izz (the intermediate and largest principal moments of inertia). If all principal moments of inertia are equal (i.e., Ixx = Iyy = Izz), R_EA is the identity matrix.- Raises
RuntimeError if the elements of this rotational inertia cannot –
be converted to a real finite double. For example, an exception is –
thrown if this contains an erroneous NaN or if scalar type T –
is symbolic. –
See also
CalcPrincipalMomentsOfInertia() to calculate the principal moments of inertia [Ixx Iyy Izz], without calculating the principal directions.
- CalcPrincipalMomentsOfInertia(self: pydrake.multibody.tree.RotationalInertia_[Expression]) numpy.ndarray[numpy.float64[3, 1]]
Forms the 3 principal moments of inertia for
this
rotational inertia.- Returns
The
: 3 principal moments of inertia [Imin Imed Imax], sorted in ascending order (Imin ≤ Imed ≤ Imax).
- Raises
RuntimeError if the elements of this rotational inertia cannot –
be converted to a real finite double. For example, an exception is –
thrown if this contains an erroneous NaN or if scalar type T –
is symbolic. –
See also
CalcPrincipalMomentsAndAxesOfInertia() to also calculate principal moment of inertia directions associated with
this
rotational inertia.- Returns
- cols(self: pydrake.multibody.tree.RotationalInertia_[Expression]) int
For consistency with Eigen’s API, the cols() method returns 3.
- CopyToFullMatrix3(self: pydrake.multibody.tree.RotationalInertia_[Expression]) numpy.ndarray[object[3, 3]]
Gets a full 3x3 matrix copy of this rotational inertia. The returned copy is symmetric and includes both lower and upper parts of the matrix.
- CouldBePhysicallyValid(self: pydrake.multibody.tree.RotationalInertia_[Expression]) pydrake.symbolic.Formula
Performs several necessary checks to verify whether
this
rotational inertia could be physically valid, including:No NaN moments or products of inertia.
Ixx, Iyy, Izz and principal moments are all non-negative.
Ixx, Iyy Izz and principal moments satisfy the triangle inequality: -
Ixx + Iyy >= Izz
- Ixx + Izz >= Iyy -Iyy + Izz >= Ixx
Warning
These checks are necessary (but NOT sufficient) conditions for a rotational inertia to be physically valid. The sufficient condition requires a rotational inertia to satisfy the above checks after
this
is shifted to the center of mass, i.e., the sufficient condition requires calling CouldBePhysicallyValid() when the about-point is Bcm (the body’s center of mass). Note: this class does not know its about-point or its center of mass location.- Returns
True
for a plausible rotational inertia passing the above necessary but insufficient checks andFalse
otherwise.- Raises
RuntimeError if principal moments of inertia cannot be calculated –
(eigenvalue solver) or if scalar type T cannot be converted to a –
double. –
- get_moments(self: pydrake.multibody.tree.RotationalInertia_[Expression]) numpy.ndarray[object[3, 1]]
Returns 3-element vector with moments of inertia [Ixx, Iyy, Izz].
- get_products(self: pydrake.multibody.tree.RotationalInertia_[Expression]) numpy.ndarray[object[3, 1]]
Returns 3-element vector with products of inertia [Ixy, Ixz, Iyz].
- IsNaN(self: pydrake.multibody.tree.RotationalInertia_[Expression]) pydrake.symbolic.Formula
Returns
True
if any moment/product inthis
rotational inertia is NaN. Otherwise returnsFalse
.
- IsNearlyEqualTo(self: pydrake.multibody.tree.RotationalInertia_[Expression], other: pydrake.multibody.tree.RotationalInertia_[Expression], precision: float) pydrake.symbolic.Formula
Compares
this
rotational inertia toother
rotational inertia within the specifiedprecision
(which is a dimensionless number specifying the relative precision to which the comparison is performed). DenotingI_maxA
as the largest element value that can appear in a validthis
rotational inertia (independent of the expressed-in frame E) and denotingI_maxB
as the largest element value that can appear in a validother
rotational inertia (independent of the expressed-in frame E),this
andother
are considered nearly equal to each other, if: ‖this - other‖∞ < precision * min(I_maxA, I_maxB)- Parameter
other
: Rotational inertia to compare with
this
rotational inertia.- Parameter
precision
: is a dimensionless real positive number that is usually based on two factors, namely expected accuracy of moments/products of inertia (e.g., from end-user or CAD) and/or machine-precision.
- Returns
True
if the absolute value of each moment/product of inertia inthis
is withinepsilon
of the corresponding moment/ product absolute value inother
. Otherwise returnsFalse
.
Note
: This method only works if all moments of inertia with scalar type T in
this
andother
can be converted to a double (discarding supplemental scalar data such as derivatives of an AutoDiffXd). It fails at runtime if type T cannot be converted todouble
.- Parameter
- IsZero(self: pydrake.multibody.tree.RotationalInertia_[Expression]) pydrake.symbolic.Formula
Returns
True
if all moments and products of inertia are exactly zero.
- ReExpress(self: pydrake.multibody.tree.RotationalInertia_[Expression], R_AE: pydrake.math.RotationMatrix_[Expression]) pydrake.multibody.tree.RotationalInertia_[Expression]
Re-expresses
this
rotational inertiaI_BP_E
toI_BP_A
i.e., re-expresses body B’s rotational inertia from frame E to frame A.- Parameter
R_AE
: RotationMatrix relating frames A and E.
- Returns
I_BP_A
: Rotational inertia of B about-point P expressed-in frame A.
- Raises
RuntimeError for Debug builds if the rotational inertia that is –
re-expressed-in frame A violates CouldBePhysicallyValid() –
See also
ReExpressInPlace()
- Parameter
- rows(self: pydrake.multibody.tree.RotationalInertia_[Expression]) int
For consistency with Eigen’s API, the rows() method returns 3.
- SetToNaN(self: pydrake.multibody.tree.RotationalInertia_[Expression]) None
Sets
this
rotational inertia so all its elements are equal to NaN. This helps quickly detect uninitialized moments/products of inertia.
- SetZero(self: pydrake.multibody.tree.RotationalInertia_[Expression]) None
Sets
this
rotational inertia so all its moments/products of inertia are zero, e.g., for convenient initialization before a computation or for inertia calculations involving a particle (point-mass). Note: Real 3D massive physical objects have non-zero moments of inertia.
- ShiftFromCenterOfMass(self: pydrake.multibody.tree.RotationalInertia_[Expression], mass: pydrake.symbolic.Expression, p_BcmQ_E: numpy.ndarray[object[3, 1]]) pydrake.multibody.tree.RotationalInertia_[Expression]
Calculates the rotational inertia that results from shifting
this
rotational inertia for a body (or composite body) B from about-point Bcm (B’s center of mass) to about-point Q. I.e., shiftsI_BBcm_E
toI_BQ_E
(both are expressed-in frame E).- Parameter
mass
: The mass of body (or composite body) B.
- Parameter
p_BcmQ_E
: Position vector from Bcm to Q, expressed-in frame E.
- Returns
I_BQ_E
: B’s rotational inertia about-point Q expressed-in frame E.
- Raises
RuntimeError for Debug builds if the rotational inertia that is –
shifted to about-point Q violates CouldBePhysicallyValid() –
- Remark:
Negating the position vector p_BcmQ_E has no affect on the result.
- Parameter
- ShiftToCenterOfMass(self: pydrake.multibody.tree.RotationalInertia_[Expression], mass: pydrake.symbolic.Expression, p_QBcm_E: numpy.ndarray[object[3, 1]]) pydrake.multibody.tree.RotationalInertia_[Expression]
Calculates the rotational inertia that results from shifting
this
rotational inertia for a body (or composite body) B from about-point Q to about-pointBcm
(B’s center of mass). I.e., shiftsI_BQ_E
toI_BBcm_E
(both are expressed-in frame E).- Parameter
mass
: The mass of body (or composite body) B.
- Parameter
p_QBcm_E
: Position vector from Q to
Bcm
, expressed-in frame E.- Returns
I_BBcm_E
: B’s rotational inertia about-point
Bcm
expressed-in frame E.
- Raises
RuntimeError for Debug builds if the rotational inertia that is –
shifted to about-point Bcm violates CouldBePhysicallyValid() –
- Remark:
Negating the position vector
p_QBcm_E
has no affect on the result.
- Parameter
- ShiftToThenAwayFromCenterOfMass(self: pydrake.multibody.tree.RotationalInertia_[Expression], mass: pydrake.symbolic.Expression, p_PBcm_E: numpy.ndarray[object[3, 1]], p_QBcm_E: numpy.ndarray[object[3, 1]]) pydrake.multibody.tree.RotationalInertia_[Expression]
Calculates the rotational inertia that results from shifting
this
rotational inertia for a body (or composite body) B from about-point P to about-point Q via Bcm (B’s center of mass). I.e., shiftsI_BP_E
toI_BQ_E
(both are expressed-in frame E).- Parameter
mass
: The mass of body (or composite body) B.
- Parameter
p_PBcm_E
: Position vector from P to Bcm, expressed-in frame E.
- Parameter
p_QBcm_E
: Position vector from Q to Bcm, expressed-in frame E.
- Returns
I_BQ_E
: , B’s rotational inertia about-point Q expressed-in frame E.
- Raises
RuntimeError for Debug builds if the rotational inertia that is –
shifted to about-point Q violates CouldBePhysicallyValid() –
- Remark:
Negating either (or both) position vectors p_PBcm_E and p_QBcm_E has no affect on the result.
- Parameter
- Trace(self: pydrake.multibody.tree.RotationalInertia_[Expression]) pydrake.symbolic.Expression
Returns a rotational inertia’s trace (i.e., Ixx + Iyy + Izz, the sum of the diagonal elements of the inertia matrix). The trace happens to be invariant to its expressed-in frame (i.e., the trace does not depend on the frame in which it is expressed). The trace is useful because the largest moment of inertia Imax has range: trace / 3 <= Imax <= trace / 2, and the largest possible product of inertia must be <= Imax / 2. Hence, trace / 3 and trace / 2 give a lower and upper bound on the largest possible element that can be in a valid rotational inertia.
- static TriaxiallySymmetric(I_triaxial: pydrake.symbolic.Expression) pydrake.multibody.tree.RotationalInertia_[Expression]
- class pydrake.multibody.tree.RpyFloatingJoint
Bases:
pydrake.multibody.tree.Joint
This Joint allows a rigid body to move freely with respect to its parent rigid body. This is most commonly used to allow a body to move freely with respect to the World, but can be used with any parent. More precisely, given a frame F attached to the parent body P and a frame M attached to the child body B (see the Joint class’s documentation), this joint allows frame M to translate and rotate freely with respect to F, introducing six degrees of freedom. However, unlike the QuaternionFloatingJoint, the orientation of M relative to F is parameterized with roll-pitch-yaw angles (see warning below). The generalized coordinates q for this joint are the three orientation angles followed by three generalized positions to describe the translation of frame M’s origin Mo in F with a position vector
p_FM
. As generalized velocities, we use the angular velocityw_FM
of frame M in F (not the orientation angle time derivatives q̇) and the linear velocityv_FM
of frame M’s origin Mo in frame F.Warning
Any three-parameter representation of orientation necessarily has a singularity somewhere. In this case, the singularity occurs when the pitch angle (second generalized coordinate q) is at π/2 + kπ (for any integer k), and numerical issues may occur when near one of those configurations. If you can’t be sure your simulation will avoid the singularities, consider using the singularity-free QuaternionFloatingJoint instead.
Note
This class is templated; see
RpyFloatingJoint_
for the list of instantiations.- __init__(self: pydrake.multibody.tree.RpyFloatingJoint, name: str, frame_on_parent: pydrake.multibody.tree.Frame, frame_on_child: pydrake.multibody.tree.Frame, angular_damping: float = 0, translational_damping: float = 0) None
Constructor to create an rpy floating joint between two bodies so that frame F attached to the parent body P and frame M attached to the child body B move freely relative to one another. See this class’s documentation for further details on the definition of these frames and the generalized positions q and generalized velocities v for this joint. This constructor signature creates a joint with no joint limits, i.e. the joint position, velocity and acceleration limits are the pair
(-∞, ∞)
. These can be set using the Joint methods set_position_limits(), set_velocity_limits() and set_acceleration_limits().The first three arguments to this constructor are those of the Joint class constructor. See the Joint class’s documentation for details. The additional parameters are:
- Parameter
angular_damping
: Viscous damping coefficient in N⋅m⋅s for the angular component of this joint’s velocity, used to model losses within the joint. See documentation of default_angular_damping() for details on modeling of the damping force.
- Parameter
translational_damping
: Viscous damping coefficient in N⋅s/m for the translational component of this joint’s velocity, used to model losses within the joint. See documentation of default_translational_damping() for details on modeling of the damping force.
- Raises
RuntimeError if angular_damping is negative. –
RuntimeError if translational_damping is negative. –
- Parameter
- default_angular_damping(self: pydrake.multibody.tree.RpyFloatingJoint) float
Returns this joint’s default angular damping constant in N⋅m⋅s. The damping torque (in N⋅m) is modeled as
τ = -damping⋅ω
, i.e. opposing motion, with ω the angular velocity of frame M in F (see get_angular_velocity()) and τ the torque on child body B (to which M is rigidly attached).
- default_translational_damping(self: pydrake.multibody.tree.RpyFloatingJoint) float
Returns this joint’s default translational damping constant in N⋅s/m. The damping force (in N) is modeled as
f = -damping⋅v
i.e. opposing motion, with v the translational velocity of frame M in F (see get_translational_velocity()) and f the force on child body B at Mo.
- get_angles(self: pydrake.multibody.tree.RpyFloatingJoint, context: pydrake.systems.framework.Context) numpy.ndarray[numpy.float64[3, 1]]
Gets the roll-pitch-yaw rotation angles of this joint from
context
.The orientation
R_FM
of the child frame M in parent frame F is parameterized with roll-pitch-yaw angles (also known as space-fixed x-y-z Euler angles and extrinsic angles). That is, the angles θr, θp, θy, correspond to a sequence of rotations about the Fx, Fy, and Fz axes of parent frame F, respectively. Mathematically, rotationR_FM
is given in terms of angles θr, θp, θy by:Click to expand C++ code...
R_FM(q) = Rz(θy) * Ry(θp) * Rx(θr)
where
Rx(θ)
, Ry(θ) andRz(θ)
correspond to the elemental rotations in amount of θ about the Fx, Fy and Fz axes respectively. Zero θr, θp, θy angles corresponds to frames F and M having the same orientation (their origins may still be separated). Angles θr, θp, θy are defined to be positive according to the right-hand-rule with the thumb aligned in the direction of their respective axes.Note
Space
x-y-z
angles (extrinsic) are equivalent to Bodyz-y-x
angles (intrinsic).- Parameter
context
: A Context for the MultibodyPlant this joint belongs to.
- Returns
angles
: The angle coordinates of this joint stored in the
context
ordered as θr, θp, θy.
- Parameter
- get_angular_velocity(self: pydrake.multibody.tree.RpyFloatingJoint, context: pydrake.systems.framework.Context) numpy.ndarray[numpy.float64[3, 1]]
Retrieves from
context
the angular velocityw_FM
of the child frame M in the parent frame F, expressed in F.- Parameter
context
: A Context for the MultibodyPlant this joint belongs to.
- Returns
w_FM
: A vector in ℝ³ with the angular velocity of the child frame M in the parent frame F, expressed in F. Refer to this class’s documentation for further details and definitions of these frames.
- Parameter
- get_default_angles(self: pydrake.multibody.tree.RpyFloatingJoint) numpy.ndarray[numpy.float64[3, 1]]
Gets the default angles for this joint.
- Returns
angles
: The default roll-pitch-yaw angles as a Vector3.
- Returns
- get_default_translation(self: pydrake.multibody.tree.RpyFloatingJoint) numpy.ndarray[numpy.float64[3, 1]]
Gets the default translation (position vector)
p_FM
for this joint.- Returns
p_FM
: The default translation of this joint.
- Returns
- get_translation(self: pydrake.multibody.tree.RpyFloatingJoint, context: pydrake.systems.framework.Context) numpy.ndarray[numpy.float64[3, 1]]
Returns the translation (position vector)
p_FM
of the child frame M’s origin Mo as measured and expressed in the parent frame F. Refer to the class documentation for details.- Parameter
context
: A Context for the MultibodyPlant this joint belongs to.
- Returns
p_FM
: The position vector of frame M’s origin in frame F.
- Parameter
- get_translational_velocity(self: pydrake.multibody.tree.RpyFloatingJoint, context: pydrake.systems.framework.Context) numpy.ndarray[numpy.float64[3, 1]]
Retrieves from
context
the translational velocityv_FM
of the child frame M’s origin as measured and expressed in the parent frame F.- Parameter
context
: A Context for the MultibodyPlant this joint belongs to.
- Returns
v_FM
: A vector in ℝ³ with the translational velocity of the origin of child frame M in the parent frame F, expressed in F. Refer to this class’s documentation for further details and definitions of these frames.
- Parameter
- GetPose(self: pydrake.multibody.tree.RpyFloatingJoint, context: pydrake.systems.framework.Context) pydrake.math.RigidTransform
Returns the pose
X_FM
of the outboard frame M as measured and expressed in the inboard frame F. Refer to the documentation for this class for details.- Parameter
context
: A Context for the MultibodyPlant this joint belongs to.
- Returns
X_FM
: The pose of frame M in frame F.
- Parameter
- kTypeName = 'rpy_floating'
- set_angles(self: pydrake.multibody.tree.RpyFloatingJoint, context: pydrake.systems.framework.Context, angles: numpy.ndarray[numpy.float64[3, 1]]) pydrake.multibody.tree.RpyFloatingJoint
Sets the
context
so that the generalized coordinates corresponding to the roll-pitch-yaw rotation angles of this joint equalsangles
.- Parameter
context
: A Context for the MultibodyPlant this joint belongs to.
- Parameter
angles
: Angles in radians to be stored in
context
ordered as θr, θp, θy.
Warning
See class documentation for discussion of singular configurations.
- Returns
a constant reference to this joint.
See also
get_angles() for details
- Parameter
- set_angular_velocity(self: pydrake.multibody.tree.RpyFloatingJoint, context: pydrake.systems.framework.Context, w_FM: numpy.ndarray[numpy.float64[3, 1]]) pydrake.multibody.tree.RpyFloatingJoint
Sets in
context
the state for this joint so that the angular velocity of the child frame M in the parent frame F isw_FM
.- Parameter
context
: A Context for the MultibodyPlant this joint belongs to.
- Parameter
w_FM
: A vector in ℝ³ with the angular velocity of the child frame M in the parent frame F, expressed in F. Refer to this class’s documentation for further details and definitions of these frames.
- Returns
a constant reference to this joint.
- Parameter
- set_default_angles(self: pydrake.multibody.tree.RpyFloatingJoint, angles: numpy.ndarray[numpy.float64[3, 1]]) None
Sets the default roll-pitch-yaw angles of this joint.
- Parameter
angles
: the desired default angles of the joint
Warning
See class documentation for discussion of singular configurations.
- Parameter
- set_default_translation(self: pydrake.multibody.tree.RpyFloatingJoint, p_FM: numpy.ndarray[numpy.float64[3, 1]]) None
Sets the default translation (position vector)
p_FM
of this joint.- Parameter
p_FM
: The desired default translation of the joint.
- Parameter
- set_random_angles_distribution(self: pydrake.multibody.tree.RpyFloatingJoint, angles: numpy.ndarray[object[3, 1]]) None
Sets the random distribution from which the roll-pitch-yaw orientation angles of this joint will be randomly sampled. See the RpyFloatingJoint class documentation for details on the orientation representation. If a translation distribution has already been set with stochastic variables, it will remain so. Otherwise translation will be set to this joint’s zero configuration.
Warning
Watch for random pitch angles near the singular configuration for this joint (see class documentation).
- set_random_translation_distribution(self: pydrake.multibody.tree.RpyFloatingJoint, p_FM: numpy.ndarray[object[3, 1]]) None
Sets the random distribution that the translation vector of this joint will be randomly sampled from. See the RpyFloatingJoint class documentation for details on the translation representation. If an angles distribution has has already been set with stochastic variables, it will remain so. Otherwise angles will be set to this joint’s zero configuration.
- set_translational_velocity(self: pydrake.multibody.tree.RpyFloatingJoint, context: pydrake.systems.framework.Context, v_FM: numpy.ndarray[numpy.float64[3, 1]]) pydrake.multibody.tree.RpyFloatingJoint
Sets in
context
the state for this joint so that the translational velocity of the child frame M’s origin in the parent frame F isv_FM
.- Parameter
context
: A Context for the MultibodyPlant this joint belongs to.
- Parameter
v_FM
: A vector in ℝ³ with the translational velocity of the child frame M’s origin in the parent frame F, expressed in F. Refer to this class’s documentation for further details and definitions of these frames.
- Returns
a constant reference to this joint.
- Parameter
- SetOrientation(self: pydrake.multibody.tree.RpyFloatingJoint, context: pydrake.systems.framework.Context, R_FM: pydrake.math.RotationMatrix) pydrake.multibody.tree.RpyFloatingJoint
Sets the roll-pitch-yaw angles in
context
so this Joint’s orientation is consistent with the givenR_FM
rotation matrix.- Parameter
context
: A Context for the MultibodyPlant this joint belongs to.
- Parameter
R_FM
: The rotation matrix giving the orientation of frame M in frame F.
Warning
See class documentation for discussion of singular configurations.
- Returns
a constant reference to this joint.
- Parameter
- SetPose(self: pydrake.multibody.tree.RpyFloatingJoint, context: pydrake.systems.framework.Context, X_FM: pydrake.math.RigidTransform) pydrake.multibody.tree.RpyFloatingJoint
Sets
context
to storeX_FM
the pose of frame M measured and expressed in frame F.- Parameter
context
: A Context for the MultibodyPlant this joint belongs to.
- Parameter
X_FM
: The desired pose of frame M in frame F to be stored in
context
.
Warning
See class documentation for discussion of singular configurations.
- Returns
a constant reference to
this
joint.
- Parameter
- SetTranslation(self: pydrake.multibody.tree.RpyFloatingJoint, context: pydrake.systems.framework.Context, p_FM: numpy.ndarray[numpy.float64[3, 1]]) pydrake.multibody.tree.RpyFloatingJoint
Sets
context
to store the translation (position vector)p_FM
of frame M’s origin Mo measured and expressed in frame F.- Parameter
context
: A Context for the MultibodyPlant this joint belongs to.
- Parameter
p_FM
: The desired position of frame M’s origin in frame F, to be stored in
context
.
- Returns
a constant reference to this joint.
- Parameter
- template pydrake.multibody.tree.RpyFloatingJoint_
Instantiations:
RpyFloatingJoint_[float]
,RpyFloatingJoint_[AutoDiffXd]
,RpyFloatingJoint_[Expression]
- class pydrake.multibody.tree.RpyFloatingJoint_[AutoDiffXd]
Bases:
pydrake.multibody.tree.Joint_[AutoDiffXd]
This Joint allows a rigid body to move freely with respect to its parent rigid body. This is most commonly used to allow a body to move freely with respect to the World, but can be used with any parent. More precisely, given a frame F attached to the parent body P and a frame M attached to the child body B (see the Joint class’s documentation), this joint allows frame M to translate and rotate freely with respect to F, introducing six degrees of freedom. However, unlike the QuaternionFloatingJoint, the orientation of M relative to F is parameterized with roll-pitch-yaw angles (see warning below). The generalized coordinates q for this joint are the three orientation angles followed by three generalized positions to describe the translation of frame M’s origin Mo in F with a position vector
p_FM
. As generalized velocities, we use the angular velocityw_FM
of frame M in F (not the orientation angle time derivatives q̇) and the linear velocityv_FM
of frame M’s origin Mo in frame F.Warning
Any three-parameter representation of orientation necessarily has a singularity somewhere. In this case, the singularity occurs when the pitch angle (second generalized coordinate q) is at π/2 + kπ (for any integer k), and numerical issues may occur when near one of those configurations. If you can’t be sure your simulation will avoid the singularities, consider using the singularity-free QuaternionFloatingJoint instead.
- __init__(self: pydrake.multibody.tree.RpyFloatingJoint_[AutoDiffXd], name: str, frame_on_parent: pydrake.multibody.tree.Frame_[AutoDiffXd], frame_on_child: pydrake.multibody.tree.Frame_[AutoDiffXd], angular_damping: float = 0, translational_damping: float = 0) None
Constructor to create an rpy floating joint between two bodies so that frame F attached to the parent body P and frame M attached to the child body B move freely relative to one another. See this class’s documentation for further details on the definition of these frames and the generalized positions q and generalized velocities v for this joint. This constructor signature creates a joint with no joint limits, i.e. the joint position, velocity and acceleration limits are the pair
(-∞, ∞)
. These can be set using the Joint methods set_position_limits(), set_velocity_limits() and set_acceleration_limits().The first three arguments to this constructor are those of the Joint class constructor. See the Joint class’s documentation for details. The additional parameters are:
- Parameter
angular_damping
: Viscous damping coefficient in N⋅m⋅s for the angular component of this joint’s velocity, used to model losses within the joint. See documentation of default_angular_damping() for details on modeling of the damping force.
- Parameter
translational_damping
: Viscous damping coefficient in N⋅s/m for the translational component of this joint’s velocity, used to model losses within the joint. See documentation of default_translational_damping() for details on modeling of the damping force.
- Raises
RuntimeError if angular_damping is negative. –
RuntimeError if translational_damping is negative. –
- Parameter
- default_angular_damping(self: pydrake.multibody.tree.RpyFloatingJoint_[AutoDiffXd]) float
Returns this joint’s default angular damping constant in N⋅m⋅s. The damping torque (in N⋅m) is modeled as
τ = -damping⋅ω
, i.e. opposing motion, with ω the angular velocity of frame M in F (see get_angular_velocity()) and τ the torque on child body B (to which M is rigidly attached).
- default_translational_damping(self: pydrake.multibody.tree.RpyFloatingJoint_[AutoDiffXd]) float
Returns this joint’s default translational damping constant in N⋅s/m. The damping force (in N) is modeled as
f = -damping⋅v
i.e. opposing motion, with v the translational velocity of frame M in F (see get_translational_velocity()) and f the force on child body B at Mo.
- get_angles(self: pydrake.multibody.tree.RpyFloatingJoint_[AutoDiffXd], context: pydrake.systems.framework.Context_[AutoDiffXd]) numpy.ndarray[object[3, 1]]
Gets the roll-pitch-yaw rotation angles of this joint from
context
.The orientation
R_FM
of the child frame M in parent frame F is parameterized with roll-pitch-yaw angles (also known as space-fixed x-y-z Euler angles and extrinsic angles). That is, the angles θr, θp, θy, correspond to a sequence of rotations about the Fx, Fy, and Fz axes of parent frame F, respectively. Mathematically, rotationR_FM
is given in terms of angles θr, θp, θy by:Click to expand C++ code...
R_FM(q) = Rz(θy) * Ry(θp) * Rx(θr)
where
Rx(θ)
, Ry(θ) andRz(θ)
correspond to the elemental rotations in amount of θ about the Fx, Fy and Fz axes respectively. Zero θr, θp, θy angles corresponds to frames F and M having the same orientation (their origins may still be separated). Angles θr, θp, θy are defined to be positive according to the right-hand-rule with the thumb aligned in the direction of their respective axes.Note
Space
x-y-z
angles (extrinsic) are equivalent to Bodyz-y-x
angles (intrinsic).- Parameter
context
: A Context for the MultibodyPlant this joint belongs to.
- Returns
angles
: The angle coordinates of this joint stored in the
context
ordered as θr, θp, θy.
- Parameter
- get_angular_velocity(self: pydrake.multibody.tree.RpyFloatingJoint_[AutoDiffXd], context: pydrake.systems.framework.Context_[AutoDiffXd]) numpy.ndarray[object[3, 1]]
Retrieves from
context
the angular velocityw_FM
of the child frame M in the parent frame F, expressed in F.- Parameter
context
: A Context for the MultibodyPlant this joint belongs to.
- Returns
w_FM
: A vector in ℝ³ with the angular velocity of the child frame M in the parent frame F, expressed in F. Refer to this class’s documentation for further details and definitions of these frames.
- Parameter
- get_default_angles(self: pydrake.multibody.tree.RpyFloatingJoint_[AutoDiffXd]) numpy.ndarray[numpy.float64[3, 1]]
Gets the default angles for this joint.
- Returns
angles
: The default roll-pitch-yaw angles as a Vector3.
- Returns
- get_default_translation(self: pydrake.multibody.tree.RpyFloatingJoint_[AutoDiffXd]) numpy.ndarray[numpy.float64[3, 1]]
Gets the default translation (position vector)
p_FM
for this joint.- Returns
p_FM
: The default translation of this joint.
- Returns
- get_translation(self: pydrake.multibody.tree.RpyFloatingJoint_[AutoDiffXd], context: pydrake.systems.framework.Context_[AutoDiffXd]) numpy.ndarray[object[3, 1]]
Returns the translation (position vector)
p_FM
of the child frame M’s origin Mo as measured and expressed in the parent frame F. Refer to the class documentation for details.- Parameter
context
: A Context for the MultibodyPlant this joint belongs to.
- Returns
p_FM
: The position vector of frame M’s origin in frame F.
- Parameter
- get_translational_velocity(self: pydrake.multibody.tree.RpyFloatingJoint_[AutoDiffXd], context: pydrake.systems.framework.Context_[AutoDiffXd]) numpy.ndarray[object[3, 1]]
Retrieves from
context
the translational velocityv_FM
of the child frame M’s origin as measured and expressed in the parent frame F.- Parameter
context
: A Context for the MultibodyPlant this joint belongs to.
- Returns
v_FM
: A vector in ℝ³ with the translational velocity of the origin of child frame M in the parent frame F, expressed in F. Refer to this class’s documentation for further details and definitions of these frames.
- Parameter
- GetPose(self: pydrake.multibody.tree.RpyFloatingJoint_[AutoDiffXd], context: pydrake.systems.framework.Context_[AutoDiffXd]) pydrake.math.RigidTransform_[AutoDiffXd]
Returns the pose
X_FM
of the outboard frame M as measured and expressed in the inboard frame F. Refer to the documentation for this class for details.- Parameter
context
: A Context for the MultibodyPlant this joint belongs to.
- Returns
X_FM
: The pose of frame M in frame F.
- Parameter
- kTypeName = 'rpy_floating'
- set_angles(self: pydrake.multibody.tree.RpyFloatingJoint_[AutoDiffXd], context: pydrake.systems.framework.Context_[AutoDiffXd], angles: numpy.ndarray[object[3, 1]]) pydrake.multibody.tree.RpyFloatingJoint_[AutoDiffXd]
Sets the
context
so that the generalized coordinates corresponding to the roll-pitch-yaw rotation angles of this joint equalsangles
.- Parameter
context
: A Context for the MultibodyPlant this joint belongs to.
- Parameter
angles
: Angles in radians to be stored in
context
ordered as θr, θp, θy.
Warning
See class documentation for discussion of singular configurations.
- Returns
a constant reference to this joint.
See also
get_angles() for details
- Parameter
- set_angular_velocity(self: pydrake.multibody.tree.RpyFloatingJoint_[AutoDiffXd], context: pydrake.systems.framework.Context_[AutoDiffXd], w_FM: numpy.ndarray[object[3, 1]]) pydrake.multibody.tree.RpyFloatingJoint_[AutoDiffXd]
Sets in
context
the state for this joint so that the angular velocity of the child frame M in the parent frame F isw_FM
.- Parameter
context
: A Context for the MultibodyPlant this joint belongs to.
- Parameter
w_FM
: A vector in ℝ³ with the angular velocity of the child frame M in the parent frame F, expressed in F. Refer to this class’s documentation for further details and definitions of these frames.
- Returns
a constant reference to this joint.
- Parameter
- set_default_angles(self: pydrake.multibody.tree.RpyFloatingJoint_[AutoDiffXd], angles: numpy.ndarray[numpy.float64[3, 1]]) None
Sets the default roll-pitch-yaw angles of this joint.
- Parameter
angles
: the desired default angles of the joint
Warning
See class documentation for discussion of singular configurations.
- Parameter
- set_default_translation(self: pydrake.multibody.tree.RpyFloatingJoint_[AutoDiffXd], p_FM: numpy.ndarray[numpy.float64[3, 1]]) None
Sets the default translation (position vector)
p_FM
of this joint.- Parameter
p_FM
: The desired default translation of the joint.
- Parameter
- set_random_angles_distribution(self: pydrake.multibody.tree.RpyFloatingJoint_[AutoDiffXd], angles: numpy.ndarray[object[3, 1]]) None
Sets the random distribution from which the roll-pitch-yaw orientation angles of this joint will be randomly sampled. See the RpyFloatingJoint class documentation for details on the orientation representation. If a translation distribution has already been set with stochastic variables, it will remain so. Otherwise translation will be set to this joint’s zero configuration.
Warning
Watch for random pitch angles near the singular configuration for this joint (see class documentation).
- set_random_translation_distribution(self: pydrake.multibody.tree.RpyFloatingJoint_[AutoDiffXd], p_FM: numpy.ndarray[object[3, 1]]) None
Sets the random distribution that the translation vector of this joint will be randomly sampled from. See the RpyFloatingJoint class documentation for details on the translation representation. If an angles distribution has has already been set with stochastic variables, it will remain so. Otherwise angles will be set to this joint’s zero configuration.
- set_translational_velocity(self: pydrake.multibody.tree.RpyFloatingJoint_[AutoDiffXd], context: pydrake.systems.framework.Context_[AutoDiffXd], v_FM: numpy.ndarray[object[3, 1]]) pydrake.multibody.tree.RpyFloatingJoint_[AutoDiffXd]
Sets in
context
the state for this joint so that the translational velocity of the child frame M’s origin in the parent frame F isv_FM
.- Parameter
context
: A Context for the MultibodyPlant this joint belongs to.
- Parameter
v_FM
: A vector in ℝ³ with the translational velocity of the child frame M’s origin in the parent frame F, expressed in F. Refer to this class’s documentation for further details and definitions of these frames.
- Returns
a constant reference to this joint.
- Parameter
- SetOrientation(self: pydrake.multibody.tree.RpyFloatingJoint_[AutoDiffXd], context: pydrake.systems.framework.Context_[AutoDiffXd], R_FM: pydrake.math.RotationMatrix_[AutoDiffXd]) pydrake.multibody.tree.RpyFloatingJoint_[AutoDiffXd]
Sets the roll-pitch-yaw angles in
context
so this Joint’s orientation is consistent with the givenR_FM
rotation matrix.- Parameter
context
: A Context for the MultibodyPlant this joint belongs to.
- Parameter
R_FM
: The rotation matrix giving the orientation of frame M in frame F.
Warning
See class documentation for discussion of singular configurations.
- Returns
a constant reference to this joint.
- Parameter
- SetPose(self: pydrake.multibody.tree.RpyFloatingJoint_[AutoDiffXd], context: pydrake.systems.framework.Context_[AutoDiffXd], X_FM: pydrake.math.RigidTransform_[AutoDiffXd]) pydrake.multibody.tree.RpyFloatingJoint_[AutoDiffXd]
Sets
context
to storeX_FM
the pose of frame M measured and expressed in frame F.- Parameter
context
: A Context for the MultibodyPlant this joint belongs to.
- Parameter
X_FM
: The desired pose of frame M in frame F to be stored in
context
.
Warning
See class documentation for discussion of singular configurations.
- Returns
a constant reference to
this
joint.
- Parameter
- SetTranslation(self: pydrake.multibody.tree.RpyFloatingJoint_[AutoDiffXd], context: pydrake.systems.framework.Context_[AutoDiffXd], p_FM: numpy.ndarray[object[3, 1]]) pydrake.multibody.tree.RpyFloatingJoint_[AutoDiffXd]
Sets
context
to store the translation (position vector)p_FM
of frame M’s origin Mo measured and expressed in frame F.- Parameter
context
: A Context for the MultibodyPlant this joint belongs to.
- Parameter
p_FM
: The desired position of frame M’s origin in frame F, to be stored in
context
.
- Returns
a constant reference to this joint.
- Parameter
- class pydrake.multibody.tree.RpyFloatingJoint_[Expression]
Bases:
pydrake.multibody.tree.Joint_[Expression]
This Joint allows a rigid body to move freely with respect to its parent rigid body. This is most commonly used to allow a body to move freely with respect to the World, but can be used with any parent. More precisely, given a frame F attached to the parent body P and a frame M attached to the child body B (see the Joint class’s documentation), this joint allows frame M to translate and rotate freely with respect to F, introducing six degrees of freedom. However, unlike the QuaternionFloatingJoint, the orientation of M relative to F is parameterized with roll-pitch-yaw angles (see warning below). The generalized coordinates q for this joint are the three orientation angles followed by three generalized positions to describe the translation of frame M’s origin Mo in F with a position vector
p_FM
. As generalized velocities, we use the angular velocityw_FM
of frame M in F (not the orientation angle time derivatives q̇) and the linear velocityv_FM
of frame M’s origin Mo in frame F.Warning
Any three-parameter representation of orientation necessarily has a singularity somewhere. In this case, the singularity occurs when the pitch angle (second generalized coordinate q) is at π/2 + kπ (for any integer k), and numerical issues may occur when near one of those configurations. If you can’t be sure your simulation will avoid the singularities, consider using the singularity-free QuaternionFloatingJoint instead.
- __init__(self: pydrake.multibody.tree.RpyFloatingJoint_[Expression], name: str, frame_on_parent: pydrake.multibody.tree.Frame_[Expression], frame_on_child: pydrake.multibody.tree.Frame_[Expression], angular_damping: float = 0, translational_damping: float = 0) None
Constructor to create an rpy floating joint between two bodies so that frame F attached to the parent body P and frame M attached to the child body B move freely relative to one another. See this class’s documentation for further details on the definition of these frames and the generalized positions q and generalized velocities v for this joint. This constructor signature creates a joint with no joint limits, i.e. the joint position, velocity and acceleration limits are the pair
(-∞, ∞)
. These can be set using the Joint methods set_position_limits(), set_velocity_limits() and set_acceleration_limits().The first three arguments to this constructor are those of the Joint class constructor. See the Joint class’s documentation for details. The additional parameters are:
- Parameter
angular_damping
: Viscous damping coefficient in N⋅m⋅s for the angular component of this joint’s velocity, used to model losses within the joint. See documentation of default_angular_damping() for details on modeling of the damping force.
- Parameter
translational_damping
: Viscous damping coefficient in N⋅s/m for the translational component of this joint’s velocity, used to model losses within the joint. See documentation of default_translational_damping() for details on modeling of the damping force.
- Raises
RuntimeError if angular_damping is negative. –
RuntimeError if translational_damping is negative. –
- Parameter
- default_angular_damping(self: pydrake.multibody.tree.RpyFloatingJoint_[Expression]) float
Returns this joint’s default angular damping constant in N⋅m⋅s. The damping torque (in N⋅m) is modeled as
τ = -damping⋅ω
, i.e. opposing motion, with ω the angular velocity of frame M in F (see get_angular_velocity()) and τ the torque on child body B (to which M is rigidly attached).
- default_translational_damping(self: pydrake.multibody.tree.RpyFloatingJoint_[Expression]) float
Returns this joint’s default translational damping constant in N⋅s/m. The damping force (in N) is modeled as
f = -damping⋅v
i.e. opposing motion, with v the translational velocity of frame M in F (see get_translational_velocity()) and f the force on child body B at Mo.
- get_angles(self: pydrake.multibody.tree.RpyFloatingJoint_[Expression], context: pydrake.systems.framework.Context_[Expression]) numpy.ndarray[object[3, 1]]
Gets the roll-pitch-yaw rotation angles of this joint from
context
.The orientation
R_FM
of the child frame M in parent frame F is parameterized with roll-pitch-yaw angles (also known as space-fixed x-y-z Euler angles and extrinsic angles). That is, the angles θr, θp, θy, correspond to a sequence of rotations about the Fx, Fy, and Fz axes of parent frame F, respectively. Mathematically, rotationR_FM
is given in terms of angles θr, θp, θy by:Click to expand C++ code...
R_FM(q) = Rz(θy) * Ry(θp) * Rx(θr)
where
Rx(θ)
, Ry(θ) andRz(θ)
correspond to the elemental rotations in amount of θ about the Fx, Fy and Fz axes respectively. Zero θr, θp, θy angles corresponds to frames F and M having the same orientation (their origins may still be separated). Angles θr, θp, θy are defined to be positive according to the right-hand-rule with the thumb aligned in the direction of their respective axes.Note
Space
x-y-z
angles (extrinsic) are equivalent to Bodyz-y-x
angles (intrinsic).- Parameter
context
: A Context for the MultibodyPlant this joint belongs to.
- Returns
angles
: The angle coordinates of this joint stored in the
context
ordered as θr, θp, θy.
- Parameter
- get_angular_velocity(self: pydrake.multibody.tree.RpyFloatingJoint_[Expression], context: pydrake.systems.framework.Context_[Expression]) numpy.ndarray[object[3, 1]]
Retrieves from
context
the angular velocityw_FM
of the child frame M in the parent frame F, expressed in F.- Parameter
context
: A Context for the MultibodyPlant this joint belongs to.
- Returns
w_FM
: A vector in ℝ³ with the angular velocity of the child frame M in the parent frame F, expressed in F. Refer to this class’s documentation for further details and definitions of these frames.
- Parameter
- get_default_angles(self: pydrake.multibody.tree.RpyFloatingJoint_[Expression]) numpy.ndarray[numpy.float64[3, 1]]
Gets the default angles for this joint.
- Returns
angles
: The default roll-pitch-yaw angles as a Vector3.
- Returns
- get_default_translation(self: pydrake.multibody.tree.RpyFloatingJoint_[Expression]) numpy.ndarray[numpy.float64[3, 1]]
Gets the default translation (position vector)
p_FM
for this joint.- Returns
p_FM
: The default translation of this joint.
- Returns
- get_translation(self: pydrake.multibody.tree.RpyFloatingJoint_[Expression], context: pydrake.systems.framework.Context_[Expression]) numpy.ndarray[object[3, 1]]
Returns the translation (position vector)
p_FM
of the child frame M’s origin Mo as measured and expressed in the parent frame F. Refer to the class documentation for details.- Parameter
context
: A Context for the MultibodyPlant this joint belongs to.
- Returns
p_FM
: The position vector of frame M’s origin in frame F.
- Parameter
- get_translational_velocity(self: pydrake.multibody.tree.RpyFloatingJoint_[Expression], context: pydrake.systems.framework.Context_[Expression]) numpy.ndarray[object[3, 1]]
Retrieves from
context
the translational velocityv_FM
of the child frame M’s origin as measured and expressed in the parent frame F.- Parameter
context
: A Context for the MultibodyPlant this joint belongs to.
- Returns
v_FM
: A vector in ℝ³ with the translational velocity of the origin of child frame M in the parent frame F, expressed in F. Refer to this class’s documentation for further details and definitions of these frames.
- Parameter
- GetPose(self: pydrake.multibody.tree.RpyFloatingJoint_[Expression], context: pydrake.systems.framework.Context_[Expression]) pydrake.math.RigidTransform_[Expression]
Returns the pose
X_FM
of the outboard frame M as measured and expressed in the inboard frame F. Refer to the documentation for this class for details.- Parameter
context
: A Context for the MultibodyPlant this joint belongs to.
- Returns
X_FM
: The pose of frame M in frame F.
- Parameter
- kTypeName = 'rpy_floating'
- set_angles(self: pydrake.multibody.tree.RpyFloatingJoint_[Expression], context: pydrake.systems.framework.Context_[Expression], angles: numpy.ndarray[object[3, 1]]) pydrake.multibody.tree.RpyFloatingJoint_[Expression]
Sets the
context
so that the generalized coordinates corresponding to the roll-pitch-yaw rotation angles of this joint equalsangles
.- Parameter
context
: A Context for the MultibodyPlant this joint belongs to.
- Parameter
angles
: Angles in radians to be stored in
context
ordered as θr, θp, θy.
Warning
See class documentation for discussion of singular configurations.
- Returns
a constant reference to this joint.
See also
get_angles() for details
- Parameter
- set_angular_velocity(self: pydrake.multibody.tree.RpyFloatingJoint_[Expression], context: pydrake.systems.framework.Context_[Expression], w_FM: numpy.ndarray[object[3, 1]]) pydrake.multibody.tree.RpyFloatingJoint_[Expression]
Sets in
context
the state for this joint so that the angular velocity of the child frame M in the parent frame F isw_FM
.- Parameter
context
: A Context for the MultibodyPlant this joint belongs to.
- Parameter
w_FM
: A vector in ℝ³ with the angular velocity of the child frame M in the parent frame F, expressed in F. Refer to this class’s documentation for further details and definitions of these frames.
- Returns
a constant reference to this joint.
- Parameter
- set_default_angles(self: pydrake.multibody.tree.RpyFloatingJoint_[Expression], angles: numpy.ndarray[numpy.float64[3, 1]]) None
Sets the default roll-pitch-yaw angles of this joint.
- Parameter
angles
: the desired default angles of the joint
Warning
See class documentation for discussion of singular configurations.
- Parameter
- set_default_translation(self: pydrake.multibody.tree.RpyFloatingJoint_[Expression], p_FM: numpy.ndarray[numpy.float64[3, 1]]) None
Sets the default translation (position vector)
p_FM
of this joint.- Parameter
p_FM
: The desired default translation of the joint.
- Parameter
- set_random_angles_distribution(self: pydrake.multibody.tree.RpyFloatingJoint_[Expression], angles: numpy.ndarray[object[3, 1]]) None
Sets the random distribution from which the roll-pitch-yaw orientation angles of this joint will be randomly sampled. See the RpyFloatingJoint class documentation for details on the orientation representation. If a translation distribution has already been set with stochastic variables, it will remain so. Otherwise translation will be set to this joint’s zero configuration.
Warning
Watch for random pitch angles near the singular configuration for this joint (see class documentation).
- set_random_translation_distribution(self: pydrake.multibody.tree.RpyFloatingJoint_[Expression], p_FM: numpy.ndarray[object[3, 1]]) None
Sets the random distribution that the translation vector of this joint will be randomly sampled from. See the RpyFloatingJoint class documentation for details on the translation representation. If an angles distribution has has already been set with stochastic variables, it will remain so. Otherwise angles will be set to this joint’s zero configuration.
- set_translational_velocity(self: pydrake.multibody.tree.RpyFloatingJoint_[Expression], context: pydrake.systems.framework.Context_[Expression], v_FM: numpy.ndarray[object[3, 1]]) pydrake.multibody.tree.RpyFloatingJoint_[Expression]
Sets in
context
the state for this joint so that the translational velocity of the child frame M’s origin in the parent frame F isv_FM
.- Parameter
context
: A Context for the MultibodyPlant this joint belongs to.
- Parameter
v_FM
: A vector in ℝ³ with the translational velocity of the child frame M’s origin in the parent frame F, expressed in F. Refer to this class’s documentation for further details and definitions of these frames.
- Returns
a constant reference to this joint.
- Parameter
- SetOrientation(self: pydrake.multibody.tree.RpyFloatingJoint_[Expression], context: pydrake.systems.framework.Context_[Expression], R_FM: pydrake.math.RotationMatrix_[Expression]) pydrake.multibody.tree.RpyFloatingJoint_[Expression]
Sets the roll-pitch-yaw angles in
context
so this Joint’s orientation is consistent with the givenR_FM
rotation matrix.- Parameter
context
: A Context for the MultibodyPlant this joint belongs to.
- Parameter
R_FM
: The rotation matrix giving the orientation of frame M in frame F.
Warning
See class documentation for discussion of singular configurations.
- Returns
a constant reference to this joint.
- Parameter
- SetPose(self: pydrake.multibody.tree.RpyFloatingJoint_[Expression], context: pydrake.systems.framework.Context_[Expression], X_FM: pydrake.math.RigidTransform_[Expression]) pydrake.multibody.tree.RpyFloatingJoint_[Expression]
Sets
context
to storeX_FM
the pose of frame M measured and expressed in frame F.- Parameter
context
: A Context for the MultibodyPlant this joint belongs to.
- Parameter
X_FM
: The desired pose of frame M in frame F to be stored in
context
.
Warning
See class documentation for discussion of singular configurations.
- Returns
a constant reference to
this
joint.
- Parameter
- SetTranslation(self: pydrake.multibody.tree.RpyFloatingJoint_[Expression], context: pydrake.systems.framework.Context_[Expression], p_FM: numpy.ndarray[object[3, 1]]) pydrake.multibody.tree.RpyFloatingJoint_[Expression]
Sets
context
to store the translation (position vector)p_FM
of frame M’s origin Mo measured and expressed in frame F.- Parameter
context
: A Context for the MultibodyPlant this joint belongs to.
- Parameter
p_FM
: The desired position of frame M’s origin in frame F, to be stored in
context
.
- Returns
a constant reference to this joint.
- Parameter
- class pydrake.multibody.tree.ScopedName
A delimited string name for a multibody element, e.g., “robot1::torso”.
The name is composed of two semantically separate pieces – the
element
name is the local name for the element (e.g., a joint, body, frame, etc.) and thenamespace
name is the location of that element within the tree. For “robot1::torso” the namespace name is “robot1” and the element name is “torso”.The namespace name typically refers to the model instance name that contains the element. Some temporary scoped names do not use a namespace (e.g., temporary values created during input file parsing), in which case the namespace name can be empty. The namespace name will never start or end with “::”.
The element name is never empty, unless the ScopedName was default-constructed or moved-from. The element name will never contain the delimiter string “::”.
When there is no namespace, the scoped name does not contain a leading “::”, e.g., for the element name “box” without any namespace, the scoped name is “box” not “::box”.
The namespace name may contain the “::” delimiter in the middle of the name (possibly multiple times), e.g., for “robot1::left::arm::end_frame” the namespace name is “robot1::left::arm” and the element is name “end_frame”.
This class does not treat a single colon (“:”) specially. Those can appear in either namespace names or element names.
- __init__(*args, **kwargs)
Overloaded function.
__init__(self: pydrake.multibody.tree.ScopedName) -> None
Creates an empty name.
__init__(self: pydrake.multibody.tree.ScopedName, namespace_name: str, element_name: str) -> None
Creates a ScopedName for the given
namespace_name
andelement_name
.- Raises
RuntimeError if namespace_name starts or ends with "::". –
RuntimeError if element_name contains "::" or is empty. –
See also
ScopedName::Make() to use a null return value instead of exceptions.
See also
ScopedName::Join() for automatic cleanup of “::” tokens.
- get_element(self: pydrake.multibody.tree.ScopedName) str
Returns the element portion of this scoped name, e.g., “torso”. This is the local name of the joint, body, etc. within the model instance. It is never empty unless this ScopedName was default-constructed or moved-from.
- get_full(self: pydrake.multibody.tree.ScopedName) str
Returns the full ScopedName as a string, e.g., “robot1::torso”. It is never empty unless this ScopedName was default-constructed or moved-from.
- get_namespace(self: pydrake.multibody.tree.ScopedName) str
Returns the namespace portion of this scoped name, e.g., “robot1”. This is typically the model instance name. This is typically the model instance name but can be empty (see class overview for details).
- static Join(name1: str, name2: str) pydrake.multibody.tree.ScopedName
Creates a ScopedName for the given
name1::name2
. Unlike the constructor or ScopedName::Make(), this function allows “::” in either name. Any leading or trailing “::” on the names are removed before joining. After joining, the final word after all “::”s is the element name, and everything prior is the namespace name.
- static Make(namespace_name: str, element_name: str) Optional[pydrake.multibody.tree.ScopedName]
Creates a ScopedName for the given
namespace_name
andelement_name
. Returns nullopt ifnamespace_name
starts or ends with “::”, or ifelement_name
contains “::” or is empty.See also
ScopedName::Join() for automatic coalescing of “::” tokens.
- static Parse(scoped_name: str) pydrake.multibody.tree.ScopedName
Parses the given
scoped_name
string. Any leading or trailing “::”s on the name are removed (even multiple copies like “::::” are removed).
- set_element(self: pydrake.multibody.tree.ScopedName, element_name: str) None
Replaces the element name of this object, leaving the namespace name unchanged.
- Raises
RuntimeError if element_name contains "::" or is empty. –
- set_namespace(self: pydrake.multibody.tree.ScopedName, namespace_name: str) None
Replaces the namespace name of this object, leaving the element name unchanged. The namespace name is allowed to be empty.
- Raises
RuntimeError if namespace_name starts or ends with "::". –
- to_string(self: pydrake.multibody.tree.ScopedName) str
Returns get_full() as a string value instead of a string_view.
- class pydrake.multibody.tree.ScrewJoint
Bases:
pydrake.multibody.tree.Joint
This joint models a screw joint allowing two bodies to rotate about one axis while translating along that same axis with one degree of freedom. That is, given a frame F attached to the parent body P and a frame M attached to the child body B (see the Joint class’s documentation), this joint allows frame M to translate (while rotating) along an axis â. Axis â is constant and has the same measures in both frames F and M, that is,
â_F = â_M
. The rotation about theâ_F
axis and its rate specify the state of the joint. Zero (θ) corresponds to frames F and M being coincident and aligned. The translation distance is defined positive when child body B translates along the direction of â, and the rotation θ is defined to be positive according to the right-hand-rule with the thumb aligned in the direction of theâ_F
axis.Note
This class is templated; see
ScrewJoint_
for the list of instantiations.- __init__(*args, **kwargs)
Overloaded function.
__init__(self: pydrake.multibody.tree.ScrewJoint, name: str, frame_on_parent: pydrake.multibody.tree.Frame, frame_on_child: pydrake.multibody.tree.Frame, screw_pitch: float, damping: float) -> None
Constructor to create a screw joint between two bodies so that frame F attached to the parent body P and frame M attached to the child body B translate and rotate as described in the class’s documentation. This constructor signature creates a joint with the axis â set to the z-axis and no joint limits, i.e. the joint angular position, angular velocity and angular acceleration limits are the pair
(-∞, ∞)
. These can be set using the Joint methods set_position_limits(), set_velocity_limits() and set_acceleration_limits() in radians, radians/s, radians/s² units. The first three arguments to this constructor are those of the Joint class constructor. See the Joint class’s documentation for details. The additional parameters are:- Parameter
screw_pitch
: Amount of translation in meters occurring over a one full screw revolution. It’s domain is (-∞, ∞). When the screw pitch is negative, positive rotation will result in translating towards the negative direction of z-axis. When the screw pitch is zero, this joint will behave like a revolute joint.
- Parameter
damping
: Viscous damping coefficient, N⋅m⋅s/rad for rotation, used to model losses within the joint. See documentation of default_damping() for details on modelling of the damping torque.
- Raises
RuntimeError if damping is negative. –
__init__(self: pydrake.multibody.tree.ScrewJoint, name: str, frame_on_parent: pydrake.multibody.tree.Frame, frame_on_child: pydrake.multibody.tree.Frame, axis: numpy.ndarray[numpy.float64[3, 1]], screw_pitch: float, damping: float) -> None
Constructor to create a screw joint between two bodies so that frame F attached to the parent body P and frame M attached to the child body B translate and rotate as described in the class’s documentation. This constructor signature creates a joint with no joint limits, i.e. the joint angular position, angular velocity and angular acceleration limits are the pair
(-∞, ∞)
. These can be set using the Joint methods set_position_limits(), set_velocity_limits() and set_acceleration_limits() in radians, radians/s, radians/s² units. The first three arguments to this constructor are those of the Joint class constructor. See the Joint class’s documentation for details. The additional parameters are:- Parameter
axis
: A vector in ℝ³ specifying the axis of motion for this joint. The coordinates of
axis
expressed in frames F and M are the same at all times, that is,axis_F = axis_M
. In other words,axis_F
(oraxis_M
) is the eigenvector ofR_FM
with eigenvalue equal to one. This vector can have any length, only the direction is used.- Parameter
screw_pitch
: Amount of translation in meters occurring over a one full screw revolution. It’s domain is (-∞, ∞). When the screw pitch is negative, positive rotation will result in translating towards the negative direction of â-axis. When the screw pitch is zero, this joint will behave like a revolute joint.
- Parameter
damping
: Viscous damping coefficient, N⋅m⋅s/rad for rotation, used to model losses within the joint. See documentation of default_damping() for details on modelling of the damping torque.
- Raises
RuntimeError if the L2 norm of axis is less than the square –
root of machine epsilon. –
RuntimeError if damping is negative. –
- default_damping(self: pydrake.multibody.tree.ScrewJoint) float
Returns
this
joint’s default damping constant N⋅m⋅s for the rotational degree. The damping torque (in N⋅m) is modeled asτ = -damping⋅ω
i.e. opposing motion, with ω the angular rate forthis
joint (see get_angular_velocity()) and τ the torque on child body B expressed in frame F as t_B_F = τ⋅Fâ_F.
- get_angular_velocity(self: pydrake.multibody.tree.ScrewJoint, context: pydrake.systems.framework.Context) float
Gets the rate of change, in radians per second, of
this
joint’s angle θ fromcontext
. See class documentation for the definition of this angle.- Parameter
context
: The context of the model this joint belongs to.
- Returns
theta_dot
: The rate of change of
this
joint’s angle θ as stored in thecontext
.
- Parameter
- get_default_rotation(self: pydrake.multibody.tree.ScrewJoint) float
Gets the default angle for
this
joint.- Returns
theta
: The default angle of
this
joint.
- Returns
- get_default_translation(self: pydrake.multibody.tree.ScrewJoint) float
Gets the default position for
this
joint.- Returns
z
: The default position of
this
joint.
- Returns
- get_rotation(self: pydrake.multibody.tree.ScrewJoint, context: pydrake.systems.framework.Context) float
Gets the angle θ of
this
joint fromcontext
.- Parameter
context
: The context of the model this joint belongs to.
- Returns
theta
: The angle of
this
joint stored in thecontext
. See class documentation for details.
- Parameter
- get_translation(self: pydrake.multibody.tree.ScrewJoint, context: pydrake.systems.framework.Context) float
Gets the translation of
this
joint fromcontext
.- Parameter
context
: The context of the model this joint belongs to.
- Returns
z
: The translation of
this
joint stored in thecontext
as (z). See class documentation for details.
- Parameter
- get_translational_velocity(self: pydrake.multibody.tree.ScrewJoint, context: pydrake.systems.framework.Context) float
Gets the translational velocity vz, in meters per second, of
this
joint’s Mo measured and expressed in frame F fromcontext
.- Parameter
context
: The context of the model this joint belongs to.
- Returns
vz
: The translational velocity of
this
joint as stored in thecontext
.
- Parameter
- GetDamping(self: pydrake.multibody.tree.ScrewJoint, context: pydrake.systems.framework.Context) float
Returns the Context dependent damping coefficient stored as a parameter in
context
. Refer to default_damping() for details.- Parameter
context
: The context storing the state and parameters for the model to which
this
joint belongs.
- Parameter
- kTypeName = 'screw'
- screw_pitch(self: pydrake.multibody.tree.ScrewJoint) float
Returns
this
joint’s amount of translation in meters occurring over a one full revolution.
- set_angular_velocity(self: pydrake.multibody.tree.ScrewJoint, context: pydrake.systems.framework.Context, theta_dot: float) pydrake.multibody.tree.ScrewJoint
Sets the rate of change, in radians per second, of
this
joint’s angle θ (see class documentation) totheta_dot
. The new rate of change gets stored incontext
.- Parameter
context
: The context of the model this joint belongs to.
- Parameter
theta_dot
: The desired rates of change of
this
joint’s angle in radians per second.
- Returns
a constant reference to
this
joint.
- Parameter
- set_default_rotation(self: pydrake.multibody.tree.ScrewJoint, theta: float) None
Sets the default angle of this joint. This will change the
default_translation
too, because they are not independent in this joint.- Parameter
theta
: The desired default angle of the joint
- Parameter
- set_default_translation(self: pydrake.multibody.tree.ScrewJoint, z: float) None
Sets the default translation of this joint. This will change the
default_rotation
too, which are not independent in this joint.- Parameter
z
: The desired default translation of the joint
- Raises
RuntimeError if pitch is very near zero. –
- Parameter
- set_random_pose_distribution(self: pydrake.multibody.tree.ScrewJoint, theta: numpy.ndarray[object[1, 1]]) None
Sets the random distribution that the angle of this joint will be randomly sampled from. See class documentation for details on the definition of the position and angle.
- set_translation(self: pydrake.multibody.tree.ScrewJoint, context: pydrake.systems.framework.Context, translation: float) pydrake.multibody.tree.ScrewJoint
Sets the
context
so that the translation ofthis
joint equals to (z).- Parameter
context
: The context of the model this joint belongs to.
- Parameter
z
: The desired translation in meters to be stored in
context
as (z). See class documentation for details.
- Returns
a constant reference to
this
joint.
- Parameter
- set_translational_velocity(self: pydrake.multibody.tree.ScrewJoint, context: pydrake.systems.framework.Context, translation_dot: float) pydrake.multibody.tree.ScrewJoint
Sets the translational velocity, in meters per second, of this
this
joint’s Mo along frame F’s â-axis tovz
. The new translational velocity gets stored incontext
.- Parameter
context
: The context of the model this joint belongs to.
- Parameter
vz
: The desired translational velocity of
this
joint in meters per second along F frame’s â-axis.
- Returns
a constant reference to
this
joint.
- Parameter
- SetDamping(self: pydrake.multibody.tree.ScrewJoint, context: pydrake.systems.framework.Context, damping: float) None
Sets the value of the viscous damping coefficient for this joint, stored as a parameter in
context
. Refer to default_damping() for details.- Parameter
context
: The context storing the state and parameters for the model to which
this
joint belongs.- Parameter
damping
: The damping value.
- Raises
RuntimeError if damping is negative. –
- Parameter
- template pydrake.multibody.tree.ScrewJoint_
Instantiations:
ScrewJoint_[float]
,ScrewJoint_[AutoDiffXd]
,ScrewJoint_[Expression]
- class pydrake.multibody.tree.ScrewJoint_[AutoDiffXd]
Bases:
pydrake.multibody.tree.Joint_[AutoDiffXd]
This joint models a screw joint allowing two bodies to rotate about one axis while translating along that same axis with one degree of freedom. That is, given a frame F attached to the parent body P and a frame M attached to the child body B (see the Joint class’s documentation), this joint allows frame M to translate (while rotating) along an axis â. Axis â is constant and has the same measures in both frames F and M, that is,
â_F = â_M
. The rotation about theâ_F
axis and its rate specify the state of the joint. Zero (θ) corresponds to frames F and M being coincident and aligned. The translation distance is defined positive when child body B translates along the direction of â, and the rotation θ is defined to be positive according to the right-hand-rule with the thumb aligned in the direction of theâ_F
axis.- __init__(*args, **kwargs)
Overloaded function.
__init__(self: pydrake.multibody.tree.ScrewJoint_[AutoDiffXd], name: str, frame_on_parent: pydrake.multibody.tree.Frame_[AutoDiffXd], frame_on_child: pydrake.multibody.tree.Frame_[AutoDiffXd], screw_pitch: float, damping: float) -> None
Constructor to create a screw joint between two bodies so that frame F attached to the parent body P and frame M attached to the child body B translate and rotate as described in the class’s documentation. This constructor signature creates a joint with the axis â set to the z-axis and no joint limits, i.e. the joint angular position, angular velocity and angular acceleration limits are the pair
(-∞, ∞)
. These can be set using the Joint methods set_position_limits(), set_velocity_limits() and set_acceleration_limits() in radians, radians/s, radians/s² units. The first three arguments to this constructor are those of the Joint class constructor. See the Joint class’s documentation for details. The additional parameters are:- Parameter
screw_pitch
: Amount of translation in meters occurring over a one full screw revolution. It’s domain is (-∞, ∞). When the screw pitch is negative, positive rotation will result in translating towards the negative direction of z-axis. When the screw pitch is zero, this joint will behave like a revolute joint.
- Parameter
damping
: Viscous damping coefficient, N⋅m⋅s/rad for rotation, used to model losses within the joint. See documentation of default_damping() for details on modelling of the damping torque.
- Raises
RuntimeError if damping is negative. –
__init__(self: pydrake.multibody.tree.ScrewJoint_[AutoDiffXd], name: str, frame_on_parent: pydrake.multibody.tree.Frame_[AutoDiffXd], frame_on_child: pydrake.multibody.tree.Frame_[AutoDiffXd], axis: numpy.ndarray[numpy.float64[3, 1]], screw_pitch: float, damping: float) -> None
Constructor to create a screw joint between two bodies so that frame F attached to the parent body P and frame M attached to the child body B translate and rotate as described in the class’s documentation. This constructor signature creates a joint with no joint limits, i.e. the joint angular position, angular velocity and angular acceleration limits are the pair
(-∞, ∞)
. These can be set using the Joint methods set_position_limits(), set_velocity_limits() and set_acceleration_limits() in radians, radians/s, radians/s² units. The first three arguments to this constructor are those of the Joint class constructor. See the Joint class’s documentation for details. The additional parameters are:- Parameter
axis
: A vector in ℝ³ specifying the axis of motion for this joint. The coordinates of
axis
expressed in frames F and M are the same at all times, that is,axis_F = axis_M
. In other words,axis_F
(oraxis_M
) is the eigenvector ofR_FM
with eigenvalue equal to one. This vector can have any length, only the direction is used.- Parameter
screw_pitch
: Amount of translation in meters occurring over a one full screw revolution. It’s domain is (-∞, ∞). When the screw pitch is negative, positive rotation will result in translating towards the negative direction of â-axis. When the screw pitch is zero, this joint will behave like a revolute joint.
- Parameter
damping
: Viscous damping coefficient, N⋅m⋅s/rad for rotation, used to model losses within the joint. See documentation of default_damping() for details on modelling of the damping torque.
- Raises
RuntimeError if the L2 norm of axis is less than the square –
root of machine epsilon. –
RuntimeError if damping is negative. –
- default_damping(self: pydrake.multibody.tree.ScrewJoint_[AutoDiffXd]) float
Returns
this
joint’s default damping constant N⋅m⋅s for the rotational degree. The damping torque (in N⋅m) is modeled asτ = -damping⋅ω
i.e. opposing motion, with ω the angular rate forthis
joint (see get_angular_velocity()) and τ the torque on child body B expressed in frame F as t_B_F = τ⋅Fâ_F.
- get_angular_velocity(self: pydrake.multibody.tree.ScrewJoint_[AutoDiffXd], context: pydrake.systems.framework.Context_[AutoDiffXd]) pydrake.autodiffutils.AutoDiffXd
Gets the rate of change, in radians per second, of
this
joint’s angle θ fromcontext
. See class documentation for the definition of this angle.- Parameter
context
: The context of the model this joint belongs to.
- Returns
theta_dot
: The rate of change of
this
joint’s angle θ as stored in thecontext
.
- Parameter
- get_default_rotation(self: pydrake.multibody.tree.ScrewJoint_[AutoDiffXd]) float
Gets the default angle for
this
joint.- Returns
theta
: The default angle of
this
joint.
- Returns
- get_default_translation(self: pydrake.multibody.tree.ScrewJoint_[AutoDiffXd]) float
Gets the default position for
this
joint.- Returns
z
: The default position of
this
joint.
- Returns
- get_rotation(self: pydrake.multibody.tree.ScrewJoint_[AutoDiffXd], context: pydrake.systems.framework.Context_[AutoDiffXd]) pydrake.autodiffutils.AutoDiffXd
Gets the angle θ of
this
joint fromcontext
.- Parameter
context
: The context of the model this joint belongs to.
- Returns
theta
: The angle of
this
joint stored in thecontext
. See class documentation for details.
- Parameter
- get_translation(self: pydrake.multibody.tree.ScrewJoint_[AutoDiffXd], context: pydrake.systems.framework.Context_[AutoDiffXd]) pydrake.autodiffutils.AutoDiffXd
Gets the translation of
this
joint fromcontext
.- Parameter
context
: The context of the model this joint belongs to.
- Returns
z
: The translation of
this
joint stored in thecontext
as (z). See class documentation for details.
- Parameter
- get_translational_velocity(self: pydrake.multibody.tree.ScrewJoint_[AutoDiffXd], context: pydrake.systems.framework.Context_[AutoDiffXd]) pydrake.autodiffutils.AutoDiffXd
Gets the translational velocity vz, in meters per second, of
this
joint’s Mo measured and expressed in frame F fromcontext
.- Parameter
context
: The context of the model this joint belongs to.
- Returns
vz
: The translational velocity of
this
joint as stored in thecontext
.
- Parameter
- GetDamping(self: pydrake.multibody.tree.ScrewJoint_[AutoDiffXd], context: pydrake.systems.framework.Context_[AutoDiffXd]) pydrake.autodiffutils.AutoDiffXd
Returns the Context dependent damping coefficient stored as a parameter in
context
. Refer to default_damping() for details.- Parameter
context
: The context storing the state and parameters for the model to which
this
joint belongs.
- Parameter
- kTypeName = 'screw'
- screw_pitch(self: pydrake.multibody.tree.ScrewJoint_[AutoDiffXd]) float
Returns
this
joint’s amount of translation in meters occurring over a one full revolution.
- set_angular_velocity(self: pydrake.multibody.tree.ScrewJoint_[AutoDiffXd], context: pydrake.systems.framework.Context_[AutoDiffXd], theta_dot: pydrake.autodiffutils.AutoDiffXd) pydrake.multibody.tree.ScrewJoint_[AutoDiffXd]
Sets the rate of change, in radians per second, of
this
joint’s angle θ (see class documentation) totheta_dot
. The new rate of change gets stored incontext
.- Parameter
context
: The context of the model this joint belongs to.
- Parameter
theta_dot
: The desired rates of change of
this
joint’s angle in radians per second.
- Returns
a constant reference to
this
joint.
- Parameter
- set_default_rotation(self: pydrake.multibody.tree.ScrewJoint_[AutoDiffXd], theta: float) None
Sets the default angle of this joint. This will change the
default_translation
too, because they are not independent in this joint.- Parameter
theta
: The desired default angle of the joint
- Parameter
- set_default_translation(self: pydrake.multibody.tree.ScrewJoint_[AutoDiffXd], z: float) None
Sets the default translation of this joint. This will change the
default_rotation
too, which are not independent in this joint.- Parameter
z
: The desired default translation of the joint
- Raises
RuntimeError if pitch is very near zero. –
- Parameter
- set_random_pose_distribution(self: pydrake.multibody.tree.ScrewJoint_[AutoDiffXd], theta: numpy.ndarray[object[1, 1]]) None
Sets the random distribution that the angle of this joint will be randomly sampled from. See class documentation for details on the definition of the position and angle.
- set_translation(self: pydrake.multibody.tree.ScrewJoint_[AutoDiffXd], context: pydrake.systems.framework.Context_[AutoDiffXd], translation: pydrake.autodiffutils.AutoDiffXd) pydrake.multibody.tree.ScrewJoint_[AutoDiffXd]
Sets the
context
so that the translation ofthis
joint equals to (z).- Parameter
context
: The context of the model this joint belongs to.
- Parameter
z
: The desired translation in meters to be stored in
context
as (z). See class documentation for details.
- Returns
a constant reference to
this
joint.
- Parameter
- set_translational_velocity(self: pydrake.multibody.tree.ScrewJoint_[AutoDiffXd], context: pydrake.systems.framework.Context_[AutoDiffXd], translation_dot: pydrake.autodiffutils.AutoDiffXd) pydrake.multibody.tree.ScrewJoint_[AutoDiffXd]
Sets the translational velocity, in meters per second, of this
this
joint’s Mo along frame F’s â-axis tovz
. The new translational velocity gets stored incontext
.- Parameter
context
: The context of the model this joint belongs to.
- Parameter
vz
: The desired translational velocity of
this
joint in meters per second along F frame’s â-axis.
- Returns
a constant reference to
this
joint.
- Parameter
- SetDamping(self: pydrake.multibody.tree.ScrewJoint_[AutoDiffXd], context: pydrake.systems.framework.Context_[AutoDiffXd], damping: pydrake.autodiffutils.AutoDiffXd) None
Sets the value of the viscous damping coefficient for this joint, stored as a parameter in
context
. Refer to default_damping() for details.- Parameter
context
: The context storing the state and parameters for the model to which
this
joint belongs.- Parameter
damping
: The damping value.
- Raises
RuntimeError if damping is negative. –
- Parameter
- class pydrake.multibody.tree.ScrewJoint_[Expression]
Bases:
pydrake.multibody.tree.Joint_[Expression]
This joint models a screw joint allowing two bodies to rotate about one axis while translating along that same axis with one degree of freedom. That is, given a frame F attached to the parent body P and a frame M attached to the child body B (see the Joint class’s documentation), this joint allows frame M to translate (while rotating) along an axis â. Axis â is constant and has the same measures in both frames F and M, that is,
â_F = â_M
. The rotation about theâ_F
axis and its rate specify the state of the joint. Zero (θ) corresponds to frames F and M being coincident and aligned. The translation distance is defined positive when child body B translates along the direction of â, and the rotation θ is defined to be positive according to the right-hand-rule with the thumb aligned in the direction of theâ_F
axis.- __init__(*args, **kwargs)
Overloaded function.
__init__(self: pydrake.multibody.tree.ScrewJoint_[Expression], name: str, frame_on_parent: pydrake.multibody.tree.Frame_[Expression], frame_on_child: pydrake.multibody.tree.Frame_[Expression], screw_pitch: float, damping: float) -> None
Constructor to create a screw joint between two bodies so that frame F attached to the parent body P and frame M attached to the child body B translate and rotate as described in the class’s documentation. This constructor signature creates a joint with the axis â set to the z-axis and no joint limits, i.e. the joint angular position, angular velocity and angular acceleration limits are the pair
(-∞, ∞)
. These can be set using the Joint methods set_position_limits(), set_velocity_limits() and set_acceleration_limits() in radians, radians/s, radians/s² units. The first three arguments to this constructor are those of the Joint class constructor. See the Joint class’s documentation for details. The additional parameters are:- Parameter
screw_pitch
: Amount of translation in meters occurring over a one full screw revolution. It’s domain is (-∞, ∞). When the screw pitch is negative, positive rotation will result in translating towards the negative direction of z-axis. When the screw pitch is zero, this joint will behave like a revolute joint.
- Parameter
damping
: Viscous damping coefficient, N⋅m⋅s/rad for rotation, used to model losses within the joint. See documentation of default_damping() for details on modelling of the damping torque.
- Raises
RuntimeError if damping is negative. –
__init__(self: pydrake.multibody.tree.ScrewJoint_[Expression], name: str, frame_on_parent: pydrake.multibody.tree.Frame_[Expression], frame_on_child: pydrake.multibody.tree.Frame_[Expression], axis: numpy.ndarray[numpy.float64[3, 1]], screw_pitch: float, damping: float) -> None
Constructor to create a screw joint between two bodies so that frame F attached to the parent body P and frame M attached to the child body B translate and rotate as described in the class’s documentation. This constructor signature creates a joint with no joint limits, i.e. the joint angular position, angular velocity and angular acceleration limits are the pair
(-∞, ∞)
. These can be set using the Joint methods set_position_limits(), set_velocity_limits() and set_acceleration_limits() in radians, radians/s, radians/s² units. The first three arguments to this constructor are those of the Joint class constructor. See the Joint class’s documentation for details. The additional parameters are:- Parameter
axis
: A vector in ℝ³ specifying the axis of motion for this joint. The coordinates of
axis
expressed in frames F and M are the same at all times, that is,axis_F = axis_M
. In other words,axis_F
(oraxis_M
) is the eigenvector ofR_FM
with eigenvalue equal to one. This vector can have any length, only the direction is used.- Parameter
screw_pitch
: Amount of translation in meters occurring over a one full screw revolution. It’s domain is (-∞, ∞). When the screw pitch is negative, positive rotation will result in translating towards the negative direction of â-axis. When the screw pitch is zero, this joint will behave like a revolute joint.
- Parameter
damping
: Viscous damping coefficient, N⋅m⋅s/rad for rotation, used to model losses within the joint. See documentation of default_damping() for details on modelling of the damping torque.
- Raises
RuntimeError if the L2 norm of axis is less than the square –
root of machine epsilon. –
RuntimeError if damping is negative. –
- default_damping(self: pydrake.multibody.tree.ScrewJoint_[Expression]) float
Returns
this
joint’s default damping constant N⋅m⋅s for the rotational degree. The damping torque (in N⋅m) is modeled asτ = -damping⋅ω
i.e. opposing motion, with ω the angular rate forthis
joint (see get_angular_velocity()) and τ the torque on child body B expressed in frame F as t_B_F = τ⋅Fâ_F.
- get_angular_velocity(self: pydrake.multibody.tree.ScrewJoint_[Expression], context: pydrake.systems.framework.Context_[Expression]) pydrake.symbolic.Expression
Gets the rate of change, in radians per second, of
this
joint’s angle θ fromcontext
. See class documentation for the definition of this angle.- Parameter
context
: The context of the model this joint belongs to.
- Returns
theta_dot
: The rate of change of
this
joint’s angle θ as stored in thecontext
.
- Parameter
- get_default_rotation(self: pydrake.multibody.tree.ScrewJoint_[Expression]) float
Gets the default angle for
this
joint.- Returns
theta
: The default angle of
this
joint.
- Returns
- get_default_translation(self: pydrake.multibody.tree.ScrewJoint_[Expression]) float
Gets the default position for
this
joint.- Returns
z
: The default position of
this
joint.
- Returns
- get_rotation(self: pydrake.multibody.tree.ScrewJoint_[Expression], context: pydrake.systems.framework.Context_[Expression]) pydrake.symbolic.Expression
Gets the angle θ of
this
joint fromcontext
.- Parameter
context
: The context of the model this joint belongs to.
- Returns
theta
: The angle of
this
joint stored in thecontext
. See class documentation for details.
- Parameter
- get_translation(self: pydrake.multibody.tree.ScrewJoint_[Expression], context: pydrake.systems.framework.Context_[Expression]) pydrake.symbolic.Expression
Gets the translation of
this
joint fromcontext
.- Parameter
context
: The context of the model this joint belongs to.
- Returns
z
: The translation of
this
joint stored in thecontext
as (z). See class documentation for details.
- Parameter
- get_translational_velocity(self: pydrake.multibody.tree.ScrewJoint_[Expression], context: pydrake.systems.framework.Context_[Expression]) pydrake.symbolic.Expression
Gets the translational velocity vz, in meters per second, of
this
joint’s Mo measured and expressed in frame F fromcontext
.- Parameter
context
: The context of the model this joint belongs to.
- Returns
vz
: The translational velocity of
this
joint as stored in thecontext
.
- Parameter
- GetDamping(self: pydrake.multibody.tree.ScrewJoint_[Expression], context: pydrake.systems.framework.Context_[Expression]) pydrake.symbolic.Expression
Returns the Context dependent damping coefficient stored as a parameter in
context
. Refer to default_damping() for details.- Parameter
context
: The context storing the state and parameters for the model to which
this
joint belongs.
- Parameter
- kTypeName = 'screw'
- screw_pitch(self: pydrake.multibody.tree.ScrewJoint_[Expression]) float
Returns
this
joint’s amount of translation in meters occurring over a one full revolution.
- set_angular_velocity(self: pydrake.multibody.tree.ScrewJoint_[Expression], context: pydrake.systems.framework.Context_[Expression], theta_dot: pydrake.symbolic.Expression) pydrake.multibody.tree.ScrewJoint_[Expression]
Sets the rate of change, in radians per second, of
this
joint’s angle θ (see class documentation) totheta_dot
. The new rate of change gets stored incontext
.- Parameter
context
: The context of the model this joint belongs to.
- Parameter
theta_dot
: The desired rates of change of
this
joint’s angle in radians per second.
- Returns
a constant reference to
this
joint.
- Parameter
- set_default_rotation(self: pydrake.multibody.tree.ScrewJoint_[Expression], theta: float) None
Sets the default angle of this joint. This will change the
default_translation
too, because they are not independent in this joint.- Parameter
theta
: The desired default angle of the joint
- Parameter
- set_default_translation(self: pydrake.multibody.tree.ScrewJoint_[Expression], z: float) None
Sets the default translation of this joint. This will change the
default_rotation
too, which are not independent in this joint.- Parameter
z
: The desired default translation of the joint
- Raises
RuntimeError if pitch is very near zero. –
- Parameter
- set_random_pose_distribution(self: pydrake.multibody.tree.ScrewJoint_[Expression], theta: numpy.ndarray[object[1, 1]]) None
Sets the random distribution that the angle of this joint will be randomly sampled from. See class documentation for details on the definition of the position and angle.
- set_translation(self: pydrake.multibody.tree.ScrewJoint_[Expression], context: pydrake.systems.framework.Context_[Expression], translation: pydrake.symbolic.Expression) pydrake.multibody.tree.ScrewJoint_[Expression]
Sets the
context
so that the translation ofthis
joint equals to (z).- Parameter
context
: The context of the model this joint belongs to.
- Parameter
z
: The desired translation in meters to be stored in
context
as (z). See class documentation for details.
- Returns
a constant reference to
this
joint.
- Parameter
- set_translational_velocity(self: pydrake.multibody.tree.ScrewJoint_[Expression], context: pydrake.systems.framework.Context_[Expression], translation_dot: pydrake.symbolic.Expression) pydrake.multibody.tree.ScrewJoint_[Expression]
Sets the translational velocity, in meters per second, of this
this
joint’s Mo along frame F’s â-axis tovz
. The new translational velocity gets stored incontext
.- Parameter
context
: The context of the model this joint belongs to.
- Parameter
vz
: The desired translational velocity of
this
joint in meters per second along F frame’s â-axis.
- Returns
a constant reference to
this
joint.
- Parameter
- SetDamping(self: pydrake.multibody.tree.ScrewJoint_[Expression], context: pydrake.systems.framework.Context_[Expression], damping: pydrake.symbolic.Expression) None
Sets the value of the viscous damping coefficient for this joint, stored as a parameter in
context
. Refer to default_damping() for details.- Parameter
context
: The context storing the state and parameters for the model to which
this
joint belongs.- Parameter
damping
: The damping value.
- Raises
RuntimeError if damping is negative. –
- Parameter
- class pydrake.multibody.tree.SpatialInertia
This class represents the physical concept of a Spatial Inertia. A spatial inertia (or spatial mass matrix) encapsulates the mass, center of mass, and rotational inertia of the mass distribution of a body or composite body S, where with “composite body” we mean a collection of bodies welded together containing at least one body (throughout this documentation “body” is many times used instead of “composite body” but the same concepts apply to a collection of bodies as well.) A spatial inertia is an element of ℝ⁶ˣ⁶ that is symmetric, and positive semi-definite. It logically consists of
3x3
sub-matrices arranged like so, [Jain 2010]:Click to expand C++ code...
Spatial mass matrix ------------ ------------ 0 | | | 1 | I_SP | m p_PScm× | 2 | | | ------------ ------------ 3 | | | 4 | -m p_PScm× | m Id | 5 | | | ------------ ------------ Symbol: M
where, with the monogram notation described in multibody_spatial_inertia,
I_SP
is the rotational inertia of body or composite body S computed about a point P, m is the mass of this composite body,p_PScm
is the position vector from point P to the center of massScm
of the composite body S withp_PScm×
denoting its skew-symmetric cross product matrix (defined such thata× b = a.cross(b)
), andId
is the identity matrix in ℝ³ˣ³. See Section 2.1, p. 17 of [Jain 2010]. The logical arrangement as shown above is chosen to be consistent with our logical arrangement for spatial vectors as documented in multibody_spatial_algebra for which the rotational component comes first followed by the translational component.In typeset material we use the symbol \([M^{S/P}]_E\) to represent the spatial inertia of a body or composite body S about point P, expressed in frame E. For this inertia, the monogram notation reads
M_SP_E
. If the point P is fixed to a body B, we write that point as \(B_P\) which appears in code and comments asBp
. So if the body or composite body is B and the about point isBp
, the monogram notation readsM_BBp_E
, which can be abbreviated toM_Bp_E
since the about pointBp
also identifies the body. Common cases are that the about point is the originBo
of the body, or it’s the center of massBcm
for which the rotational inertia in monogram notation would read asI_Bo_E
andI_Bcm_E
, respectively. GivenM_BP_E
(\([M^{B/P}]_E\)), the rotational inertia of this spatial inertia isI_BP_E
(\([I^{B/P}]_E\)) and the position vector of the center of mass measured from point P and expressed in E isp_PBcm_E
(\([^Pp^{B_{cm}}]_E\)).Note
This class does not implement any mechanism to track the frame E in which a spatial inertia is expressed or about what point is computed. Methods and operators on this class have no means to determine frame consistency through operations. It is therefore the responsibility of users of this class to keep track of frames in which operations are performed. We suggest doing that using disciplined notation, as described above.
Note
Several methods in this class throw a RuntimeError for invalid rotational inertia operations in debug releases only. This provides speed in a release build while facilitating debugging in debug builds. In addition, these validity tests are only performed for scalar types for which drake::scalar_predicate<T>::is_bool is
True
. For instance, validity checks are not performed when T is symbolic::Expression.Note
The methods of this class satisfy the “basic exception guarantee”: if an exception is thrown, the program will still be in a valid state. Specifically, no resources are leaked, and all objects’ invariants are intact. Be aware that SpatialInertia objects may contain invalid inertia data in cases where input checking is skipped.
See also
To create a spatial inertia of a mesh, see CalcSpatialInertia(const geometry::TriangleSurfaceMesh<double>& mesh, double density).
See also
To create spatial inertia from most of geometry::Shape, see CalcSpatialInertia(const geometry::Shape& shape, double density).
See also
To create spatial inertia for a set of bodies, see MultibodyPlant::CalcSpatialInertia().
- [Jain 2010] Jain, A., 2010. Robot and multibody dynamics: analysis and
algorithms. Springer Science & Business Media.
Note
This class is templated; see
SpatialInertia_
for the list of instantiations.- __init__(self: pydrake.multibody.tree.SpatialInertia, mass: float, p_PScm_E: numpy.ndarray[numpy.float64[3, 1]], G_SP_E: pydrake.multibody.tree.UnitInertia, skip_validity_check: bool = False) None
Constructs a spatial inertia for a physical body or composite body S about a point P from a given mass, center of mass and rotational inertia. The center of mass is specified by the position vector
p_PScm_E
from point P to the center of mass pointScm
, expressed in a frame E. The rotational inertia is provided as the UnitInertiaG_SP_E
of the body or composite body S computed about point P and expressed in frame E.Note
The third argument of this constructor is unusual in that it is an UnitInertia (not a traditional RotationalInertia) and its inertia is about the arbitrary point P (not Scm – S’s center of mass).
See also
MakeFromCentralInertia a factory method with traditional utility.
This constructor checks for the physical validity of the resulting SpatialInertia with IsPhysicallyValid() and throws a RuntimeError exception in the event the provided input parameters lead to non-physically viable spatial inertia. Since this check has non-negligable runtime costs, it can be disabled by setting the optional argument
skip_validity_check
toTrue
.- Parameter
mass
: The mass of the body or composite body S.
- Parameter
p_PScm_E
: The position vector from point P to the center of mass of body or composite body S expressed in frame E.
- Parameter
G_SP_E
: UnitInertia of the body or composite body S computed about origin point P and expressed in frame E.
- Parameter
skip_validity_check
: If true, skips the validity check described above. Defaults to false.
- Parameter
- CalcComMoment(self: pydrake.multibody.tree.SpatialInertia) numpy.ndarray[numpy.float64[3, 1]]
Computes the center of mass moment vector
mass * p_PScm_E
given the position vectorp_PScm_E
from the about point P to the center of massScm
of the body or composite body S, expressed in frame E. See the documentation of this class for details.
- CalcPrincipalSemiDiametersAndPoseForSolidEllipsoid(self: pydrake.multibody.tree.SpatialInertia) tuple[numpy.ndarray[numpy.float64[3, 1]], pydrake.math.RigidTransform]
Returns 3 principal semi-diameters [lmax lmed lmin] sorted in descending order (lmax ≥ lmed ≥ lmin), orientation, and position of a solid ellipsoid whose spatial inertia is equal to
this
spatial inertia. See spatial_inertia_equivalent_shapes “Spatial inertia equivalent shapes” for more details.- Raises
RuntimeError if the elements of this spatial inertia cannot be –
converted to a real finite double. For example, an exception is –
thrown if this contains an erroneous NaN or if scalar type T –
is symbolic. –
- CalcRotationalInertia(self: pydrake.multibody.tree.SpatialInertia) pydrake.multibody.tree.RotationalInertia
Computes the rotational inertia
I_SP_E = mass * G_SP_E
of this spatial inertia, computed about point P and expressed in frame E. See the documentation of this class for details.
- CopyToFullMatrix6(self: pydrake.multibody.tree.SpatialInertia) numpy.ndarray[numpy.float64[6, 6]]
Copy to a full 6x6 matrix representation.
- get_com(self: pydrake.multibody.tree.SpatialInertia) numpy.ndarray[numpy.float64[3, 1]]
Get a constant reference to the position vector
p_PScm_E
from the about point P to the center of massScm
of the body or composite body S, expressed in frame E. See the documentation of this class for details.
- get_mass(self: pydrake.multibody.tree.SpatialInertia) float
Get a constant reference to the mass of this spatial inertia.
- get_unit_inertia(self: pydrake.multibody.tree.SpatialInertia) pydrake.multibody.tree.UnitInertia
Get a constant reference to the unit inertia
G_SP_E
of this spatial inertia, computed about point P and expressed in frame E. See the documentation of this class for details.
- static HollowSphereWithDensity(area_density: float, radius: float) pydrake.multibody.tree.SpatialInertia
Creates a spatial inertia for a uniform density thin hollow sphere B about its geometric center Bo (which is coincident with B’s center of mass Bcm).
- Parameter
area_density
: mass per unit area (kg/m²).
- Parameter
radius
: sphere’s radius in meters (the hollow sphere is regarded as an infinitesimally thin shell of uniform density).
- Returns
M_BBo_B
: B’s spatial inertia about Bo, expressed in B. Since B’s rotational inertia is triaxially symmetric, M_BBo_B = M_BBo_E, i.e., M_BBo expressed in frame B is equal to M_BBo expressed in an arbitrary frame E.
Note
B’s rotational inertia about Bo is triaxially symmetric, meaning B has an equal moment of inertia about any line passing through Bo.
- Raises
RuntimeError if area_density or radius is not positive and finite. –
- Parameter
- static HollowSphereWithMass(mass: float, radius: float) pydrake.multibody.tree.SpatialInertia
Creates a spatial inertia for a uniform density hollow sphere B about its geometric center Bo (which is coincident with B’s center of mass Bcm).
- Parameter
mass
: mass of the hollow sphere (kg).
- Parameter
radius
: sphere’s radius in meters (the hollow sphere is regarded as an infinitesimally thin shell of uniform density).
- Returns
M_BBo
: B’s spatial inertia about Bo. Since B’s rotational inertia is triaxially symmetric, M_BBo_B = M_BBo_E, i.e., M_BBo expressed in frame B is equal to M_BBo expressed in an arbitrary frame E.
Note
B’s rotational inertia about Bo is triaxially symmetric, meaning B has an equal moment of inertia about any line passing through Bo.
- Raises
RuntimeError if mass or radius is not positive and finite. –
- Parameter
- IsNaN(self: pydrake.multibody.tree.SpatialInertia) bool
Returns
True
if any of the elements in this spatial inertia is NaN andFalse
otherwise.
- IsPhysicallyValid(self: pydrake.multibody.tree.SpatialInertia) bool
Performs a number of checks to verify that this is a physically valid spatial inertia. The checks performed are:
No NaN entries.
Non-negative mass.
Non-negative principal moments about the center of mass.
Principal moments about the center of mass must satisfy the triangle inequality: -
Ixx + Iyy >= Izz
- Ixx + Izz >= Iyy -Iyy + Izz >= Ixx
These are the tests performed by RotationalInertia::CouldBePhysicallyValid() which become a sufficient condition when performed on a rotational inertia about a body’s center of mass.
See also
RotationalInertia::CouldBePhysicallyValid().
- IsZero(self: pydrake.multibody.tree.SpatialInertia) bool
Returns
True
if all of the elements in this spatial inertia are zero andFalse
otherwise.
- static MakeFromCentralInertia(mass: float, p_PScm_E: numpy.ndarray[numpy.float64[3, 1]], I_SScm_E: pydrake.multibody.tree.RotationalInertia) pydrake.multibody.tree.SpatialInertia
Creates a spatial inertia for a physical body or composite body S about a point P from a given mass, center of mass, and central rotational inertia. For example, this method creates a body’s SpatialInertia about its body origin Bo from the body’s mass, position vector from Bo to the body’s center of mass, and rotational inertia about the body’s center of mass.
This method checks for the physical validity of the resulting SpatialInertia with IsPhysicallyValid() and throws a RuntimeError exception in the event the provided input parameters lead to a non-physically viable spatial inertia.
- Parameter
mass
: The mass of the body or composite body S.
- Parameter
p_PScm_E
: The position vector from point P to point
Scm
(S’s center of mass), expressed in a frame E.- Parameter
I_SScm_E
: S’s RotationalInertia about Scm, expressed in frame E.
- Returns
M_SP_E
: S’s spatial inertia about point P, expressed in frame E.
- Parameter
- static NaN() pydrake.multibody.tree.SpatialInertia
Initializes mass, center of mass and rotational inertia to invalid NaN’s for a quick detection of uninitialized values.
- ReExpress(self: pydrake.multibody.tree.SpatialInertia, R_AE: pydrake.math.RotationMatrix) pydrake.multibody.tree.SpatialInertia
Given
this
spatial inertiaM_SP_E
for some body or composite body S, taken about a point P and expressed in frame E, this method computes the same inertia re-expressed in another frame A.- Parameter
R_AE
: RotationMatrix relating frames A and E.
- Returns
M_SP_A
: The same spatial inertia of S about P but now re-expressed in frame A.
See also
ReExpressInPlace() for details.
- Parameter
- SetNaN(self: pydrake.multibody.tree.SpatialInertia) None
Sets
this
spatial inertia to have NaN entries. Typically used for quick detection of uninitialized values.
- Shift(self: pydrake.multibody.tree.SpatialInertia, p_PQ_E: numpy.ndarray[numpy.float64[3, 1]]) pydrake.multibody.tree.SpatialInertia
Given
this
spatial inertiaM_SP_E
for some body or composite body S, computed about point P, and expressed in frame E, this method uses the Parallel Axis Theorem for spatial inertias to compute the same spatial inertia about a new point Q. The result still is expressed in frame E.See also
ShiftInPlace() for more details.
- Parameter
p_PQ_E
: Vector from the original about point P to the new about point Q, expressed in the same frame E
this
spatial inertia is expressed in.- Returns
M_SQ_E
: This same spatial inertia for body or composite body S but computed about a new point Q.
- Parameter
- static SolidBoxWithDensity(density: float, lx: float, ly: float, lz: float) pydrake.multibody.tree.SpatialInertia
Creates a spatial inertia for a uniform density solid box B about its geometric center Bo (which is coincident with B’s center of mass Bcm).
- Parameter
density
: mass per volume (kg/m³).
- Parameter
lx
: length of the box in the Bx direction (meters).
- Parameter
ly
: length of the box in the By direction (meters).
- Parameter
lz
: length of the box in the Bz direction (meters).
- Returns
M_BBo_B
: B’s spatial inertia about Bo, expressed in B.
- Raises
RuntimeError if density, lx, ly, or lz is not positive and finite. –
- Parameter
- static SolidBoxWithMass(mass: float, lx: float, ly: float, lz: float) pydrake.multibody.tree.SpatialInertia
Creates a spatial inertia for a uniform density solid box B about its geometric center Bo (which is coincident with B’s center of mass Bcm).
- Parameter
mass
: mass of the solid box (kg).
- Parameter
lx
: length of the box in the Bx direction (meters).
- Parameter
ly
: length of the box in the By direction (meters).
- Parameter
lz
: length of the box in the Bz direction (meters).
- Returns
M_BBo_B
: B’s spatial inertia about Bo, expressed in B.
- Raises
RuntimeError if mass, lx, ly, or lz is not positive and finite. –
- Parameter
- static SolidCapsuleWithDensity(density: float, radius: float, length: float, unit_vector: numpy.ndarray[numpy.float64[3, 1]]) pydrake.multibody.tree.SpatialInertia
Creates a spatial inertia for a uniform density solid capsule B about its geometric center Bo (which is coincident with B’s center of mass Bcm).
- Parameter
density
: mass per volume (kg/m³).
- Parameter
radius
: radius of the cylinder/half-sphere parts of the capsule.
- Parameter
length
: length of the cylindrical part of the capsule.
- Parameter
unit_vector
: unit vector defining the axial direction of the cylindrical part of the capsule, expressed in B.
- Returns
M_BBo_B
: B’s spatial inertia about Bo, expressed in B.
Note
B’s rotational inertia about Bo is axially symmetric, meaning B has an equal moment of inertia about any line that both passes through Bo and is perpendicular to unit_vector.
- Raises
RuntimeError if density, radius, or length is not positive and –
finite or if ‖unit_vector‖ is not within 1.0E-14 of 1.0. –
- Parameter
- static SolidCapsuleWithMass(mass: float, radius: float, length: float, unit_vector: numpy.ndarray[numpy.float64[3, 1]]) pydrake.multibody.tree.SpatialInertia
Creates a spatial inertia for a uniform density solid capsule B about its geometric center Bo (which is coincident with B’s center of mass Bcm).
- Parameter
mass
: mass of the solid capsule (kg).
- Parameter
radius
: radius of the cylinder/half-sphere parts of the capsule.
- Parameter
length
: length of the cylindrical part of the capsule.
- Parameter
unit_vector
: unit vector defining the axial direction of the cylindrical part of the capsule, expressed in B.
- Returns
M_BBo_B
: B’s spatial inertia about Bo, expressed in B.
Note
B’s rotational inertia about Bo is axially symmetric, meaning B has an equal moment of inertia about any line that both passes through Bo and is perpendicular to unit_vector.
- Raises
RuntimeError if mass, radius, or length is not positive and finite –
or if ‖unit_vector‖ is not within 1.0E-14 of 1.0. –
- Parameter
- static SolidCubeWithDensity(density: float, length: float) pydrake.multibody.tree.SpatialInertia
Creates a spatial inertia for a uniform density solid cube B about its geometric center Bo (which is coincident with B’s center of mass Bcm).
- Parameter
density
: mass per volume (kg/m³).
- Parameter
length
: The length of each of the cube’s sides (meters).
- Returns
M_BBo_B
: B’s spatial inertia about Bo, expressed in B. Since B’s rotational inertia is triaxially symmetric, M_BBo_B = M_BBo_E, i.e., M_BBo expressed in frame B is equal to M_BBo expressed in an arbitrary frame E.
Note
B’s rotational inertia about Bo is triaxially symmetric, meaning B has an equal moment of inertia about any line passing through Bo.
- Raises
RuntimeError if density or length is not positive and finite. –
- Parameter
- static SolidCylinderWithDensity(density: float, radius: float, length: float, unit_vector: numpy.ndarray[numpy.float64[3, 1]]) pydrake.multibody.tree.SpatialInertia
Creates a spatial inertia for a uniform density solid cylinder B about its geometric center Bo (which is coincident with B’s center of mass Bcm).
- Parameter
density
: mass per volume (kg/m³).
- Parameter
radius
: radius of the cylinder (meters).
- Parameter
length
: length of cylinder in unit_vector direction (meters).
- Parameter
unit_vector
: unit vector defining the axial direction of the cylinder, expressed in B.
- Returns
M_BBo_B
: B’s spatial inertia about Bo, expressed in B.
Note
B’s rotational inertia about Bo is axially symmetric, meaning B has an equal moment of inertia about any line that both passes through Bo and is perpendicular to unit_vector.
- Raises
RuntimeError if density, radius, or length is not positive and –
finite or if ‖unit_vector‖ is not within 1.0E-14 of 1.0. –
See also
SolidCylinderWithDensityAboutEnd() to calculate M_BBp_B, B’s spatial inertia about Bp (at the center of one of the cylinder’s circular ends).
- Parameter
- static SolidCylinderWithDensityAboutEnd(density: float, radius: float, length: float, unit_vector: numpy.ndarray[numpy.float64[3, 1]]) pydrake.multibody.tree.SpatialInertia
Creates a spatial inertia for a uniform-density solid cylinder B about an end-point Bp of the cylinder’s axis (see below for more about Bp).
- Parameter
density
: mass per volume (kg/m³).
- Parameter
radius
: radius of cylinder (meters).
- Parameter
length
: length of cylinder in unit_vector direction (meters).
- Parameter
unit_vector
: unit vector parallel to the axis of the cylinder and directed from Bp to Bcm (B’s center of mass), expressed in B.
- Returns
M_BBp_B
: B’s spatial inertia about Bp, expressed in B.
Note
The position from Bp to Bcm is p_BpBcm = length / 2 * unit_vector.
Note
B’s rotational inertia about Bp is axially symmetric, meaning B has an equal moment of inertia about any line that both passes through Bp and is perpendicular to unit_vector.
- Raises
RuntimeError if density, radius, or length is not positive and –
finite or if ‖unit_vector‖ is not within 1.0E-14 of 1.0. –
See also
SolidCylinderWithDensity() to calculate M_BBcm_B, B’s spatial inertia about Bcm (B’s center of mass).
- Parameter
- static SolidCylinderWithMass(mass: float, radius: float, length: float, unit_vector: numpy.ndarray[numpy.float64[3, 1]]) pydrake.multibody.tree.SpatialInertia
Creates a spatial inertia for a uniform density solid cylinder B about its geometric center Bo (which is coincident with B’s center of mass Bcm).
- Parameter
mass
: mass of the solid cylinder (kg).
- Parameter
radius
: radius of the cylinder (meters).
- Parameter
length
: length of cylinder in unit_vector direction (meters).
- Parameter
unit_vector
: unit vector defining the axial direction of the cylinder, expressed in B.
- Returns
M_BBo_B
: B’s spatial inertia about Bo, expressed in B.
Note
B’s rotational inertia about Bo is axially symmetric, meaning B has an equal moment of inertia about any line that both passes through Bo and is perpendicular to unit_vector.
- Raises
RuntimeError if mass, radius, or length is not positive and finite –
or if ‖unit_vector‖ is not within 1.0E-14 of 1.0. –
See also
SolidCylinderWithMassAboutEnd() to calculate M_BBp_B, B’s spatial inertia about Bp (at the center of one of the cylinder’s circular ends).
- Parameter
- static SolidCylinderWithMassAboutEnd(mass: float, radius: float, length: float, unit_vector: numpy.ndarray[numpy.float64[3, 1]]) pydrake.multibody.tree.SpatialInertia
Creates a spatial inertia for a uniform-density solid cylinder B about an end-point Bp of the cylinder’s axis (see below for more about Bp).
- Parameter
mass
: mass of the solid cylinder (kg).
- Parameter
radius
: radius of cylinder (meters).
- Parameter
length
: length of cylinder in unit_vector direction (meters).
- Parameter
unit_vector
: unit vector parallel to the axis of the cylinder and directed from Bp to Bcm (B’s center of mass), expressed in B.
- Returns
M_BBp_B
: B’s spatial inertia about Bp, expressed in B.
Note
The position from Bp to Bcm is p_BpBcm = length / 2 * unit_vector.
Note
B’s rotational inertia about Bp is axially symmetric, meaning B has an equal moment of inertia about any line that both passes through Bp and is perpendicular to unit_vector.
- Raises
RuntimeError if density, radius, or length is not positive and –
finite or if ‖unit_vector‖ is not within 1.0E-14 of 1.0. –
See also
SolidCylinderWithMass() to calculate M_BBcm_B, B’s spatial inertia about Bcm (B’s center of mass).
- Parameter
- static SolidEllipsoidWithDensity(density: float, a: float, b: float, c: float) pydrake.multibody.tree.SpatialInertia
Creates a spatial inertia for a uniform density solid ellipsoid B about its geometric center Bo (which is coincident with B’s center of mass Bcm).
- Parameter
density
: mass per volume (kg/m³).
- Parameter
a
: length of ellipsoid semi-axis in the ellipsoid Bx direction.
- Parameter
b
: length of ellipsoid semi-axis in the ellipsoid By direction.
- Parameter
c
: length of ellipsoid semi-axis in the ellipsoid Bz direction.
- Returns
M_BBo_B
: B’s spatial inertia about Bo, expressed in B.
- Raises
RuntimeError if density, a, b, or c is not positive and finite. –
- Parameter
- static SolidEllipsoidWithMass(mass: float, a: float, b: float, c: float) pydrake.multibody.tree.SpatialInertia
Creates a spatial inertia for a uniform density solid ellipsoid B about its geometric center Bo (which is coincident with B’s center of mass Bcm).
- Parameter
mass
: mass of the solid ellipsoid (kg).
- Parameter
a
: length of ellipsoid semi-axis in the ellipsoid Bx direction.
- Parameter
b
: length of ellipsoid semi-axis in the ellipsoid By direction.
- Parameter
c
: length of ellipsoid semi-axis in the ellipsoid Bz direction.
- Returns
M_BBo_B
: B’s spatial inertia about Bo, expressed in B.
- Raises
RuntimeError if mass, a, b, or c is not positive and finite. –
- Parameter
- static SolidSphereWithDensity(density: float, radius: float) pydrake.multibody.tree.SpatialInertia
Creates a spatial inertia for a uniform density solid sphere B about its geometric center Bo (which is coincident with B’s center of mass Bcm).
- Parameter
density
: mass per volume (kg/m³).
- Parameter
radius
: sphere’s radius (meters).
- Returns
M_BBo
: B’s spatial inertia about Bo. Since B’s rotational inertia is triaxially symmetric, M_BBo_B = M_BBo_E, i.e., M_BBo expressed in frame B is equal to M_BBo expressed in an arbitrary frame E.
Note
B’s rotational inertia about Bo is triaxially symmetric, meaning B has an equal moment of inertia about any line passing through Bo.
- Raises
RuntimeError if density or radius is not positive and finite. –
- Parameter
- static SolidSphereWithMass(mass: float, radius: float) pydrake.multibody.tree.SpatialInertia
Creates a spatial inertia for a uniform density solid sphere B about its geometric center Bo (which is coincident with B’s center of mass Bcm).
- Parameter
mass
: mass of the solid sphere (kg).
- Parameter
radius
: sphere’s radius (meters).
- Returns
M_BBo
: B’s spatial inertia about Bo. Since B’s rotational inertia is triaxially symmetric, M_BBo_B = M_BBo_E, i.e., M_BBo expressed in frame B is equal to M_BBo expressed in an arbitrary frame E.
Note
B’s rotational inertia about Bo is triaxially symmetric, meaning B has an equal moment of inertia about any line passing through Bo.
- Raises
RuntimeError if mass or radius is not positive and finite. –
- Parameter
- static ThinRodWithMass(mass: float, length: float, unit_vector: numpy.ndarray[numpy.float64[3, 1]]) pydrake.multibody.tree.SpatialInertia
Creates a spatial inertia for a uniform-density thin rod B about its center of mass Bcm.
- Parameter
mass
: mass of the rod (units of kg).
- Parameter
length
: length of the rod (units of meters).
- Parameter
unit_vector
: unit vector defining the rod’s axial direction, expressed in B.
- Returns
M_BBcm_B
: B’s spatial inertia about Bcm, expressed in B.
Note
B’s rotational inertia about Bcm is axially symmetric, meaning B has an equal moment of inertia about any line that both passes through Bcm and is perpendicular to unit_vector. B has no (zero) rotational inertia about the line that passes through Bcm and is parallel to unit_vector.
- Raises
RuntimeError if mass or length is not positive and finite or if –
‖unit_vector‖ is not within 1.0E-14 of 1.0. –
See also
ThinRodWithMassAboutEnd() to calculate M_BBp_B, B’s spatial inertia about Bp (one of the ends of rod B).
- Parameter
- static ThinRodWithMassAboutEnd(mass: float, length: float, unit_vector: numpy.ndarray[numpy.float64[3, 1]]) pydrake.multibody.tree.SpatialInertia
Creates a spatial inertia for a uniform-density thin rod B about one of its ends.
- Parameter
mass
: mass of the rod (units of kg).
- Parameter
length
: length of the rod (units of meters).
- Parameter
unit_vector
: unit vector defining the rod’s axial direction, expressed in B.
- Returns
M_BBp_B
: B’s spatial inertia about Bp, expressed in B.
Note
The position from Bp to Bcm is length / 2 * unit_vector.
Note
B’s rotational inertia about Bp is axially symmetric, meaning B has an equal moment of inertia about any line that both passes through Bp and is perpendicular to unit_vector. B has no (zero) rotational inertia about the line that passes through Bp and is parallel to unit_vector.
- Raises
RuntimeError if mass or length is not positive and finite or if –
‖unit_vector‖ is not within 1.0E-14 of 1.0. –
See also
ThinRodWithMass() to calculate M_BBcm_B, B’s spatial inertia about Bcm (B’s center of mass).
- Parameter
- static Zero() pydrake.multibody.tree.SpatialInertia
Initializes mass, center of mass and rotational inertia to zero.
- template pydrake.multibody.tree.SpatialInertia_
Instantiations:
SpatialInertia_[float]
,SpatialInertia_[AutoDiffXd]
,SpatialInertia_[Expression]
- class pydrake.multibody.tree.SpatialInertia_[AutoDiffXd]
This class represents the physical concept of a Spatial Inertia. A spatial inertia (or spatial mass matrix) encapsulates the mass, center of mass, and rotational inertia of the mass distribution of a body or composite body S, where with “composite body” we mean a collection of bodies welded together containing at least one body (throughout this documentation “body” is many times used instead of “composite body” but the same concepts apply to a collection of bodies as well.) A spatial inertia is an element of ℝ⁶ˣ⁶ that is symmetric, and positive semi-definite. It logically consists of
3x3
sub-matrices arranged like so, [Jain 2010]:Click to expand C++ code...
Spatial mass matrix ------------ ------------ 0 | | | 1 | I_SP | m p_PScm× | 2 | | | ------------ ------------ 3 | | | 4 | -m p_PScm× | m Id | 5 | | | ------------ ------------ Symbol: M
where, with the monogram notation described in multibody_spatial_inertia,
I_SP
is the rotational inertia of body or composite body S computed about a point P, m is the mass of this composite body,p_PScm
is the position vector from point P to the center of massScm
of the composite body S withp_PScm×
denoting its skew-symmetric cross product matrix (defined such thata× b = a.cross(b)
), andId
is the identity matrix in ℝ³ˣ³. See Section 2.1, p. 17 of [Jain 2010]. The logical arrangement as shown above is chosen to be consistent with our logical arrangement for spatial vectors as documented in multibody_spatial_algebra for which the rotational component comes first followed by the translational component.In typeset material we use the symbol \([M^{S/P}]_E\) to represent the spatial inertia of a body or composite body S about point P, expressed in frame E. For this inertia, the monogram notation reads
M_SP_E
. If the point P is fixed to a body B, we write that point as \(B_P\) which appears in code and comments asBp
. So if the body or composite body is B and the about point isBp
, the monogram notation readsM_BBp_E
, which can be abbreviated toM_Bp_E
since the about pointBp
also identifies the body. Common cases are that the about point is the originBo
of the body, or it’s the center of massBcm
for which the rotational inertia in monogram notation would read asI_Bo_E
andI_Bcm_E
, respectively. GivenM_BP_E
(\([M^{B/P}]_E\)), the rotational inertia of this spatial inertia isI_BP_E
(\([I^{B/P}]_E\)) and the position vector of the center of mass measured from point P and expressed in E isp_PBcm_E
(\([^Pp^{B_{cm}}]_E\)).Note
This class does not implement any mechanism to track the frame E in which a spatial inertia is expressed or about what point is computed. Methods and operators on this class have no means to determine frame consistency through operations. It is therefore the responsibility of users of this class to keep track of frames in which operations are performed. We suggest doing that using disciplined notation, as described above.
Note
Several methods in this class throw a RuntimeError for invalid rotational inertia operations in debug releases only. This provides speed in a release build while facilitating debugging in debug builds. In addition, these validity tests are only performed for scalar types for which drake::scalar_predicate<T>::is_bool is
True
. For instance, validity checks are not performed when T is symbolic::Expression.Note
The methods of this class satisfy the “basic exception guarantee”: if an exception is thrown, the program will still be in a valid state. Specifically, no resources are leaked, and all objects’ invariants are intact. Be aware that SpatialInertia objects may contain invalid inertia data in cases where input checking is skipped.
See also
To create a spatial inertia of a mesh, see CalcSpatialInertia(const geometry::TriangleSurfaceMesh<double>& mesh, double density).
See also
To create spatial inertia from most of geometry::Shape, see CalcSpatialInertia(const geometry::Shape& shape, double density).
See also
To create spatial inertia for a set of bodies, see MultibodyPlant::CalcSpatialInertia().
- [Jain 2010] Jain, A., 2010. Robot and multibody dynamics: analysis and
algorithms. Springer Science & Business Media.
- __init__(self: pydrake.multibody.tree.SpatialInertia_[AutoDiffXd], mass: pydrake.autodiffutils.AutoDiffXd, p_PScm_E: numpy.ndarray[object[3, 1]], G_SP_E: pydrake.multibody.tree.UnitInertia_[AutoDiffXd], skip_validity_check: bool = False) None
Constructs a spatial inertia for a physical body or composite body S about a point P from a given mass, center of mass and rotational inertia. The center of mass is specified by the position vector
p_PScm_E
from point P to the center of mass pointScm
, expressed in a frame E. The rotational inertia is provided as the UnitInertiaG_SP_E
of the body or composite body S computed about point P and expressed in frame E.Note
The third argument of this constructor is unusual in that it is an UnitInertia (not a traditional RotationalInertia) and its inertia is about the arbitrary point P (not Scm – S’s center of mass).
See also
MakeFromCentralInertia a factory method with traditional utility.
This constructor checks for the physical validity of the resulting SpatialInertia with IsPhysicallyValid() and throws a RuntimeError exception in the event the provided input parameters lead to non-physically viable spatial inertia. Since this check has non-negligable runtime costs, it can be disabled by setting the optional argument
skip_validity_check
toTrue
.- Parameter
mass
: The mass of the body or composite body S.
- Parameter
p_PScm_E
: The position vector from point P to the center of mass of body or composite body S expressed in frame E.
- Parameter
G_SP_E
: UnitInertia of the body or composite body S computed about origin point P and expressed in frame E.
- Parameter
skip_validity_check
: If true, skips the validity check described above. Defaults to false.
- Parameter
- CalcComMoment(self: pydrake.multibody.tree.SpatialInertia_[AutoDiffXd]) numpy.ndarray[object[3, 1]]
Computes the center of mass moment vector
mass * p_PScm_E
given the position vectorp_PScm_E
from the about point P to the center of massScm
of the body or composite body S, expressed in frame E. See the documentation of this class for details.
- CalcPrincipalSemiDiametersAndPoseForSolidEllipsoid(self: pydrake.multibody.tree.SpatialInertia_[AutoDiffXd]) tuple[numpy.ndarray[numpy.float64[3, 1]], pydrake.math.RigidTransform]
Returns 3 principal semi-diameters [lmax lmed lmin] sorted in descending order (lmax ≥ lmed ≥ lmin), orientation, and position of a solid ellipsoid whose spatial inertia is equal to
this
spatial inertia. See spatial_inertia_equivalent_shapes “Spatial inertia equivalent shapes” for more details.- Raises
RuntimeError if the elements of this spatial inertia cannot be –
converted to a real finite double. For example, an exception is –
thrown if this contains an erroneous NaN or if scalar type T –
is symbolic. –
- CalcRotationalInertia(self: pydrake.multibody.tree.SpatialInertia_[AutoDiffXd]) pydrake.multibody.tree.RotationalInertia_[AutoDiffXd]
Computes the rotational inertia
I_SP_E = mass * G_SP_E
of this spatial inertia, computed about point P and expressed in frame E. See the documentation of this class for details.
- CopyToFullMatrix6(self: pydrake.multibody.tree.SpatialInertia_[AutoDiffXd]) numpy.ndarray[object[6, 6]]
Copy to a full 6x6 matrix representation.
- get_com(self: pydrake.multibody.tree.SpatialInertia_[AutoDiffXd]) numpy.ndarray[object[3, 1]]
Get a constant reference to the position vector
p_PScm_E
from the about point P to the center of massScm
of the body or composite body S, expressed in frame E. See the documentation of this class for details.
- get_mass(self: pydrake.multibody.tree.SpatialInertia_[AutoDiffXd]) pydrake.autodiffutils.AutoDiffXd
Get a constant reference to the mass of this spatial inertia.
- get_unit_inertia(self: pydrake.multibody.tree.SpatialInertia_[AutoDiffXd]) pydrake.multibody.tree.UnitInertia_[AutoDiffXd]
Get a constant reference to the unit inertia
G_SP_E
of this spatial inertia, computed about point P and expressed in frame E. See the documentation of this class for details.
- static HollowSphereWithDensity(area_density: pydrake.autodiffutils.AutoDiffXd, radius: pydrake.autodiffutils.AutoDiffXd) pydrake.multibody.tree.SpatialInertia_[AutoDiffXd]
Creates a spatial inertia for a uniform density thin hollow sphere B about its geometric center Bo (which is coincident with B’s center of mass Bcm).
- Parameter
area_density
: mass per unit area (kg/m²).
- Parameter
radius
: sphere’s radius in meters (the hollow sphere is regarded as an infinitesimally thin shell of uniform density).
- Returns
M_BBo_B
: B’s spatial inertia about Bo, expressed in B. Since B’s rotational inertia is triaxially symmetric, M_BBo_B = M_BBo_E, i.e., M_BBo expressed in frame B is equal to M_BBo expressed in an arbitrary frame E.
Note
B’s rotational inertia about Bo is triaxially symmetric, meaning B has an equal moment of inertia about any line passing through Bo.
- Raises
RuntimeError if area_density or radius is not positive and finite. –
- Parameter
- static HollowSphereWithMass(mass: pydrake.autodiffutils.AutoDiffXd, radius: pydrake.autodiffutils.AutoDiffXd) pydrake.multibody.tree.SpatialInertia_[AutoDiffXd]
Creates a spatial inertia for a uniform density hollow sphere B about its geometric center Bo (which is coincident with B’s center of mass Bcm).
- Parameter
mass
: mass of the hollow sphere (kg).
- Parameter
radius
: sphere’s radius in meters (the hollow sphere is regarded as an infinitesimally thin shell of uniform density).
- Returns
M_BBo
: B’s spatial inertia about Bo. Since B’s rotational inertia is triaxially symmetric, M_BBo_B = M_BBo_E, i.e., M_BBo expressed in frame B is equal to M_BBo expressed in an arbitrary frame E.
Note
B’s rotational inertia about Bo is triaxially symmetric, meaning B has an equal moment of inertia about any line passing through Bo.
- Raises
RuntimeError if mass or radius is not positive and finite. –
- Parameter
- IsNaN(self: pydrake.multibody.tree.SpatialInertia_[AutoDiffXd]) bool
Returns
True
if any of the elements in this spatial inertia is NaN andFalse
otherwise.
- IsPhysicallyValid(self: pydrake.multibody.tree.SpatialInertia_[AutoDiffXd]) bool
Performs a number of checks to verify that this is a physically valid spatial inertia. The checks performed are:
No NaN entries.
Non-negative mass.
Non-negative principal moments about the center of mass.
Principal moments about the center of mass must satisfy the triangle inequality: -
Ixx + Iyy >= Izz
- Ixx + Izz >= Iyy -Iyy + Izz >= Ixx
These are the tests performed by RotationalInertia::CouldBePhysicallyValid() which become a sufficient condition when performed on a rotational inertia about a body’s center of mass.
See also
RotationalInertia::CouldBePhysicallyValid().
- IsZero(self: pydrake.multibody.tree.SpatialInertia_[AutoDiffXd]) bool
Returns
True
if all of the elements in this spatial inertia are zero andFalse
otherwise.
- static MakeFromCentralInertia(mass: pydrake.autodiffutils.AutoDiffXd, p_PScm_E: numpy.ndarray[object[3, 1]], I_SScm_E: pydrake.multibody.tree.RotationalInertia_[AutoDiffXd]) pydrake.multibody.tree.SpatialInertia_[AutoDiffXd]
Creates a spatial inertia for a physical body or composite body S about a point P from a given mass, center of mass, and central rotational inertia. For example, this method creates a body’s SpatialInertia about its body origin Bo from the body’s mass, position vector from Bo to the body’s center of mass, and rotational inertia about the body’s center of mass.
This method checks for the physical validity of the resulting SpatialInertia with IsPhysicallyValid() and throws a RuntimeError exception in the event the provided input parameters lead to a non-physically viable spatial inertia.
- Parameter
mass
: The mass of the body or composite body S.
- Parameter
p_PScm_E
: The position vector from point P to point
Scm
(S’s center of mass), expressed in a frame E.- Parameter
I_SScm_E
: S’s RotationalInertia about Scm, expressed in frame E.
- Returns
M_SP_E
: S’s spatial inertia about point P, expressed in frame E.
- Parameter
- static NaN() pydrake.multibody.tree.SpatialInertia_[AutoDiffXd]
Initializes mass, center of mass and rotational inertia to invalid NaN’s for a quick detection of uninitialized values.
- ReExpress(self: pydrake.multibody.tree.SpatialInertia_[AutoDiffXd], R_AE: pydrake.math.RotationMatrix_[AutoDiffXd]) pydrake.multibody.tree.SpatialInertia_[AutoDiffXd]
Given
this
spatial inertiaM_SP_E
for some body or composite body S, taken about a point P and expressed in frame E, this method computes the same inertia re-expressed in another frame A.- Parameter
R_AE
: RotationMatrix relating frames A and E.
- Returns
M_SP_A
: The same spatial inertia of S about P but now re-expressed in frame A.
See also
ReExpressInPlace() for details.
- Parameter
- SetNaN(self: pydrake.multibody.tree.SpatialInertia_[AutoDiffXd]) None
Sets
this
spatial inertia to have NaN entries. Typically used for quick detection of uninitialized values.
- Shift(self: pydrake.multibody.tree.SpatialInertia_[AutoDiffXd], p_PQ_E: numpy.ndarray[object[3, 1]]) pydrake.multibody.tree.SpatialInertia_[AutoDiffXd]
Given
this
spatial inertiaM_SP_E
for some body or composite body S, computed about point P, and expressed in frame E, this method uses the Parallel Axis Theorem for spatial inertias to compute the same spatial inertia about a new point Q. The result still is expressed in frame E.See also
ShiftInPlace() for more details.
- Parameter
p_PQ_E
: Vector from the original about point P to the new about point Q, expressed in the same frame E
this
spatial inertia is expressed in.- Returns
M_SQ_E
: This same spatial inertia for body or composite body S but computed about a new point Q.
- Parameter
- static SolidBoxWithDensity(density: pydrake.autodiffutils.AutoDiffXd, lx: pydrake.autodiffutils.AutoDiffXd, ly: pydrake.autodiffutils.AutoDiffXd, lz: pydrake.autodiffutils.AutoDiffXd) pydrake.multibody.tree.SpatialInertia_[AutoDiffXd]
Creates a spatial inertia for a uniform density solid box B about its geometric center Bo (which is coincident with B’s center of mass Bcm).
- Parameter
density
: mass per volume (kg/m³).
- Parameter
lx
: length of the box in the Bx direction (meters).
- Parameter
ly
: length of the box in the By direction (meters).
- Parameter
lz
: length of the box in the Bz direction (meters).
- Returns
M_BBo_B
: B’s spatial inertia about Bo, expressed in B.
- Raises
RuntimeError if density, lx, ly, or lz is not positive and finite. –
- Parameter
- static SolidBoxWithMass(mass: pydrake.autodiffutils.AutoDiffXd, lx: pydrake.autodiffutils.AutoDiffXd, ly: pydrake.autodiffutils.AutoDiffXd, lz: pydrake.autodiffutils.AutoDiffXd) pydrake.multibody.tree.SpatialInertia_[AutoDiffXd]
Creates a spatial inertia for a uniform density solid box B about its geometric center Bo (which is coincident with B’s center of mass Bcm).
- Parameter
mass
: mass of the solid box (kg).
- Parameter
lx
: length of the box in the Bx direction (meters).
- Parameter
ly
: length of the box in the By direction (meters).
- Parameter
lz
: length of the box in the Bz direction (meters).
- Returns
M_BBo_B
: B’s spatial inertia about Bo, expressed in B.
- Raises
RuntimeError if mass, lx, ly, or lz is not positive and finite. –
- Parameter
- static SolidCapsuleWithDensity(density: pydrake.autodiffutils.AutoDiffXd, radius: pydrake.autodiffutils.AutoDiffXd, length: pydrake.autodiffutils.AutoDiffXd, unit_vector: numpy.ndarray[object[3, 1]]) pydrake.multibody.tree.SpatialInertia_[AutoDiffXd]
Creates a spatial inertia for a uniform density solid capsule B about its geometric center Bo (which is coincident with B’s center of mass Bcm).
- Parameter
density
: mass per volume (kg/m³).
- Parameter
radius
: radius of the cylinder/half-sphere parts of the capsule.
- Parameter
length
: length of the cylindrical part of the capsule.
- Parameter
unit_vector
: unit vector defining the axial direction of the cylindrical part of the capsule, expressed in B.
- Returns
M_BBo_B
: B’s spatial inertia about Bo, expressed in B.
Note
B’s rotational inertia about Bo is axially symmetric, meaning B has an equal moment of inertia about any line that both passes through Bo and is perpendicular to unit_vector.
- Raises
RuntimeError if density, radius, or length is not positive and –
finite or if ‖unit_vector‖ is not within 1.0E-14 of 1.0. –
- Parameter
- static SolidCapsuleWithMass(mass: pydrake.autodiffutils.AutoDiffXd, radius: pydrake.autodiffutils.AutoDiffXd, length: pydrake.autodiffutils.AutoDiffXd, unit_vector: numpy.ndarray[object[3, 1]]) pydrake.multibody.tree.SpatialInertia_[AutoDiffXd]
Creates a spatial inertia for a uniform density solid capsule B about its geometric center Bo (which is coincident with B’s center of mass Bcm).
- Parameter
mass
: mass of the solid capsule (kg).
- Parameter
radius
: radius of the cylinder/half-sphere parts of the capsule.
- Parameter
length
: length of the cylindrical part of the capsule.
- Parameter
unit_vector
: unit vector defining the axial direction of the cylindrical part of the capsule, expressed in B.
- Returns
M_BBo_B
: B’s spatial inertia about Bo, expressed in B.
Note
B’s rotational inertia about Bo is axially symmetric, meaning B has an equal moment of inertia about any line that both passes through Bo and is perpendicular to unit_vector.
- Raises
RuntimeError if mass, radius, or length is not positive and finite –
or if ‖unit_vector‖ is not within 1.0E-14 of 1.0. –
- Parameter
- static SolidCubeWithDensity(density: pydrake.autodiffutils.AutoDiffXd, length: pydrake.autodiffutils.AutoDiffXd) pydrake.multibody.tree.SpatialInertia_[AutoDiffXd]
Creates a spatial inertia for a uniform density solid cube B about its geometric center Bo (which is coincident with B’s center of mass Bcm).
- Parameter
density
: mass per volume (kg/m³).
- Parameter
length
: The length of each of the cube’s sides (meters).
- Returns
M_BBo_B
: B’s spatial inertia about Bo, expressed in B. Since B’s rotational inertia is triaxially symmetric, M_BBo_B = M_BBo_E, i.e., M_BBo expressed in frame B is equal to M_BBo expressed in an arbitrary frame E.
Note
B’s rotational inertia about Bo is triaxially symmetric, meaning B has an equal moment of inertia about any line passing through Bo.
- Raises
RuntimeError if density or length is not positive and finite. –
- Parameter
- static SolidCylinderWithDensity(density: pydrake.autodiffutils.AutoDiffXd, radius: pydrake.autodiffutils.AutoDiffXd, length: pydrake.autodiffutils.AutoDiffXd, unit_vector: numpy.ndarray[object[3, 1]]) pydrake.multibody.tree.SpatialInertia_[AutoDiffXd]
Creates a spatial inertia for a uniform density solid cylinder B about its geometric center Bo (which is coincident with B’s center of mass Bcm).
- Parameter
density
: mass per volume (kg/m³).
- Parameter
radius
: radius of the cylinder (meters).
- Parameter
length
: length of cylinder in unit_vector direction (meters).
- Parameter
unit_vector
: unit vector defining the axial direction of the cylinder, expressed in B.
- Returns
M_BBo_B
: B’s spatial inertia about Bo, expressed in B.
Note
B’s rotational inertia about Bo is axially symmetric, meaning B has an equal moment of inertia about any line that both passes through Bo and is perpendicular to unit_vector.
- Raises
RuntimeError if density, radius, or length is not positive and –
finite or if ‖unit_vector‖ is not within 1.0E-14 of 1.0. –
See also
SolidCylinderWithDensityAboutEnd() to calculate M_BBp_B, B’s spatial inertia about Bp (at the center of one of the cylinder’s circular ends).
- Parameter
- static SolidCylinderWithDensityAboutEnd(density: pydrake.autodiffutils.AutoDiffXd, radius: pydrake.autodiffutils.AutoDiffXd, length: pydrake.autodiffutils.AutoDiffXd, unit_vector: numpy.ndarray[object[3, 1]]) pydrake.multibody.tree.SpatialInertia_[AutoDiffXd]
Creates a spatial inertia for a uniform-density solid cylinder B about an end-point Bp of the cylinder’s axis (see below for more about Bp).
- Parameter
density
: mass per volume (kg/m³).
- Parameter
radius
: radius of cylinder (meters).
- Parameter
length
: length of cylinder in unit_vector direction (meters).
- Parameter
unit_vector
: unit vector parallel to the axis of the cylinder and directed from Bp to Bcm (B’s center of mass), expressed in B.
- Returns
M_BBp_B
: B’s spatial inertia about Bp, expressed in B.
Note
The position from Bp to Bcm is p_BpBcm = length / 2 * unit_vector.
Note
B’s rotational inertia about Bp is axially symmetric, meaning B has an equal moment of inertia about any line that both passes through Bp and is perpendicular to unit_vector.
- Raises
RuntimeError if density, radius, or length is not positive and –
finite or if ‖unit_vector‖ is not within 1.0E-14 of 1.0. –
See also
SolidCylinderWithDensity() to calculate M_BBcm_B, B’s spatial inertia about Bcm (B’s center of mass).
- Parameter
- static SolidCylinderWithMass(mass: pydrake.autodiffutils.AutoDiffXd, radius: pydrake.autodiffutils.AutoDiffXd, length: pydrake.autodiffutils.AutoDiffXd, unit_vector: numpy.ndarray[object[3, 1]]) pydrake.multibody.tree.SpatialInertia_[AutoDiffXd]
Creates a spatial inertia for a uniform density solid cylinder B about its geometric center Bo (which is coincident with B’s center of mass Bcm).
- Parameter
mass
: mass of the solid cylinder (kg).
- Parameter
radius
: radius of the cylinder (meters).
- Parameter
length
: length of cylinder in unit_vector direction (meters).
- Parameter
unit_vector
: unit vector defining the axial direction of the cylinder, expressed in B.
- Returns
M_BBo_B
: B’s spatial inertia about Bo, expressed in B.
Note
B’s rotational inertia about Bo is axially symmetric, meaning B has an equal moment of inertia about any line that both passes through Bo and is perpendicular to unit_vector.
- Raises
RuntimeError if mass, radius, or length is not positive and finite –
or if ‖unit_vector‖ is not within 1.0E-14 of 1.0. –
See also
SolidCylinderWithMassAboutEnd() to calculate M_BBp_B, B’s spatial inertia about Bp (at the center of one of the cylinder’s circular ends).
- Parameter
- static SolidCylinderWithMassAboutEnd(mass: pydrake.autodiffutils.AutoDiffXd, radius: pydrake.autodiffutils.AutoDiffXd, length: pydrake.autodiffutils.AutoDiffXd, unit_vector: numpy.ndarray[object[3, 1]]) pydrake.multibody.tree.SpatialInertia_[AutoDiffXd]
Creates a spatial inertia for a uniform-density solid cylinder B about an end-point Bp of the cylinder’s axis (see below for more about Bp).
- Parameter
mass
: mass of the solid cylinder (kg).
- Parameter
radius
: radius of cylinder (meters).
- Parameter
length
: length of cylinder in unit_vector direction (meters).
- Parameter
unit_vector
: unit vector parallel to the axis of the cylinder and directed from Bp to Bcm (B’s center of mass), expressed in B.
- Returns
M_BBp_B
: B’s spatial inertia about Bp, expressed in B.
Note
The position from Bp to Bcm is p_BpBcm = length / 2 * unit_vector.
Note
B’s rotational inertia about Bp is axially symmetric, meaning B has an equal moment of inertia about any line that both passes through Bp and is perpendicular to unit_vector.
- Raises
RuntimeError if density, radius, or length is not positive and –
finite or if ‖unit_vector‖ is not within 1.0E-14 of 1.0. –
See also
SolidCylinderWithMass() to calculate M_BBcm_B, B’s spatial inertia about Bcm (B’s center of mass).
- Parameter
- static SolidEllipsoidWithDensity(density: pydrake.autodiffutils.AutoDiffXd, a: pydrake.autodiffutils.AutoDiffXd, b: pydrake.autodiffutils.AutoDiffXd, c: pydrake.autodiffutils.AutoDiffXd) pydrake.multibody.tree.SpatialInertia_[AutoDiffXd]
Creates a spatial inertia for a uniform density solid ellipsoid B about its geometric center Bo (which is coincident with B’s center of mass Bcm).
- Parameter
density
: mass per volume (kg/m³).
- Parameter
a
: length of ellipsoid semi-axis in the ellipsoid Bx direction.
- Parameter
b
: length of ellipsoid semi-axis in the ellipsoid By direction.
- Parameter
c
: length of ellipsoid semi-axis in the ellipsoid Bz direction.
- Returns
M_BBo_B
: B’s spatial inertia about Bo, expressed in B.
- Raises
RuntimeError if density, a, b, or c is not positive and finite. –
- Parameter
- static SolidEllipsoidWithMass(mass: pydrake.autodiffutils.AutoDiffXd, a: pydrake.autodiffutils.AutoDiffXd, b: pydrake.autodiffutils.AutoDiffXd, c: pydrake.autodiffutils.AutoDiffXd) pydrake.multibody.tree.SpatialInertia_[AutoDiffXd]
Creates a spatial inertia for a uniform density solid ellipsoid B about its geometric center Bo (which is coincident with B’s center of mass Bcm).
- Parameter
mass
: mass of the solid ellipsoid (kg).
- Parameter
a
: length of ellipsoid semi-axis in the ellipsoid Bx direction.
- Parameter
b
: length of ellipsoid semi-axis in the ellipsoid By direction.
- Parameter
c
: length of ellipsoid semi-axis in the ellipsoid Bz direction.
- Returns
M_BBo_B
: B’s spatial inertia about Bo, expressed in B.
- Raises
RuntimeError if mass, a, b, or c is not positive and finite. –
- Parameter
- static SolidSphereWithDensity(density: pydrake.autodiffutils.AutoDiffXd, radius: pydrake.autodiffutils.AutoDiffXd) pydrake.multibody.tree.SpatialInertia_[AutoDiffXd]
Creates a spatial inertia for a uniform density solid sphere B about its geometric center Bo (which is coincident with B’s center of mass Bcm).
- Parameter
density
: mass per volume (kg/m³).
- Parameter
radius
: sphere’s radius (meters).
- Returns
M_BBo
: B’s spatial inertia about Bo. Since B’s rotational inertia is triaxially symmetric, M_BBo_B = M_BBo_E, i.e., M_BBo expressed in frame B is equal to M_BBo expressed in an arbitrary frame E.
Note
B’s rotational inertia about Bo is triaxially symmetric, meaning B has an equal moment of inertia about any line passing through Bo.
- Raises
RuntimeError if density or radius is not positive and finite. –
- Parameter
- static SolidSphereWithMass(mass: pydrake.autodiffutils.AutoDiffXd, radius: pydrake.autodiffutils.AutoDiffXd) pydrake.multibody.tree.SpatialInertia_[AutoDiffXd]
Creates a spatial inertia for a uniform density solid sphere B about its geometric center Bo (which is coincident with B’s center of mass Bcm).
- Parameter
mass
: mass of the solid sphere (kg).
- Parameter
radius
: sphere’s radius (meters).
- Returns
M_BBo
: B’s spatial inertia about Bo. Since B’s rotational inertia is triaxially symmetric, M_BBo_B = M_BBo_E, i.e., M_BBo expressed in frame B is equal to M_BBo expressed in an arbitrary frame E.
Note
B’s rotational inertia about Bo is triaxially symmetric, meaning B has an equal moment of inertia about any line passing through Bo.
- Raises
RuntimeError if mass or radius is not positive and finite. –
- Parameter
- static ThinRodWithMass(mass: pydrake.autodiffutils.AutoDiffXd, length: pydrake.autodiffutils.AutoDiffXd, unit_vector: numpy.ndarray[object[3, 1]]) pydrake.multibody.tree.SpatialInertia_[AutoDiffXd]
Creates a spatial inertia for a uniform-density thin rod B about its center of mass Bcm.
- Parameter
mass
: mass of the rod (units of kg).
- Parameter
length
: length of the rod (units of meters).
- Parameter
unit_vector
: unit vector defining the rod’s axial direction, expressed in B.
- Returns
M_BBcm_B
: B’s spatial inertia about Bcm, expressed in B.
Note
B’s rotational inertia about Bcm is axially symmetric, meaning B has an equal moment of inertia about any line that both passes through Bcm and is perpendicular to unit_vector. B has no (zero) rotational inertia about the line that passes through Bcm and is parallel to unit_vector.
- Raises
RuntimeError if mass or length is not positive and finite or if –
‖unit_vector‖ is not within 1.0E-14 of 1.0. –
See also
ThinRodWithMassAboutEnd() to calculate M_BBp_B, B’s spatial inertia about Bp (one of the ends of rod B).
- Parameter
- static ThinRodWithMassAboutEnd(mass: pydrake.autodiffutils.AutoDiffXd, length: pydrake.autodiffutils.AutoDiffXd, unit_vector: numpy.ndarray[object[3, 1]]) pydrake.multibody.tree.SpatialInertia_[AutoDiffXd]
Creates a spatial inertia for a uniform-density thin rod B about one of its ends.
- Parameter
mass
: mass of the rod (units of kg).
- Parameter
length
: length of the rod (units of meters).
- Parameter
unit_vector
: unit vector defining the rod’s axial direction, expressed in B.
- Returns
M_BBp_B
: B’s spatial inertia about Bp, expressed in B.
Note
The position from Bp to Bcm is length / 2 * unit_vector.
Note
B’s rotational inertia about Bp is axially symmetric, meaning B has an equal moment of inertia about any line that both passes through Bp and is perpendicular to unit_vector. B has no (zero) rotational inertia about the line that passes through Bp and is parallel to unit_vector.
- Raises
RuntimeError if mass or length is not positive and finite or if –
‖unit_vector‖ is not within 1.0E-14 of 1.0. –
See also
ThinRodWithMass() to calculate M_BBcm_B, B’s spatial inertia about Bcm (B’s center of mass).
- Parameter
- static Zero() pydrake.multibody.tree.SpatialInertia_[AutoDiffXd]
Initializes mass, center of mass and rotational inertia to zero.
- class pydrake.multibody.tree.SpatialInertia_[Expression]
This class represents the physical concept of a Spatial Inertia. A spatial inertia (or spatial mass matrix) encapsulates the mass, center of mass, and rotational inertia of the mass distribution of a body or composite body S, where with “composite body” we mean a collection of bodies welded together containing at least one body (throughout this documentation “body” is many times used instead of “composite body” but the same concepts apply to a collection of bodies as well.) A spatial inertia is an element of ℝ⁶ˣ⁶ that is symmetric, and positive semi-definite. It logically consists of
3x3
sub-matrices arranged like so, [Jain 2010]:Click to expand C++ code...
Spatial mass matrix ------------ ------------ 0 | | | 1 | I_SP | m p_PScm× | 2 | | | ------------ ------------ 3 | | | 4 | -m p_PScm× | m Id | 5 | | | ------------ ------------ Symbol: M
where, with the monogram notation described in multibody_spatial_inertia,
I_SP
is the rotational inertia of body or composite body S computed about a point P, m is the mass of this composite body,p_PScm
is the position vector from point P to the center of massScm
of the composite body S withp_PScm×
denoting its skew-symmetric cross product matrix (defined such thata× b = a.cross(b)
), andId
is the identity matrix in ℝ³ˣ³. See Section 2.1, p. 17 of [Jain 2010]. The logical arrangement as shown above is chosen to be consistent with our logical arrangement for spatial vectors as documented in multibody_spatial_algebra for which the rotational component comes first followed by the translational component.In typeset material we use the symbol \([M^{S/P}]_E\) to represent the spatial inertia of a body or composite body S about point P, expressed in frame E. For this inertia, the monogram notation reads
M_SP_E
. If the point P is fixed to a body B, we write that point as \(B_P\) which appears in code and comments asBp
. So if the body or composite body is B and the about point isBp
, the monogram notation readsM_BBp_E
, which can be abbreviated toM_Bp_E
since the about pointBp
also identifies the body. Common cases are that the about point is the originBo
of the body, or it’s the center of massBcm
for which the rotational inertia in monogram notation would read asI_Bo_E
andI_Bcm_E
, respectively. GivenM_BP_E
(\([M^{B/P}]_E\)), the rotational inertia of this spatial inertia isI_BP_E
(\([I^{B/P}]_E\)) and the position vector of the center of mass measured from point P and expressed in E isp_PBcm_E
(\([^Pp^{B_{cm}}]_E\)).Note
This class does not implement any mechanism to track the frame E in which a spatial inertia is expressed or about what point is computed. Methods and operators on this class have no means to determine frame consistency through operations. It is therefore the responsibility of users of this class to keep track of frames in which operations are performed. We suggest doing that using disciplined notation, as described above.
Note
Several methods in this class throw a RuntimeError for invalid rotational inertia operations in debug releases only. This provides speed in a release build while facilitating debugging in debug builds. In addition, these validity tests are only performed for scalar types for which drake::scalar_predicate<T>::is_bool is
True
. For instance, validity checks are not performed when T is symbolic::Expression.Note
The methods of this class satisfy the “basic exception guarantee”: if an exception is thrown, the program will still be in a valid state. Specifically, no resources are leaked, and all objects’ invariants are intact. Be aware that SpatialInertia objects may contain invalid inertia data in cases where input checking is skipped.
See also
To create a spatial inertia of a mesh, see CalcSpatialInertia(const geometry::TriangleSurfaceMesh<double>& mesh, double density).
See also
To create spatial inertia from most of geometry::Shape, see CalcSpatialInertia(const geometry::Shape& shape, double density).
See also
To create spatial inertia for a set of bodies, see MultibodyPlant::CalcSpatialInertia().
- [Jain 2010] Jain, A., 2010. Robot and multibody dynamics: analysis and
algorithms. Springer Science & Business Media.
- __init__(self: pydrake.multibody.tree.SpatialInertia_[Expression], mass: pydrake.symbolic.Expression, p_PScm_E: numpy.ndarray[object[3, 1]], G_SP_E: pydrake.multibody.tree.UnitInertia_[Expression], skip_validity_check: bool = False) None
Constructs a spatial inertia for a physical body or composite body S about a point P from a given mass, center of mass and rotational inertia. The center of mass is specified by the position vector
p_PScm_E
from point P to the center of mass pointScm
, expressed in a frame E. The rotational inertia is provided as the UnitInertiaG_SP_E
of the body or composite body S computed about point P and expressed in frame E.Note
The third argument of this constructor is unusual in that it is an UnitInertia (not a traditional RotationalInertia) and its inertia is about the arbitrary point P (not Scm – S’s center of mass).
See also
MakeFromCentralInertia a factory method with traditional utility.
This constructor checks for the physical validity of the resulting SpatialInertia with IsPhysicallyValid() and throws a RuntimeError exception in the event the provided input parameters lead to non-physically viable spatial inertia. Since this check has non-negligable runtime costs, it can be disabled by setting the optional argument
skip_validity_check
toTrue
.- Parameter
mass
: The mass of the body or composite body S.
- Parameter
p_PScm_E
: The position vector from point P to the center of mass of body or composite body S expressed in frame E.
- Parameter
G_SP_E
: UnitInertia of the body or composite body S computed about origin point P and expressed in frame E.
- Parameter
skip_validity_check
: If true, skips the validity check described above. Defaults to false.
- Parameter
- CalcComMoment(self: pydrake.multibody.tree.SpatialInertia_[Expression]) numpy.ndarray[object[3, 1]]
Computes the center of mass moment vector
mass * p_PScm_E
given the position vectorp_PScm_E
from the about point P to the center of massScm
of the body or composite body S, expressed in frame E. See the documentation of this class for details.
- CalcPrincipalSemiDiametersAndPoseForSolidEllipsoid(self: pydrake.multibody.tree.SpatialInertia_[Expression]) tuple[numpy.ndarray[numpy.float64[3, 1]], pydrake.math.RigidTransform]
Returns 3 principal semi-diameters [lmax lmed lmin] sorted in descending order (lmax ≥ lmed ≥ lmin), orientation, and position of a solid ellipsoid whose spatial inertia is equal to
this
spatial inertia. See spatial_inertia_equivalent_shapes “Spatial inertia equivalent shapes” for more details.- Raises
RuntimeError if the elements of this spatial inertia cannot be –
converted to a real finite double. For example, an exception is –
thrown if this contains an erroneous NaN or if scalar type T –
is symbolic. –
- CalcRotationalInertia(self: pydrake.multibody.tree.SpatialInertia_[Expression]) pydrake.multibody.tree.RotationalInertia_[Expression]
Computes the rotational inertia
I_SP_E = mass * G_SP_E
of this spatial inertia, computed about point P and expressed in frame E. See the documentation of this class for details.
- CopyToFullMatrix6(self: pydrake.multibody.tree.SpatialInertia_[Expression]) numpy.ndarray[object[6, 6]]
Copy to a full 6x6 matrix representation.
- get_com(self: pydrake.multibody.tree.SpatialInertia_[Expression]) numpy.ndarray[object[3, 1]]
Get a constant reference to the position vector
p_PScm_E
from the about point P to the center of massScm
of the body or composite body S, expressed in frame E. See the documentation of this class for details.
- get_mass(self: pydrake.multibody.tree.SpatialInertia_[Expression]) pydrake.symbolic.Expression
Get a constant reference to the mass of this spatial inertia.
- get_unit_inertia(self: pydrake.multibody.tree.SpatialInertia_[Expression]) pydrake.multibody.tree.UnitInertia_[Expression]
Get a constant reference to the unit inertia
G_SP_E
of this spatial inertia, computed about point P and expressed in frame E. See the documentation of this class for details.
- static HollowSphereWithDensity(area_density: pydrake.symbolic.Expression, radius: pydrake.symbolic.Expression) pydrake.multibody.tree.SpatialInertia_[Expression]
Creates a spatial inertia for a uniform density thin hollow sphere B about its geometric center Bo (which is coincident with B’s center of mass Bcm).
- Parameter
area_density
: mass per unit area (kg/m²).
- Parameter
radius
: sphere’s radius in meters (the hollow sphere is regarded as an infinitesimally thin shell of uniform density).
- Returns
M_BBo_B
: B’s spatial inertia about Bo, expressed in B. Since B’s rotational inertia is triaxially symmetric, M_BBo_B = M_BBo_E, i.e., M_BBo expressed in frame B is equal to M_BBo expressed in an arbitrary frame E.
Note
B’s rotational inertia about Bo is triaxially symmetric, meaning B has an equal moment of inertia about any line passing through Bo.
- Raises
RuntimeError if area_density or radius is not positive and finite. –
- Parameter
- static HollowSphereWithMass(mass: pydrake.symbolic.Expression, radius: pydrake.symbolic.Expression) pydrake.multibody.tree.SpatialInertia_[Expression]
Creates a spatial inertia for a uniform density hollow sphere B about its geometric center Bo (which is coincident with B’s center of mass Bcm).
- Parameter
mass
: mass of the hollow sphere (kg).
- Parameter
radius
: sphere’s radius in meters (the hollow sphere is regarded as an infinitesimally thin shell of uniform density).
- Returns
M_BBo
: B’s spatial inertia about Bo. Since B’s rotational inertia is triaxially symmetric, M_BBo_B = M_BBo_E, i.e., M_BBo expressed in frame B is equal to M_BBo expressed in an arbitrary frame E.
Note
B’s rotational inertia about Bo is triaxially symmetric, meaning B has an equal moment of inertia about any line passing through Bo.
- Raises
RuntimeError if mass or radius is not positive and finite. –
- Parameter
- IsNaN(self: pydrake.multibody.tree.SpatialInertia_[Expression]) pydrake.symbolic.Formula
Returns
True
if any of the elements in this spatial inertia is NaN andFalse
otherwise.
- IsPhysicallyValid(self: pydrake.multibody.tree.SpatialInertia_[Expression]) pydrake.symbolic.Formula
Performs a number of checks to verify that this is a physically valid spatial inertia. The checks performed are:
No NaN entries.
Non-negative mass.
Non-negative principal moments about the center of mass.
Principal moments about the center of mass must satisfy the triangle inequality: -
Ixx + Iyy >= Izz
- Ixx + Izz >= Iyy -Iyy + Izz >= Ixx
These are the tests performed by RotationalInertia::CouldBePhysicallyValid() which become a sufficient condition when performed on a rotational inertia about a body’s center of mass.
See also
RotationalInertia::CouldBePhysicallyValid().
- IsZero(self: pydrake.multibody.tree.SpatialInertia_[Expression]) pydrake.symbolic.Formula
Returns
True
if all of the elements in this spatial inertia are zero andFalse
otherwise.
- static MakeFromCentralInertia(mass: pydrake.symbolic.Expression, p_PScm_E: numpy.ndarray[object[3, 1]], I_SScm_E: pydrake.multibody.tree.RotationalInertia_[Expression]) pydrake.multibody.tree.SpatialInertia_[Expression]
Creates a spatial inertia for a physical body or composite body S about a point P from a given mass, center of mass, and central rotational inertia. For example, this method creates a body’s SpatialInertia about its body origin Bo from the body’s mass, position vector from Bo to the body’s center of mass, and rotational inertia about the body’s center of mass.
This method checks for the physical validity of the resulting SpatialInertia with IsPhysicallyValid() and throws a RuntimeError exception in the event the provided input parameters lead to a non-physically viable spatial inertia.
- Parameter
mass
: The mass of the body or composite body S.
- Parameter
p_PScm_E
: The position vector from point P to point
Scm
(S’s center of mass), expressed in a frame E.- Parameter
I_SScm_E
: S’s RotationalInertia about Scm, expressed in frame E.
- Returns
M_SP_E
: S’s spatial inertia about point P, expressed in frame E.
- Parameter
- static NaN() pydrake.multibody.tree.SpatialInertia_[Expression]
Initializes mass, center of mass and rotational inertia to invalid NaN’s for a quick detection of uninitialized values.
- ReExpress(self: pydrake.multibody.tree.SpatialInertia_[Expression], R_AE: pydrake.math.RotationMatrix_[Expression]) pydrake.multibody.tree.SpatialInertia_[Expression]
Given
this
spatial inertiaM_SP_E
for some body or composite body S, taken about a point P and expressed in frame E, this method computes the same inertia re-expressed in another frame A.- Parameter
R_AE
: RotationMatrix relating frames A and E.
- Returns
M_SP_A
: The same spatial inertia of S about P but now re-expressed in frame A.
See also
ReExpressInPlace() for details.
- Parameter
- SetNaN(self: pydrake.multibody.tree.SpatialInertia_[Expression]) None
Sets
this
spatial inertia to have NaN entries. Typically used for quick detection of uninitialized values.
- Shift(self: pydrake.multibody.tree.SpatialInertia_[Expression], p_PQ_E: numpy.ndarray[object[3, 1]]) pydrake.multibody.tree.SpatialInertia_[Expression]
Given
this
spatial inertiaM_SP_E
for some body or composite body S, computed about point P, and expressed in frame E, this method uses the Parallel Axis Theorem for spatial inertias to compute the same spatial inertia about a new point Q. The result still is expressed in frame E.See also
ShiftInPlace() for more details.
- Parameter
p_PQ_E
: Vector from the original about point P to the new about point Q, expressed in the same frame E
this
spatial inertia is expressed in.- Returns
M_SQ_E
: This same spatial inertia for body or composite body S but computed about a new point Q.
- Parameter
- static SolidBoxWithDensity(density: pydrake.symbolic.Expression, lx: pydrake.symbolic.Expression, ly: pydrake.symbolic.Expression, lz: pydrake.symbolic.Expression) pydrake.multibody.tree.SpatialInertia_[Expression]
Creates a spatial inertia for a uniform density solid box B about its geometric center Bo (which is coincident with B’s center of mass Bcm).
- Parameter
density
: mass per volume (kg/m³).
- Parameter
lx
: length of the box in the Bx direction (meters).
- Parameter
ly
: length of the box in the By direction (meters).
- Parameter
lz
: length of the box in the Bz direction (meters).
- Returns
M_BBo_B
: B’s spatial inertia about Bo, expressed in B.
- Raises
RuntimeError if density, lx, ly, or lz is not positive and finite. –
- Parameter
- static SolidBoxWithMass(mass: pydrake.symbolic.Expression, lx: pydrake.symbolic.Expression, ly: pydrake.symbolic.Expression, lz: pydrake.symbolic.Expression) pydrake.multibody.tree.SpatialInertia_[Expression]
Creates a spatial inertia for a uniform density solid box B about its geometric center Bo (which is coincident with B’s center of mass Bcm).
- Parameter
mass
: mass of the solid box (kg).
- Parameter
lx
: length of the box in the Bx direction (meters).
- Parameter
ly
: length of the box in the By direction (meters).
- Parameter
lz
: length of the box in the Bz direction (meters).
- Returns
M_BBo_B
: B’s spatial inertia about Bo, expressed in B.
- Raises
RuntimeError if mass, lx, ly, or lz is not positive and finite. –
- Parameter
- static SolidCapsuleWithDensity(density: pydrake.symbolic.Expression, radius: pydrake.symbolic.Expression, length: pydrake.symbolic.Expression, unit_vector: numpy.ndarray[object[3, 1]]) pydrake.multibody.tree.SpatialInertia_[Expression]
Creates a spatial inertia for a uniform density solid capsule B about its geometric center Bo (which is coincident with B’s center of mass Bcm).
- Parameter
density
: mass per volume (kg/m³).
- Parameter
radius
: radius of the cylinder/half-sphere parts of the capsule.
- Parameter
length
: length of the cylindrical part of the capsule.
- Parameter
unit_vector
: unit vector defining the axial direction of the cylindrical part of the capsule, expressed in B.
- Returns
M_BBo_B
: B’s spatial inertia about Bo, expressed in B.
Note
B’s rotational inertia about Bo is axially symmetric, meaning B has an equal moment of inertia about any line that both passes through Bo and is perpendicular to unit_vector.
- Raises
RuntimeError if density, radius, or length is not positive and –
finite or if ‖unit_vector‖ is not within 1.0E-14 of 1.0. –
- Parameter
- static SolidCapsuleWithMass(mass: pydrake.symbolic.Expression, radius: pydrake.symbolic.Expression, length: pydrake.symbolic.Expression, unit_vector: numpy.ndarray[object[3, 1]]) pydrake.multibody.tree.SpatialInertia_[Expression]
Creates a spatial inertia for a uniform density solid capsule B about its geometric center Bo (which is coincident with B’s center of mass Bcm).
- Parameter
mass
: mass of the solid capsule (kg).
- Parameter
radius
: radius of the cylinder/half-sphere parts of the capsule.
- Parameter
length
: length of the cylindrical part of the capsule.
- Parameter
unit_vector
: unit vector defining the axial direction of the cylindrical part of the capsule, expressed in B.
- Returns
M_BBo_B
: B’s spatial inertia about Bo, expressed in B.
Note
B’s rotational inertia about Bo is axially symmetric, meaning B has an equal moment of inertia about any line that both passes through Bo and is perpendicular to unit_vector.
- Raises
RuntimeError if mass, radius, or length is not positive and finite –
or if ‖unit_vector‖ is not within 1.0E-14 of 1.0. –
- Parameter
- static SolidCubeWithDensity(density: pydrake.symbolic.Expression, length: pydrake.symbolic.Expression) pydrake.multibody.tree.SpatialInertia_[Expression]
Creates a spatial inertia for a uniform density solid cube B about its geometric center Bo (which is coincident with B’s center of mass Bcm).
- Parameter
density
: mass per volume (kg/m³).
- Parameter
length
: The length of each of the cube’s sides (meters).
- Returns
M_BBo_B
: B’s spatial inertia about Bo, expressed in B. Since B’s rotational inertia is triaxially symmetric, M_BBo_B = M_BBo_E, i.e., M_BBo expressed in frame B is equal to M_BBo expressed in an arbitrary frame E.
Note
B’s rotational inertia about Bo is triaxially symmetric, meaning B has an equal moment of inertia about any line passing through Bo.
- Raises
RuntimeError if density or length is not positive and finite. –
- Parameter
- static SolidCylinderWithDensity(density: pydrake.symbolic.Expression, radius: pydrake.symbolic.Expression, length: pydrake.symbolic.Expression, unit_vector: numpy.ndarray[object[3, 1]]) pydrake.multibody.tree.SpatialInertia_[Expression]
Creates a spatial inertia for a uniform density solid cylinder B about its geometric center Bo (which is coincident with B’s center of mass Bcm).
- Parameter
density
: mass per volume (kg/m³).
- Parameter
radius
: radius of the cylinder (meters).
- Parameter
length
: length of cylinder in unit_vector direction (meters).
- Parameter
unit_vector
: unit vector defining the axial direction of the cylinder, expressed in B.
- Returns
M_BBo_B
: B’s spatial inertia about Bo, expressed in B.
Note
B’s rotational inertia about Bo is axially symmetric, meaning B has an equal moment of inertia about any line that both passes through Bo and is perpendicular to unit_vector.
- Raises
RuntimeError if density, radius, or length is not positive and –
finite or if ‖unit_vector‖ is not within 1.0E-14 of 1.0. –
See also
SolidCylinderWithDensityAboutEnd() to calculate M_BBp_B, B’s spatial inertia about Bp (at the center of one of the cylinder’s circular ends).
- Parameter
- static SolidCylinderWithDensityAboutEnd(density: pydrake.symbolic.Expression, radius: pydrake.symbolic.Expression, length: pydrake.symbolic.Expression, unit_vector: numpy.ndarray[object[3, 1]]) pydrake.multibody.tree.SpatialInertia_[Expression]
Creates a spatial inertia for a uniform-density solid cylinder B about an end-point Bp of the cylinder’s axis (see below for more about Bp).
- Parameter
density
: mass per volume (kg/m³).
- Parameter
radius
: radius of cylinder (meters).
- Parameter
length
: length of cylinder in unit_vector direction (meters).
- Parameter
unit_vector
: unit vector parallel to the axis of the cylinder and directed from Bp to Bcm (B’s center of mass), expressed in B.
- Returns
M_BBp_B
: B’s spatial inertia about Bp, expressed in B.
Note
The position from Bp to Bcm is p_BpBcm = length / 2 * unit_vector.
Note
B’s rotational inertia about Bp is axially symmetric, meaning B has an equal moment of inertia about any line that both passes through Bp and is perpendicular to unit_vector.
- Raises
RuntimeError if density, radius, or length is not positive and –
finite or if ‖unit_vector‖ is not within 1.0E-14 of 1.0. –
See also
SolidCylinderWithDensity() to calculate M_BBcm_B, B’s spatial inertia about Bcm (B’s center of mass).
- Parameter
- static SolidCylinderWithMass(mass: pydrake.symbolic.Expression, radius: pydrake.symbolic.Expression, length: pydrake.symbolic.Expression, unit_vector: numpy.ndarray[object[3, 1]]) pydrake.multibody.tree.SpatialInertia_[Expression]
Creates a spatial inertia for a uniform density solid cylinder B about its geometric center Bo (which is coincident with B’s center of mass Bcm).
- Parameter
mass
: mass of the solid cylinder (kg).
- Parameter
radius
: radius of the cylinder (meters).
- Parameter
length
: length of cylinder in unit_vector direction (meters).
- Parameter
unit_vector
: unit vector defining the axial direction of the cylinder, expressed in B.
- Returns
M_BBo_B
: B’s spatial inertia about Bo, expressed in B.
Note
B’s rotational inertia about Bo is axially symmetric, meaning B has an equal moment of inertia about any line that both passes through Bo and is perpendicular to unit_vector.
- Raises
RuntimeError if mass, radius, or length is not positive and finite –
or if ‖unit_vector‖ is not within 1.0E-14 of 1.0. –
See also
SolidCylinderWithMassAboutEnd() to calculate M_BBp_B, B’s spatial inertia about Bp (at the center of one of the cylinder’s circular ends).
- Parameter
- static SolidCylinderWithMassAboutEnd(mass: pydrake.symbolic.Expression, radius: pydrake.symbolic.Expression, length: pydrake.symbolic.Expression, unit_vector: numpy.ndarray[object[3, 1]]) pydrake.multibody.tree.SpatialInertia_[Expression]
Creates a spatial inertia for a uniform-density solid cylinder B about an end-point Bp of the cylinder’s axis (see below for more about Bp).
- Parameter
mass
: mass of the solid cylinder (kg).
- Parameter
radius
: radius of cylinder (meters).
- Parameter
length
: length of cylinder in unit_vector direction (meters).
- Parameter
unit_vector
: unit vector parallel to the axis of the cylinder and directed from Bp to Bcm (B’s center of mass), expressed in B.
- Returns
M_BBp_B
: B’s spatial inertia about Bp, expressed in B.
Note
The position from Bp to Bcm is p_BpBcm = length / 2 * unit_vector.
Note
B’s rotational inertia about Bp is axially symmetric, meaning B has an equal moment of inertia about any line that both passes through Bp and is perpendicular to unit_vector.
- Raises
RuntimeError if density, radius, or length is not positive and –
finite or if ‖unit_vector‖ is not within 1.0E-14 of 1.0. –
See also
SolidCylinderWithMass() to calculate M_BBcm_B, B’s spatial inertia about Bcm (B’s center of mass).
- Parameter
- static SolidEllipsoidWithDensity(density: pydrake.symbolic.Expression, a: pydrake.symbolic.Expression, b: pydrake.symbolic.Expression, c: pydrake.symbolic.Expression) pydrake.multibody.tree.SpatialInertia_[Expression]
Creates a spatial inertia for a uniform density solid ellipsoid B about its geometric center Bo (which is coincident with B’s center of mass Bcm).
- Parameter
density
: mass per volume (kg/m³).
- Parameter
a
: length of ellipsoid semi-axis in the ellipsoid Bx direction.
- Parameter
b
: length of ellipsoid semi-axis in the ellipsoid By direction.
- Parameter
c
: length of ellipsoid semi-axis in the ellipsoid Bz direction.
- Returns
M_BBo_B
: B’s spatial inertia about Bo, expressed in B.
- Raises
RuntimeError if density, a, b, or c is not positive and finite. –
- Parameter
- static SolidEllipsoidWithMass(mass: pydrake.symbolic.Expression, a: pydrake.symbolic.Expression, b: pydrake.symbolic.Expression, c: pydrake.symbolic.Expression) pydrake.multibody.tree.SpatialInertia_[Expression]
Creates a spatial inertia for a uniform density solid ellipsoid B about its geometric center Bo (which is coincident with B’s center of mass Bcm).
- Parameter
mass
: mass of the solid ellipsoid (kg).
- Parameter
a
: length of ellipsoid semi-axis in the ellipsoid Bx direction.
- Parameter
b
: length of ellipsoid semi-axis in the ellipsoid By direction.
- Parameter
c
: length of ellipsoid semi-axis in the ellipsoid Bz direction.
- Returns
M_BBo_B
: B’s spatial inertia about Bo, expressed in B.
- Raises
RuntimeError if mass, a, b, or c is not positive and finite. –
- Parameter
- static SolidSphereWithDensity(density: pydrake.symbolic.Expression, radius: pydrake.symbolic.Expression) pydrake.multibody.tree.SpatialInertia_[Expression]
Creates a spatial inertia for a uniform density solid sphere B about its geometric center Bo (which is coincident with B’s center of mass Bcm).
- Parameter
density
: mass per volume (kg/m³).
- Parameter
radius
: sphere’s radius (meters).
- Returns
M_BBo
: B’s spatial inertia about Bo. Since B’s rotational inertia is triaxially symmetric, M_BBo_B = M_BBo_E, i.e., M_BBo expressed in frame B is equal to M_BBo expressed in an arbitrary frame E.
Note
B’s rotational inertia about Bo is triaxially symmetric, meaning B has an equal moment of inertia about any line passing through Bo.
- Raises
RuntimeError if density or radius is not positive and finite. –
- Parameter
- static SolidSphereWithMass(mass: pydrake.symbolic.Expression, radius: pydrake.symbolic.Expression) pydrake.multibody.tree.SpatialInertia_[Expression]
Creates a spatial inertia for a uniform density solid sphere B about its geometric center Bo (which is coincident with B’s center of mass Bcm).
- Parameter
mass
: mass of the solid sphere (kg).
- Parameter
radius
: sphere’s radius (meters).
- Returns
M_BBo
: B’s spatial inertia about Bo. Since B’s rotational inertia is triaxially symmetric, M_BBo_B = M_BBo_E, i.e., M_BBo expressed in frame B is equal to M_BBo expressed in an arbitrary frame E.
Note
B’s rotational inertia about Bo is triaxially symmetric, meaning B has an equal moment of inertia about any line passing through Bo.
- Raises
RuntimeError if mass or radius is not positive and finite. –
- Parameter
- static ThinRodWithMass(mass: pydrake.symbolic.Expression, length: pydrake.symbolic.Expression, unit_vector: numpy.ndarray[object[3, 1]]) pydrake.multibody.tree.SpatialInertia_[Expression]
Creates a spatial inertia for a uniform-density thin rod B about its center of mass Bcm.
- Parameter
mass
: mass of the rod (units of kg).
- Parameter
length
: length of the rod (units of meters).
- Parameter
unit_vector
: unit vector defining the rod’s axial direction, expressed in B.
- Returns
M_BBcm_B
: B’s spatial inertia about Bcm, expressed in B.
Note
B’s rotational inertia about Bcm is axially symmetric, meaning B has an equal moment of inertia about any line that both passes through Bcm and is perpendicular to unit_vector. B has no (zero) rotational inertia about the line that passes through Bcm and is parallel to unit_vector.
- Raises
RuntimeError if mass or length is not positive and finite or if –
‖unit_vector‖ is not within 1.0E-14 of 1.0. –
See also
ThinRodWithMassAboutEnd() to calculate M_BBp_B, B’s spatial inertia about Bp (one of the ends of rod B).
- Parameter
- static ThinRodWithMassAboutEnd(mass: pydrake.symbolic.Expression, length: pydrake.symbolic.Expression, unit_vector: numpy.ndarray[object[3, 1]]) pydrake.multibody.tree.SpatialInertia_[Expression]
Creates a spatial inertia for a uniform-density thin rod B about one of its ends.
- Parameter
mass
: mass of the rod (units of kg).
- Parameter
length
: length of the rod (units of meters).
- Parameter
unit_vector
: unit vector defining the rod’s axial direction, expressed in B.
- Returns
M_BBp_B
: B’s spatial inertia about Bp, expressed in B.
Note
The position from Bp to Bcm is length / 2 * unit_vector.
Note
B’s rotational inertia about Bp is axially symmetric, meaning B has an equal moment of inertia about any line that both passes through Bp and is perpendicular to unit_vector. B has no (zero) rotational inertia about the line that passes through Bp and is parallel to unit_vector.
- Raises
RuntimeError if mass or length is not positive and finite or if –
‖unit_vector‖ is not within 1.0E-14 of 1.0. –
See also
ThinRodWithMass() to calculate M_BBcm_B, B’s spatial inertia about Bcm (B’s center of mass).
- Parameter
- static Zero() pydrake.multibody.tree.SpatialInertia_[Expression]
Initializes mass, center of mass and rotational inertia to zero.
- class pydrake.multibody.tree.UniformGravityFieldElement
Bases:
pydrake.multibody.tree.ForceElement
This ForceElement allows modeling the effect of a uniform gravity field as felt by bodies on the surface of the Earth. This gravity field acts on all bodies in the MultibodyTree model.
Note
This class is templated; see
UniformGravityFieldElement_
for the list of instantiations.- __init__(*args, **kwargs)
Overloaded function.
__init__(self: pydrake.multibody.tree.UniformGravityFieldElement) -> None
Constructs a uniform gravity field element with a default strength (on the earth’s surface) and direction (-z).
__init__(self: pydrake.multibody.tree.UniformGravityFieldElement, g_W: numpy.ndarray[numpy.float64[3, 1]]) -> None
Constructs a uniform gravity field element with a strength given by the acceleration of gravity vector
g_W
, expressed in the world frame W.
- CalcGravityGeneralizedForces(self: pydrake.multibody.tree.UniformGravityFieldElement, context: pydrake.systems.framework.Context) numpy.ndarray[numpy.float64[m, 1]]
Computes the generalized forces
tau_g(q)
due tothis
gravity field element as a function of the generalized positionsq
stored in the inputcontext
, for the multibody model to whichthis
element belongs.tau_g(q)
is defined such that it appears on the right hand side of the equations of motion together with any other generalized forces, like so:Click to expand C++ code...
Mv̇ + C(q, v)v = tau_g(q) + tau_app
where
tau_app
includes any other generalized forces applied on the system.- Parameter
context
: The context storing the state of the multibody model to which this element belongs.
- Returns
tau_g A vector containing the generalized forces due to this gravity field force element. The generalized forces are consistent with the vector of generalized velocities
v
for the parent MultibodyTree model so that the inner productv⋅tau_g
corresponds to the power applied by the gravity forces on the mechanical system. That is,v⋅tau_g > 0
corresponds to potential energy going into the system, as either mechanical kinetic energy, some other potential energy, or heat, and therefore to a decrease of potential energy.
- Parameter
- gravity_vector(self: pydrake.multibody.tree.UniformGravityFieldElement) numpy.ndarray[numpy.float64[3, 1]]
Returns the acceleration of the gravity vector in m/s², expressed in the world frame W.
- is_enabled(self: pydrake.multibody.tree.UniformGravityFieldElement, model_instance: pydrake.multibody.tree.ModelInstanceIndex) bool
- Returns
True
iff gravity is enabled formodel_instance
.
See also
enable(), disable().
- Raises
RuntimeError if the model instance is invalid. –
- kDefaultStrength = 9.81
- set_enabled(self: pydrake.multibody.tree.UniformGravityFieldElement, model_instance: pydrake.multibody.tree.ModelInstanceIndex, is_enabled: bool) None
Sets is_enabled() for
model_instance
tois_enabled
.- Raises
if the parent model is finalized. –
RuntimeError if the model instance is invalid. –
- set_gravity_vector(self: pydrake.multibody.tree.UniformGravityFieldElement, arg0: numpy.ndarray[numpy.float64[3, 1]]) None
Sets the acceleration of gravity vector, expressed in the world frame W in m/s².
- template pydrake.multibody.tree.UniformGravityFieldElement_
Instantiations:
UniformGravityFieldElement_[float]
,UniformGravityFieldElement_[AutoDiffXd]
,UniformGravityFieldElement_[Expression]
- class pydrake.multibody.tree.UniformGravityFieldElement_[AutoDiffXd]
Bases:
pydrake.multibody.tree.ForceElement_[AutoDiffXd]
This ForceElement allows modeling the effect of a uniform gravity field as felt by bodies on the surface of the Earth. This gravity field acts on all bodies in the MultibodyTree model.
- __init__(*args, **kwargs)
Overloaded function.
__init__(self: pydrake.multibody.tree.UniformGravityFieldElement_[AutoDiffXd]) -> None
Constructs a uniform gravity field element with a default strength (on the earth’s surface) and direction (-z).
__init__(self: pydrake.multibody.tree.UniformGravityFieldElement_[AutoDiffXd], g_W: numpy.ndarray[numpy.float64[3, 1]]) -> None
Constructs a uniform gravity field element with a strength given by the acceleration of gravity vector
g_W
, expressed in the world frame W.
- CalcGravityGeneralizedForces(self: pydrake.multibody.tree.UniformGravityFieldElement_[AutoDiffXd], context: pydrake.systems.framework.Context_[AutoDiffXd]) numpy.ndarray[object[m, 1]]
Computes the generalized forces
tau_g(q)
due tothis
gravity field element as a function of the generalized positionsq
stored in the inputcontext
, for the multibody model to whichthis
element belongs.tau_g(q)
is defined such that it appears on the right hand side of the equations of motion together with any other generalized forces, like so:Click to expand C++ code...
Mv̇ + C(q, v)v = tau_g(q) + tau_app
where
tau_app
includes any other generalized forces applied on the system.- Parameter
context
: The context storing the state of the multibody model to which this element belongs.
- Returns
tau_g A vector containing the generalized forces due to this gravity field force element. The generalized forces are consistent with the vector of generalized velocities
v
for the parent MultibodyTree model so that the inner productv⋅tau_g
corresponds to the power applied by the gravity forces on the mechanical system. That is,v⋅tau_g > 0
corresponds to potential energy going into the system, as either mechanical kinetic energy, some other potential energy, or heat, and therefore to a decrease of potential energy.
- Parameter
- gravity_vector(self: pydrake.multibody.tree.UniformGravityFieldElement_[AutoDiffXd]) numpy.ndarray[numpy.float64[3, 1]]
Returns the acceleration of the gravity vector in m/s², expressed in the world frame W.
- is_enabled(self: pydrake.multibody.tree.UniformGravityFieldElement_[AutoDiffXd], model_instance: pydrake.multibody.tree.ModelInstanceIndex) bool
- Returns
True
iff gravity is enabled formodel_instance
.
See also
enable(), disable().
- Raises
RuntimeError if the model instance is invalid. –
- kDefaultStrength = 9.81
- set_enabled(self: pydrake.multibody.tree.UniformGravityFieldElement_[AutoDiffXd], model_instance: pydrake.multibody.tree.ModelInstanceIndex, is_enabled: bool) None
Sets is_enabled() for
model_instance
tois_enabled
.- Raises
if the parent model is finalized. –
RuntimeError if the model instance is invalid. –
- set_gravity_vector(self: pydrake.multibody.tree.UniformGravityFieldElement_[AutoDiffXd], arg0: numpy.ndarray[numpy.float64[3, 1]]) None
Sets the acceleration of gravity vector, expressed in the world frame W in m/s².
- class pydrake.multibody.tree.UniformGravityFieldElement_[Expression]
Bases:
pydrake.multibody.tree.ForceElement_[Expression]
This ForceElement allows modeling the effect of a uniform gravity field as felt by bodies on the surface of the Earth. This gravity field acts on all bodies in the MultibodyTree model.
- __init__(*args, **kwargs)
Overloaded function.
__init__(self: pydrake.multibody.tree.UniformGravityFieldElement_[Expression]) -> None
Constructs a uniform gravity field element with a default strength (on the earth’s surface) and direction (-z).
__init__(self: pydrake.multibody.tree.UniformGravityFieldElement_[Expression], g_W: numpy.ndarray[numpy.float64[3, 1]]) -> None
Constructs a uniform gravity field element with a strength given by the acceleration of gravity vector
g_W
, expressed in the world frame W.
- CalcGravityGeneralizedForces(self: pydrake.multibody.tree.UniformGravityFieldElement_[Expression], context: pydrake.systems.framework.Context_[Expression]) numpy.ndarray[object[m, 1]]
Computes the generalized forces
tau_g(q)
due tothis
gravity field element as a function of the generalized positionsq
stored in the inputcontext
, for the multibody model to whichthis
element belongs.tau_g(q)
is defined such that it appears on the right hand side of the equations of motion together with any other generalized forces, like so:Click to expand C++ code...
Mv̇ + C(q, v)v = tau_g(q) + tau_app
where
tau_app
includes any other generalized forces applied on the system.- Parameter
context
: The context storing the state of the multibody model to which this element belongs.
- Returns
tau_g A vector containing the generalized forces due to this gravity field force element. The generalized forces are consistent with the vector of generalized velocities
v
for the parent MultibodyTree model so that the inner productv⋅tau_g
corresponds to the power applied by the gravity forces on the mechanical system. That is,v⋅tau_g > 0
corresponds to potential energy going into the system, as either mechanical kinetic energy, some other potential energy, or heat, and therefore to a decrease of potential energy.
- Parameter
- gravity_vector(self: pydrake.multibody.tree.UniformGravityFieldElement_[Expression]) numpy.ndarray[numpy.float64[3, 1]]
Returns the acceleration of the gravity vector in m/s², expressed in the world frame W.
- is_enabled(self: pydrake.multibody.tree.UniformGravityFieldElement_[Expression], model_instance: pydrake.multibody.tree.ModelInstanceIndex) bool
- Returns
True
iff gravity is enabled formodel_instance
.
See also
enable(), disable().
- Raises
RuntimeError if the model instance is invalid. –
- kDefaultStrength = 9.81
- set_enabled(self: pydrake.multibody.tree.UniformGravityFieldElement_[Expression], model_instance: pydrake.multibody.tree.ModelInstanceIndex, is_enabled: bool) None
Sets is_enabled() for
model_instance
tois_enabled
.- Raises
if the parent model is finalized. –
RuntimeError if the model instance is invalid. –
- set_gravity_vector(self: pydrake.multibody.tree.UniformGravityFieldElement_[Expression], arg0: numpy.ndarray[numpy.float64[3, 1]]) None
Sets the acceleration of gravity vector, expressed in the world frame W in m/s².
- class pydrake.multibody.tree.UnitInertia
Bases:
pydrake.multibody.tree.RotationalInertia
This class is used to represent rotational inertias for unit mass bodies. Therefore, unlike RotationalInertia whose units are kg⋅m², the units of a UnitInertia are those of length squared. A unit inertia is a useful concept to represent the geometric distribution of mass in a body regardless of the actual value of the body mass. The rotational inertia of a body can therefore be obtained by multiplying its unit inertia by its mass. Unit inertia matrices can also be called gyration matrices and therefore we choose to represent them in source code notation with the capital letter G. In contrast, the capital letter I is used to represent non-unit mass rotational inertias. This class restricts the set of allowed operations on a unit inertia to ensure the unit-mass invariant. For instance, multiplication by a scalar can only return a general RotationalInertia but not a UnitInertia.
Note
This class has no means to check at construction from user provided parameters whether it actually represents the unit inertia or gyration matrix of a unit-mass body. However, as previously noted, once a unit inertia is created, a number of operations are disallowed to ensure the unit-mass invariant. Also notice that once a unit inertia is created, it is the unit inertia of some body, perhaps with scaled geometry from the user’s intention.
Note
The methods of this class satisfy the “basic exception guarantee”: if an exception is thrown, the program will still be in a valid state. Specifically, no resources are leaked, and all objects’ invariants are intact. Be aware that UnitInertia objects may contain invalid inertia data in cases where input checking is skipped.
Note
This class is templated; see
UnitInertia_
for the list of instantiations.- __init__(*args, **kwargs)
Overloaded function.
__init__(self: pydrake.multibody.tree.UnitInertia) -> None
Default UnitInertia constructor sets all entries to NaN for quick detection of uninitialized values.
__init__(self: pydrake.multibody.tree.UnitInertia, Ixx: float, Iyy: float, Izz: float) -> None
Creates a unit inertia with moments of inertia
Ixx
, Iyy,Izz
, and with each product of inertia set to zero. In debug builds, throws RuntimeError if unit inertia constructed from these arguments violates RotationalInertia::CouldBePhysicallyValid().__init__(self: pydrake.multibody.tree.UnitInertia, Ixx: float, Iyy: float, Izz: float, Ixy: float, Ixz: float, Iyz: float) -> None
Creates a unit inertia with moments of inertia
Ixx
, Iyy,Izz
, and with products of inertiaIxy
, Ixz,Iyz
. In debug builds, throws RuntimeError if unit inertia constructed from these arguments violates RotationalInertia::CouldBePhysicallyValid().__init__(self: pydrake.multibody.tree.UnitInertia, I: pydrake.multibody.tree.RotationalInertia) -> None
Constructs a UnitInertia from a RotationalInertia. This constructor has no way to verify that the input rotational inertia actually is a unit inertia. But the construction will nevertheless succeed, and the values of the input rotational inertia will henceforth be considered a valid unit inertia.
- Precondition:
The user is responsible for passing a valid rotational inertia.
- static AxiallySymmetric(moment_parallel: float, moment_perpendicular: float, unit_vector: numpy.ndarray[numpy.float64[3, 1]]) pydrake.multibody.tree.UnitInertia
Returns the unit inertia for a body B for which there exists an axis L passing through the body’s center of mass Bcm having the property that B’s moment of inertia about all lines perpendicular to L are equal. Bodies with this “axially symmetric inertia” property include axisymmetric cylinders or cones and propellers with 3⁺ evenly spaced blades. For a body B with axially symmetric inertia, B’s unit inertia about a point Bp on axis L can be written in terms of a unit_vector parallel to L; the parallel moment of inertia J about L; and the perpendicular moment of inertia K about any line perpendicular to axis L; as:
Click to expand C++ code...
G = K * Identity + (J - K) * unit_vector ⊗ unit_vector
where
Identity
is the identity matrix and ⊗ denotes the tensor product operator. See Mitiguy, P., 2016. Advanced Dynamics & Motion Simulation.- Parameter
moment_parallel
: B’s unit moment of inertia about axis L.
- Parameter
moment_perpendicular
: (K) B’s unit moment of inertia about Bp for any line perpendicular to unit_vector.
- Parameter
unit_vector
: unit vector parallel to axis L, expressed in a frame E.
- Returns
G_BBp_E
: B’s unit inertia about point Bp on B’s symmetry axis, expressed in the same frame E as the unit_vector is expressed.
- Precondition:
Points Bp and Bcm are both on B’s symmetry axis. The actual location of these points is not known by this function. However, the value of moment_perpendicular (K) is associated with point Bp.
Note
B’s unit inertia about Bp is axially symmetric, meaning B has an equal moment of inertia about any line that both passes through Bp and is perpendicular to unit_vector.
- Raises
RuntimeError if moment_parallel (J) or moment_perpendicular (K) is –
negative or if J > 2 K (violates the triangle inequality, see –
CouldBePhysicallyValid()) or ‖unit_vector‖ is not within 1.0E-14 –
of 1.0. –
- Parameter
- static HollowSphere(r: float) pydrake.multibody.tree.UnitInertia
Computes the unit inertia for a unit-mass hollow sphere of radius
r
consisting of an infinitesimally thin shell of uniform density. The unit inertia is taken about the center of the sphere.
- static PointMass(p_FQ: numpy.ndarray[numpy.float64[3, 1]]) pydrake.multibody.tree.UnitInertia
Construct a unit inertia for a point mass of unit mass located at point Q, whose location in a frame F is given by the position vector
p_FQ
(that is, p_FoQ_F). The unit inertiaG_QFo_F
of point mass Q about the originFo
of frame F and expressed in F for this unit mass point equals the square of the cross product matrix ofp_FQ
. In coordinate-free form:\[G^{Q/F_o} = (^Fp^Q_\times)^2 = (^Fp^Q_\times)^T \, ^Fp^Q_\times = -^Fp^Q_\times \, ^Fp^Q_\times\]where \(^Fp^Q_\times\) is the cross product matrix of vector \(^Fp^Q\). In source code the above expression is written as:
Click to expand C++ code...
G_QFo_F = px_FQ² = px_FQᵀ * px_FQ = -px_FQ * px_FQ
where
px_FQ
denotes the cross product matrix of the position vectorp_FQ
(expressed in F) such that the cross product with another vectora
can be obtained aspx.cross(a) = px * a
. The cross product matrixpx
is skew-symmetric. The square of the cross product matrix is a symmetric matrix with non-negative diagonals and obeys the triangle inequality. Matrixpx²
can be used to compute the triple vector product as-p x (p x a) = -p.cross(p.cross(a)) = px² * a
.
- ReExpress(self: pydrake.multibody.tree.UnitInertia, R_AE: pydrake.math.RotationMatrix) pydrake.multibody.tree.UnitInertia
Given
this
unit inertiaG_BP_E
of a body B about a point P and expressed in frame E, this method computes the same unit inertia re-expressed in another frame A asG_BP_A = R_AE * G_BP_E * (R_AE)ᵀ
.- Parameter
R_AE
: RotationMatrix relating frames A and E.
- Returns
G_BP_A
: The same unit inertia for body B about point P but now re-expressed in frame A.
- Parameter
- SetFromRotationalInertia(self: pydrake.multibody.tree.UnitInertia, I: pydrake.multibody.tree.RotationalInertia, mass: float) pydrake.multibody.tree.UnitInertia
Sets
this
unit inertia from a generally non-unit inertia I corresponding to a body with a givenmass
.Note
In Debug builds, this operation aborts if the provided
mass
is not strictly positive.
- ShiftFromCenterOfMass(self: pydrake.multibody.tree.UnitInertia, p_BcmQ_E: numpy.ndarray[numpy.float64[3, 1]]) pydrake.multibody.tree.UnitInertia
Shifts this central unit inertia to a different point, and returns the result. See ShiftFromCenterOfMassInPlace() for details.
- Parameter
p_BcmQ_E
: A vector from the body’s centroid
Bcm
to point Q expressed in the same frame E in whichthis
inertia is expressed.- Returns
G_BQ_E
: This same unit inertia taken about a point Q instead of the centroid
Bcm
.
- Parameter
- ShiftToCenterOfMass(self: pydrake.multibody.tree.UnitInertia, p_QBcm_E: numpy.ndarray[numpy.float64[3, 1]]) pydrake.multibody.tree.UnitInertia
For the unit inertia
G_BQ_E
of a body or composite body B computed about a point Q and expressed in a frame E, this method shifts this inertia using the parallel axis theorem to be computed about the center of massBcm
of B. See ShiftToCenterOfMassInPlace() for details.- Parameter
p_QBcm_E
: A position vector from the about point Q to the body’s centroid
Bcm
expressed in the same frame E in whichthis
inertia is expressed.- Returns
G_Bcm_E
: This same unit which has now been taken about point
Bcm
so that it can be written asG_BBcm_E
, orG_Bcm_E
.
Warning
This operation could result in a non-physical rotational inertia. Use with care. See ShiftToCenterOfMassInPlace() for details.
- Parameter
- static SolidBox(Lx: float, Ly: float, Lz: float) pydrake.multibody.tree.UnitInertia
Computes the unit inertia for a unit-mass solid box of uniform density taken about its geometric center. If one length is zero the inertia corresponds to that of a thin rectangular sheet. If two lengths are zero the inertia corresponds to that of a thin rod in the remaining direction.
- Parameter
Lx
: The length of the box edge in the principal x-axis.
- Parameter
Ly
: The length of the box edge in the principal y-axis.
- Parameter
Lz
: The length of the box edge in the principal z-axis.
- Raises
RuntimeError if any of Lx, Ly, Lz are negative. –
- Parameter
- static SolidCapsule(radius: float, length: float, unit_vector: numpy.ndarray[numpy.float64[3, 1]]) pydrake.multibody.tree.UnitInertia
Creates a unit inertia for a uniform density solid capsule B about its center of mass Bcm (which is coincident with B’s geometric center Bo).
- Parameter
radius
: radius of the cylinder/half-sphere parts of the capsule.
- Parameter
length
: length of cylindrical part of the capsule.
- Parameter
unit_vector
: unit vector defining the axial direction of the cylindrical part of the capsule, expressed in a frame E.
- Returns
G_BBcm_E
: B’s unit inertia about Bcm expressed in the same frame E as the unit_vector is expressed.
Note
B’s unit inertia about Bcm is axially symmetric, meaning B has an equal moment of inertia about any line that both passes through Bcm and is perpendicular to unit_vector.
- Raises
RuntimeError if radius or length is negative or if ‖unit_vector‖ –
is not within 1.0E-14 of 1.0. –
- Parameter
- static SolidCube(L: float) pydrake.multibody.tree.UnitInertia
Computes the unit inertia for a unit-mass solid cube (a box with equal-sized sides) of uniform density taken about its geometric center.
- Parameter
L
: The length of each of the cube’s sides.
- Parameter
- static SolidCylinder(radius: float, length: float, unit_vector: numpy.ndarray[numpy.float64[3, 1]]) pydrake.multibody.tree.UnitInertia
Creates a unit inertia for a uniform density solid cylinder B about its center of mass Bcm (which is coincident with B’s geometric center Bo).
- Parameter
radius
: radius of the cylinder (meters).
- Parameter
length
: length of cylinder in unit_vector direction (meters).
- Parameter
unit_vector
: unit vector defining the axial direction of the cylinder, expressed in a frame E.
- Returns
G_BBcm_E
: B’s unit inertia about Bcm expressed in the same frame E as the unit_vector is expressed.
Note
B’s unit inertia about Bcm is axially symmetric, meaning B has an equal moment of inertia about any line that both passes through Bcm and is perpendicular to unit_vector.
- Raises
RuntimeError if radius or length is negative or if ‖unit_vector‖ –
is not within 1.0E-14 of 1.0. –
See also
SolidCylinderAboutEnd() to calculate G_BBp_E, B’s unit inertia about point Bp (Bp is at the center of one of the cylinder’s circular ends).
- Parameter
- static SolidCylinderAboutEnd(radius: float, length: float, unit_vector: numpy.ndarray[numpy.float64[3, 1]]) pydrake.multibody.tree.UnitInertia
Creates a unit inertia for a uniform-density solid cylinder B about an end-point Bp of the cylinder’s axis (see below for more about Bp).
- Parameter
radius
: radius of cylinder (meters).
- Parameter
length
: length of cylinder in unit_vector direction (meters).
- Parameter
unit_vector
: unit vector parallel to the axis of the cylinder and directed from Bp to Bcm (B’s center of mass), expressed in a frame E.
- Returns
G_BBp_E
: B’s unit inertia about Bp expressed in the same frame E as the unit_vector is expressed.
Note
The position from Bp to Bcm is p_BpBcm = length / 2 * unit_vector.
Note
B’s unit inertia about Bp is axially symmetric, meaning B has an equal moment of inertia about any line that both passes through Bp and is perpendicular to unit_vector.
- Raises
RuntimeError if radius or length is negative or if ‖unit_vector‖ –
is not within 1.0E-14 of 1.0. –
- Parameter
- static SolidEllipsoid(a: float, b: float, c: float) pydrake.multibody.tree.UnitInertia
Computes the unit inertia for a unit-mass solid ellipsoid of uniform density taken about its center. The lengths of the semi-axes of the ellipsoid in the principal x,y,z-axes are
a
, b, andc
respectively.
- static SolidSphere(r: float) pydrake.multibody.tree.UnitInertia
Computes the unit inertia for a unit-mass solid sphere of uniform density and radius
r
taken about its center.
- static StraightLine(moment_perpendicular: float, unit_vector: numpy.ndarray[numpy.float64[3, 1]]) pydrake.multibody.tree.UnitInertia
Creates a unit inertia for a straight line segment B about a point Bp on the line segment.
- Parameter
moment_perpendicular
: Unit moment of inertia about any axis that passes through Bp and is perpendicular to the line segment.
- Parameter
unit_vector
: unit vector defining the line segment’s direction, expressed in a frame E.
- Returns
G_BBp_E
: B’s unit inertia about Bp, expressed in the same frame E that the unit_vector is expressed.
Note
B’s unit inertia about Bp is axially symmetric, meaning B has an equal moment of inertia about any line that both passes through Bp and is perpendicular to unit_vector.
- Raises
RuntimeError if moment_perpendicular is not positive or if –
‖unit_vector‖ is not within 1.0E-14 of 1.0. –
Note
B’s axial moment of inertia (along the line segment) is zero.
See also
ThinRod() is an example of an object that is axially symmetric and that has a zero moment of inertia about Bp in the unit_vector direction.
- Parameter
- static ThinRod(length: float, unit_vector: numpy.ndarray[numpy.float64[3, 1]]) pydrake.multibody.tree.UnitInertia
Creates a unit inertia for a uniform density thin rod B about its center of mass Bcm (which is coincident with B’s geometric center Bo).
- Parameter
length
: length of rod in unit_vector direction (meters).
- Parameter
unit_vector
: unit vector defining the rod’s axial direction, expressed in a frame E.
- Returns
G_BBcm_E
: B’s unit inertia about Bcm expressed in the same frame E that the unit_vector is expressed.
Note
B’s unit inertia about Bcm is axially symmetric, meaning B has an equal moment of inertia about any line that both passes through Bcm and is perpendicular to unit_vector.
- Raises
RuntimeError if length is not positive or if ‖unit_vector‖ is not –
within 1.0E-14 of 1.0. –
Note
B’s axial moment of inertia (along the rod) is zero..
- Parameter
- static TriaxiallySymmetric(I_triaxial: float) pydrake.multibody.tree.UnitInertia
- template pydrake.multibody.tree.UnitInertia_
Instantiations:
UnitInertia_[float]
,UnitInertia_[AutoDiffXd]
,UnitInertia_[Expression]
- class pydrake.multibody.tree.UnitInertia_[AutoDiffXd]
Bases:
pydrake.multibody.tree.RotationalInertia_[AutoDiffXd]
This class is used to represent rotational inertias for unit mass bodies. Therefore, unlike RotationalInertia whose units are kg⋅m², the units of a UnitInertia are those of length squared. A unit inertia is a useful concept to represent the geometric distribution of mass in a body regardless of the actual value of the body mass. The rotational inertia of a body can therefore be obtained by multiplying its unit inertia by its mass. Unit inertia matrices can also be called gyration matrices and therefore we choose to represent them in source code notation with the capital letter G. In contrast, the capital letter I is used to represent non-unit mass rotational inertias. This class restricts the set of allowed operations on a unit inertia to ensure the unit-mass invariant. For instance, multiplication by a scalar can only return a general RotationalInertia but not a UnitInertia.
Note
This class has no means to check at construction from user provided parameters whether it actually represents the unit inertia or gyration matrix of a unit-mass body. However, as previously noted, once a unit inertia is created, a number of operations are disallowed to ensure the unit-mass invariant. Also notice that once a unit inertia is created, it is the unit inertia of some body, perhaps with scaled geometry from the user’s intention.
Note
The methods of this class satisfy the “basic exception guarantee”: if an exception is thrown, the program will still be in a valid state. Specifically, no resources are leaked, and all objects’ invariants are intact. Be aware that UnitInertia objects may contain invalid inertia data in cases where input checking is skipped.
- __init__(*args, **kwargs)
Overloaded function.
__init__(self: pydrake.multibody.tree.UnitInertia_[AutoDiffXd]) -> None
Default UnitInertia constructor sets all entries to NaN for quick detection of uninitialized values.
__init__(self: pydrake.multibody.tree.UnitInertia_[AutoDiffXd], Ixx: pydrake.autodiffutils.AutoDiffXd, Iyy: pydrake.autodiffutils.AutoDiffXd, Izz: pydrake.autodiffutils.AutoDiffXd) -> None
Creates a unit inertia with moments of inertia
Ixx
, Iyy,Izz
, and with each product of inertia set to zero. In debug builds, throws RuntimeError if unit inertia constructed from these arguments violates RotationalInertia::CouldBePhysicallyValid().__init__(self: pydrake.multibody.tree.UnitInertia_[AutoDiffXd], Ixx: pydrake.autodiffutils.AutoDiffXd, Iyy: pydrake.autodiffutils.AutoDiffXd, Izz: pydrake.autodiffutils.AutoDiffXd, Ixy: pydrake.autodiffutils.AutoDiffXd, Ixz: pydrake.autodiffutils.AutoDiffXd, Iyz: pydrake.autodiffutils.AutoDiffXd) -> None
Creates a unit inertia with moments of inertia
Ixx
, Iyy,Izz
, and with products of inertiaIxy
, Ixz,Iyz
. In debug builds, throws RuntimeError if unit inertia constructed from these arguments violates RotationalInertia::CouldBePhysicallyValid().__init__(self: pydrake.multibody.tree.UnitInertia_[AutoDiffXd], I: pydrake.multibody.tree.RotationalInertia_[AutoDiffXd]) -> None
Constructs a UnitInertia from a RotationalInertia. This constructor has no way to verify that the input rotational inertia actually is a unit inertia. But the construction will nevertheless succeed, and the values of the input rotational inertia will henceforth be considered a valid unit inertia.
- Precondition:
The user is responsible for passing a valid rotational inertia.
- static AxiallySymmetric(moment_parallel: pydrake.autodiffutils.AutoDiffXd, moment_perpendicular: pydrake.autodiffutils.AutoDiffXd, unit_vector: numpy.ndarray[object[3, 1]]) pydrake.multibody.tree.UnitInertia_[AutoDiffXd]
Returns the unit inertia for a body B for which there exists an axis L passing through the body’s center of mass Bcm having the property that B’s moment of inertia about all lines perpendicular to L are equal. Bodies with this “axially symmetric inertia” property include axisymmetric cylinders or cones and propellers with 3⁺ evenly spaced blades. For a body B with axially symmetric inertia, B’s unit inertia about a point Bp on axis L can be written in terms of a unit_vector parallel to L; the parallel moment of inertia J about L; and the perpendicular moment of inertia K about any line perpendicular to axis L; as:
Click to expand C++ code...
G = K * Identity + (J - K) * unit_vector ⊗ unit_vector
where
Identity
is the identity matrix and ⊗ denotes the tensor product operator. See Mitiguy, P., 2016. Advanced Dynamics & Motion Simulation.- Parameter
moment_parallel
: B’s unit moment of inertia about axis L.
- Parameter
moment_perpendicular
: (K) B’s unit moment of inertia about Bp for any line perpendicular to unit_vector.
- Parameter
unit_vector
: unit vector parallel to axis L, expressed in a frame E.
- Returns
G_BBp_E
: B’s unit inertia about point Bp on B’s symmetry axis, expressed in the same frame E as the unit_vector is expressed.
- Precondition:
Points Bp and Bcm are both on B’s symmetry axis. The actual location of these points is not known by this function. However, the value of moment_perpendicular (K) is associated with point Bp.
Note
B’s unit inertia about Bp is axially symmetric, meaning B has an equal moment of inertia about any line that both passes through Bp and is perpendicular to unit_vector.
- Raises
RuntimeError if moment_parallel (J) or moment_perpendicular (K) is –
negative or if J > 2 K (violates the triangle inequality, see –
CouldBePhysicallyValid()) or ‖unit_vector‖ is not within 1.0E-14 –
of 1.0. –
- Parameter
- static HollowSphere(r: pydrake.autodiffutils.AutoDiffXd) pydrake.multibody.tree.UnitInertia_[AutoDiffXd]
Computes the unit inertia for a unit-mass hollow sphere of radius
r
consisting of an infinitesimally thin shell of uniform density. The unit inertia is taken about the center of the sphere.
- static PointMass(p_FQ: numpy.ndarray[object[3, 1]]) pydrake.multibody.tree.UnitInertia_[AutoDiffXd]
Construct a unit inertia for a point mass of unit mass located at point Q, whose location in a frame F is given by the position vector
p_FQ
(that is, p_FoQ_F). The unit inertiaG_QFo_F
of point mass Q about the originFo
of frame F and expressed in F for this unit mass point equals the square of the cross product matrix ofp_FQ
. In coordinate-free form:\[G^{Q/F_o} = (^Fp^Q_\times)^2 = (^Fp^Q_\times)^T \, ^Fp^Q_\times = -^Fp^Q_\times \, ^Fp^Q_\times\]where \(^Fp^Q_\times\) is the cross product matrix of vector \(^Fp^Q\). In source code the above expression is written as:
Click to expand C++ code...
G_QFo_F = px_FQ² = px_FQᵀ * px_FQ = -px_FQ * px_FQ
where
px_FQ
denotes the cross product matrix of the position vectorp_FQ
(expressed in F) such that the cross product with another vectora
can be obtained aspx.cross(a) = px * a
. The cross product matrixpx
is skew-symmetric. The square of the cross product matrix is a symmetric matrix with non-negative diagonals and obeys the triangle inequality. Matrixpx²
can be used to compute the triple vector product as-p x (p x a) = -p.cross(p.cross(a)) = px² * a
.
- ReExpress(self: pydrake.multibody.tree.UnitInertia_[AutoDiffXd], R_AE: pydrake.math.RotationMatrix_[AutoDiffXd]) pydrake.multibody.tree.UnitInertia_[AutoDiffXd]
Given
this
unit inertiaG_BP_E
of a body B about a point P and expressed in frame E, this method computes the same unit inertia re-expressed in another frame A asG_BP_A = R_AE * G_BP_E * (R_AE)ᵀ
.- Parameter
R_AE
: RotationMatrix relating frames A and E.
- Returns
G_BP_A
: The same unit inertia for body B about point P but now re-expressed in frame A.
- Parameter
- SetFromRotationalInertia(self: pydrake.multibody.tree.UnitInertia_[AutoDiffXd], I: pydrake.multibody.tree.RotationalInertia_[AutoDiffXd], mass: pydrake.autodiffutils.AutoDiffXd) pydrake.multibody.tree.UnitInertia_[AutoDiffXd]
Sets
this
unit inertia from a generally non-unit inertia I corresponding to a body with a givenmass
.Note
In Debug builds, this operation aborts if the provided
mass
is not strictly positive.
- ShiftFromCenterOfMass(self: pydrake.multibody.tree.UnitInertia_[AutoDiffXd], p_BcmQ_E: numpy.ndarray[object[3, 1]]) pydrake.multibody.tree.UnitInertia_[AutoDiffXd]
Shifts this central unit inertia to a different point, and returns the result. See ShiftFromCenterOfMassInPlace() for details.
- Parameter
p_BcmQ_E
: A vector from the body’s centroid
Bcm
to point Q expressed in the same frame E in whichthis
inertia is expressed.- Returns
G_BQ_E
: This same unit inertia taken about a point Q instead of the centroid
Bcm
.
- Parameter
- ShiftToCenterOfMass(self: pydrake.multibody.tree.UnitInertia_[AutoDiffXd], p_QBcm_E: numpy.ndarray[object[3, 1]]) pydrake.multibody.tree.UnitInertia_[AutoDiffXd]
For the unit inertia
G_BQ_E
of a body or composite body B computed about a point Q and expressed in a frame E, this method shifts this inertia using the parallel axis theorem to be computed about the center of massBcm
of B. See ShiftToCenterOfMassInPlace() for details.- Parameter
p_QBcm_E
: A position vector from the about point Q to the body’s centroid
Bcm
expressed in the same frame E in whichthis
inertia is expressed.- Returns
G_Bcm_E
: This same unit which has now been taken about point
Bcm
so that it can be written asG_BBcm_E
, orG_Bcm_E
.
Warning
This operation could result in a non-physical rotational inertia. Use with care. See ShiftToCenterOfMassInPlace() for details.
- Parameter
- static SolidBox(Lx: pydrake.autodiffutils.AutoDiffXd, Ly: pydrake.autodiffutils.AutoDiffXd, Lz: pydrake.autodiffutils.AutoDiffXd) pydrake.multibody.tree.UnitInertia_[AutoDiffXd]
Computes the unit inertia for a unit-mass solid box of uniform density taken about its geometric center. If one length is zero the inertia corresponds to that of a thin rectangular sheet. If two lengths are zero the inertia corresponds to that of a thin rod in the remaining direction.
- Parameter
Lx
: The length of the box edge in the principal x-axis.
- Parameter
Ly
: The length of the box edge in the principal y-axis.
- Parameter
Lz
: The length of the box edge in the principal z-axis.
- Raises
RuntimeError if any of Lx, Ly, Lz are negative. –
- Parameter
- static SolidCapsule(radius: pydrake.autodiffutils.AutoDiffXd, length: pydrake.autodiffutils.AutoDiffXd, unit_vector: numpy.ndarray[object[3, 1]]) pydrake.multibody.tree.UnitInertia_[AutoDiffXd]
Creates a unit inertia for a uniform density solid capsule B about its center of mass Bcm (which is coincident with B’s geometric center Bo).
- Parameter
radius
: radius of the cylinder/half-sphere parts of the capsule.
- Parameter
length
: length of cylindrical part of the capsule.
- Parameter
unit_vector
: unit vector defining the axial direction of the cylindrical part of the capsule, expressed in a frame E.
- Returns
G_BBcm_E
: B’s unit inertia about Bcm expressed in the same frame E as the unit_vector is expressed.
Note
B’s unit inertia about Bcm is axially symmetric, meaning B has an equal moment of inertia about any line that both passes through Bcm and is perpendicular to unit_vector.
- Raises
RuntimeError if radius or length is negative or if ‖unit_vector‖ –
is not within 1.0E-14 of 1.0. –
- Parameter
- static SolidCube(L: pydrake.autodiffutils.AutoDiffXd) pydrake.multibody.tree.UnitInertia_[AutoDiffXd]
Computes the unit inertia for a unit-mass solid cube (a box with equal-sized sides) of uniform density taken about its geometric center.
- Parameter
L
: The length of each of the cube’s sides.
- Parameter
- static SolidCylinder(radius: pydrake.autodiffutils.AutoDiffXd, length: pydrake.autodiffutils.AutoDiffXd, unit_vector: numpy.ndarray[object[3, 1]]) pydrake.multibody.tree.UnitInertia_[AutoDiffXd]
Creates a unit inertia for a uniform density solid cylinder B about its center of mass Bcm (which is coincident with B’s geometric center Bo).
- Parameter
radius
: radius of the cylinder (meters).
- Parameter
length
: length of cylinder in unit_vector direction (meters).
- Parameter
unit_vector
: unit vector defining the axial direction of the cylinder, expressed in a frame E.
- Returns
G_BBcm_E
: B’s unit inertia about Bcm expressed in the same frame E as the unit_vector is expressed.
Note
B’s unit inertia about Bcm is axially symmetric, meaning B has an equal moment of inertia about any line that both passes through Bcm and is perpendicular to unit_vector.
- Raises
RuntimeError if radius or length is negative or if ‖unit_vector‖ –
is not within 1.0E-14 of 1.0. –
See also
SolidCylinderAboutEnd() to calculate G_BBp_E, B’s unit inertia about point Bp (Bp is at the center of one of the cylinder’s circular ends).
- Parameter
- static SolidCylinderAboutEnd(radius: pydrake.autodiffutils.AutoDiffXd, length: pydrake.autodiffutils.AutoDiffXd, unit_vector: numpy.ndarray[object[3, 1]]) pydrake.multibody.tree.UnitInertia_[AutoDiffXd]
Creates a unit inertia for a uniform-density solid cylinder B about an end-point Bp of the cylinder’s axis (see below for more about Bp).
- Parameter
radius
: radius of cylinder (meters).
- Parameter
length
: length of cylinder in unit_vector direction (meters).
- Parameter
unit_vector
: unit vector parallel to the axis of the cylinder and directed from Bp to Bcm (B’s center of mass), expressed in a frame E.
- Returns
G_BBp_E
: B’s unit inertia about Bp expressed in the same frame E as the unit_vector is expressed.
Note
The position from Bp to Bcm is p_BpBcm = length / 2 * unit_vector.
Note
B’s unit inertia about Bp is axially symmetric, meaning B has an equal moment of inertia about any line that both passes through Bp and is perpendicular to unit_vector.
- Raises
RuntimeError if radius or length is negative or if ‖unit_vector‖ –
is not within 1.0E-14 of 1.0. –
- Parameter
- static SolidEllipsoid(a: pydrake.autodiffutils.AutoDiffXd, b: pydrake.autodiffutils.AutoDiffXd, c: pydrake.autodiffutils.AutoDiffXd) pydrake.multibody.tree.UnitInertia_[AutoDiffXd]
Computes the unit inertia for a unit-mass solid ellipsoid of uniform density taken about its center. The lengths of the semi-axes of the ellipsoid in the principal x,y,z-axes are
a
, b, andc
respectively.
- static SolidSphere(r: pydrake.autodiffutils.AutoDiffXd) pydrake.multibody.tree.UnitInertia_[AutoDiffXd]
Computes the unit inertia for a unit-mass solid sphere of uniform density and radius
r
taken about its center.
- static StraightLine(moment_perpendicular: pydrake.autodiffutils.AutoDiffXd, unit_vector: numpy.ndarray[object[3, 1]]) pydrake.multibody.tree.UnitInertia_[AutoDiffXd]
Creates a unit inertia for a straight line segment B about a point Bp on the line segment.
- Parameter
moment_perpendicular
: Unit moment of inertia about any axis that passes through Bp and is perpendicular to the line segment.
- Parameter
unit_vector
: unit vector defining the line segment’s direction, expressed in a frame E.
- Returns
G_BBp_E
: B’s unit inertia about Bp, expressed in the same frame E that the unit_vector is expressed.
Note
B’s unit inertia about Bp is axially symmetric, meaning B has an equal moment of inertia about any line that both passes through Bp and is perpendicular to unit_vector.
- Raises
RuntimeError if moment_perpendicular is not positive or if –
‖unit_vector‖ is not within 1.0E-14 of 1.0. –
Note
B’s axial moment of inertia (along the line segment) is zero.
See also
ThinRod() is an example of an object that is axially symmetric and that has a zero moment of inertia about Bp in the unit_vector direction.
- Parameter
- static ThinRod(length: pydrake.autodiffutils.AutoDiffXd, unit_vector: numpy.ndarray[object[3, 1]]) pydrake.multibody.tree.UnitInertia_[AutoDiffXd]
Creates a unit inertia for a uniform density thin rod B about its center of mass Bcm (which is coincident with B’s geometric center Bo).
- Parameter
length
: length of rod in unit_vector direction (meters).
- Parameter
unit_vector
: unit vector defining the rod’s axial direction, expressed in a frame E.
- Returns
G_BBcm_E
: B’s unit inertia about Bcm expressed in the same frame E that the unit_vector is expressed.
Note
B’s unit inertia about Bcm is axially symmetric, meaning B has an equal moment of inertia about any line that both passes through Bcm and is perpendicular to unit_vector.
- Raises
RuntimeError if length is not positive or if ‖unit_vector‖ is not –
within 1.0E-14 of 1.0. –
Note
B’s axial moment of inertia (along the rod) is zero..
- Parameter
- static TriaxiallySymmetric(I_triaxial: pydrake.autodiffutils.AutoDiffXd) pydrake.multibody.tree.UnitInertia_[AutoDiffXd]
- class pydrake.multibody.tree.UnitInertia_[Expression]
Bases:
pydrake.multibody.tree.RotationalInertia_[Expression]
This class is used to represent rotational inertias for unit mass bodies. Therefore, unlike RotationalInertia whose units are kg⋅m², the units of a UnitInertia are those of length squared. A unit inertia is a useful concept to represent the geometric distribution of mass in a body regardless of the actual value of the body mass. The rotational inertia of a body can therefore be obtained by multiplying its unit inertia by its mass. Unit inertia matrices can also be called gyration matrices and therefore we choose to represent them in source code notation with the capital letter G. In contrast, the capital letter I is used to represent non-unit mass rotational inertias. This class restricts the set of allowed operations on a unit inertia to ensure the unit-mass invariant. For instance, multiplication by a scalar can only return a general RotationalInertia but not a UnitInertia.
Note
This class has no means to check at construction from user provided parameters whether it actually represents the unit inertia or gyration matrix of a unit-mass body. However, as previously noted, once a unit inertia is created, a number of operations are disallowed to ensure the unit-mass invariant. Also notice that once a unit inertia is created, it is the unit inertia of some body, perhaps with scaled geometry from the user’s intention.
Note
The methods of this class satisfy the “basic exception guarantee”: if an exception is thrown, the program will still be in a valid state. Specifically, no resources are leaked, and all objects’ invariants are intact. Be aware that UnitInertia objects may contain invalid inertia data in cases where input checking is skipped.
- __init__(*args, **kwargs)
Overloaded function.
__init__(self: pydrake.multibody.tree.UnitInertia_[Expression]) -> None
Default UnitInertia constructor sets all entries to NaN for quick detection of uninitialized values.
__init__(self: pydrake.multibody.tree.UnitInertia_[Expression], Ixx: pydrake.symbolic.Expression, Iyy: pydrake.symbolic.Expression, Izz: pydrake.symbolic.Expression) -> None
Creates a unit inertia with moments of inertia
Ixx
, Iyy,Izz
, and with each product of inertia set to zero. In debug builds, throws RuntimeError if unit inertia constructed from these arguments violates RotationalInertia::CouldBePhysicallyValid().__init__(self: pydrake.multibody.tree.UnitInertia_[Expression], Ixx: pydrake.symbolic.Expression, Iyy: pydrake.symbolic.Expression, Izz: pydrake.symbolic.Expression, Ixy: pydrake.symbolic.Expression, Ixz: pydrake.symbolic.Expression, Iyz: pydrake.symbolic.Expression) -> None
Creates a unit inertia with moments of inertia
Ixx
, Iyy,Izz
, and with products of inertiaIxy
, Ixz,Iyz
. In debug builds, throws RuntimeError if unit inertia constructed from these arguments violates RotationalInertia::CouldBePhysicallyValid().__init__(self: pydrake.multibody.tree.UnitInertia_[Expression], I: pydrake.multibody.tree.RotationalInertia_[Expression]) -> None
Constructs a UnitInertia from a RotationalInertia. This constructor has no way to verify that the input rotational inertia actually is a unit inertia. But the construction will nevertheless succeed, and the values of the input rotational inertia will henceforth be considered a valid unit inertia.
- Precondition:
The user is responsible for passing a valid rotational inertia.
- static AxiallySymmetric(moment_parallel: pydrake.symbolic.Expression, moment_perpendicular: pydrake.symbolic.Expression, unit_vector: numpy.ndarray[object[3, 1]]) pydrake.multibody.tree.UnitInertia_[Expression]
Returns the unit inertia for a body B for which there exists an axis L passing through the body’s center of mass Bcm having the property that B’s moment of inertia about all lines perpendicular to L are equal. Bodies with this “axially symmetric inertia” property include axisymmetric cylinders or cones and propellers with 3⁺ evenly spaced blades. For a body B with axially symmetric inertia, B’s unit inertia about a point Bp on axis L can be written in terms of a unit_vector parallel to L; the parallel moment of inertia J about L; and the perpendicular moment of inertia K about any line perpendicular to axis L; as:
Click to expand C++ code...
G = K * Identity + (J - K) * unit_vector ⊗ unit_vector
where
Identity
is the identity matrix and ⊗ denotes the tensor product operator. See Mitiguy, P., 2016. Advanced Dynamics & Motion Simulation.- Parameter
moment_parallel
: B’s unit moment of inertia about axis L.
- Parameter
moment_perpendicular
: (K) B’s unit moment of inertia about Bp for any line perpendicular to unit_vector.
- Parameter
unit_vector
: unit vector parallel to axis L, expressed in a frame E.
- Returns
G_BBp_E
: B’s unit inertia about point Bp on B’s symmetry axis, expressed in the same frame E as the unit_vector is expressed.
- Precondition:
Points Bp and Bcm are both on B’s symmetry axis. The actual location of these points is not known by this function. However, the value of moment_perpendicular (K) is associated with point Bp.
Note
B’s unit inertia about Bp is axially symmetric, meaning B has an equal moment of inertia about any line that both passes through Bp and is perpendicular to unit_vector.
- Raises
RuntimeError if moment_parallel (J) or moment_perpendicular (K) is –
negative or if J > 2 K (violates the triangle inequality, see –
CouldBePhysicallyValid()) or ‖unit_vector‖ is not within 1.0E-14 –
of 1.0. –
- Parameter
- static HollowSphere(r: pydrake.symbolic.Expression) pydrake.multibody.tree.UnitInertia_[Expression]
Computes the unit inertia for a unit-mass hollow sphere of radius
r
consisting of an infinitesimally thin shell of uniform density. The unit inertia is taken about the center of the sphere.
- static PointMass(p_FQ: numpy.ndarray[object[3, 1]]) pydrake.multibody.tree.UnitInertia_[Expression]
Construct a unit inertia for a point mass of unit mass located at point Q, whose location in a frame F is given by the position vector
p_FQ
(that is, p_FoQ_F). The unit inertiaG_QFo_F
of point mass Q about the originFo
of frame F and expressed in F for this unit mass point equals the square of the cross product matrix ofp_FQ
. In coordinate-free form:\[G^{Q/F_o} = (^Fp^Q_\times)^2 = (^Fp^Q_\times)^T \, ^Fp^Q_\times = -^Fp^Q_\times \, ^Fp^Q_\times\]where \(^Fp^Q_\times\) is the cross product matrix of vector \(^Fp^Q\). In source code the above expression is written as:
Click to expand C++ code...
G_QFo_F = px_FQ² = px_FQᵀ * px_FQ = -px_FQ * px_FQ
where
px_FQ
denotes the cross product matrix of the position vectorp_FQ
(expressed in F) such that the cross product with another vectora
can be obtained aspx.cross(a) = px * a
. The cross product matrixpx
is skew-symmetric. The square of the cross product matrix is a symmetric matrix with non-negative diagonals and obeys the triangle inequality. Matrixpx²
can be used to compute the triple vector product as-p x (p x a) = -p.cross(p.cross(a)) = px² * a
.
- ReExpress(self: pydrake.multibody.tree.UnitInertia_[Expression], R_AE: pydrake.math.RotationMatrix_[Expression]) pydrake.multibody.tree.UnitInertia_[Expression]
Given
this
unit inertiaG_BP_E
of a body B about a point P and expressed in frame E, this method computes the same unit inertia re-expressed in another frame A asG_BP_A = R_AE * G_BP_E * (R_AE)ᵀ
.- Parameter
R_AE
: RotationMatrix relating frames A and E.
- Returns
G_BP_A
: The same unit inertia for body B about point P but now re-expressed in frame A.
- Parameter
- SetFromRotationalInertia(self: pydrake.multibody.tree.UnitInertia_[Expression], I: pydrake.multibody.tree.RotationalInertia_[Expression], mass: pydrake.symbolic.Expression) pydrake.multibody.tree.UnitInertia_[Expression]
Sets
this
unit inertia from a generally non-unit inertia I corresponding to a body with a givenmass
.Note
In Debug builds, this operation aborts if the provided
mass
is not strictly positive.
- ShiftFromCenterOfMass(self: pydrake.multibody.tree.UnitInertia_[Expression], p_BcmQ_E: numpy.ndarray[object[3, 1]]) pydrake.multibody.tree.UnitInertia_[Expression]
Shifts this central unit inertia to a different point, and returns the result. See ShiftFromCenterOfMassInPlace() for details.
- Parameter
p_BcmQ_E
: A vector from the body’s centroid
Bcm
to point Q expressed in the same frame E in whichthis
inertia is expressed.- Returns
G_BQ_E
: This same unit inertia taken about a point Q instead of the centroid
Bcm
.
- Parameter
- ShiftToCenterOfMass(self: pydrake.multibody.tree.UnitInertia_[Expression], p_QBcm_E: numpy.ndarray[object[3, 1]]) pydrake.multibody.tree.UnitInertia_[Expression]
For the unit inertia
G_BQ_E
of a body or composite body B computed about a point Q and expressed in a frame E, this method shifts this inertia using the parallel axis theorem to be computed about the center of massBcm
of B. See ShiftToCenterOfMassInPlace() for details.- Parameter
p_QBcm_E
: A position vector from the about point Q to the body’s centroid
Bcm
expressed in the same frame E in whichthis
inertia is expressed.- Returns
G_Bcm_E
: This same unit which has now been taken about point
Bcm
so that it can be written asG_BBcm_E
, orG_Bcm_E
.
Warning
This operation could result in a non-physical rotational inertia. Use with care. See ShiftToCenterOfMassInPlace() for details.
- Parameter
- static SolidBox(Lx: pydrake.symbolic.Expression, Ly: pydrake.symbolic.Expression, Lz: pydrake.symbolic.Expression) pydrake.multibody.tree.UnitInertia_[Expression]
Computes the unit inertia for a unit-mass solid box of uniform density taken about its geometric center. If one length is zero the inertia corresponds to that of a thin rectangular sheet. If two lengths are zero the inertia corresponds to that of a thin rod in the remaining direction.
- Parameter
Lx
: The length of the box edge in the principal x-axis.
- Parameter
Ly
: The length of the box edge in the principal y-axis.
- Parameter
Lz
: The length of the box edge in the principal z-axis.
- Raises
RuntimeError if any of Lx, Ly, Lz are negative. –
- Parameter
- static SolidCapsule(radius: pydrake.symbolic.Expression, length: pydrake.symbolic.Expression, unit_vector: numpy.ndarray[object[3, 1]]) pydrake.multibody.tree.UnitInertia_[Expression]
Creates a unit inertia for a uniform density solid capsule B about its center of mass Bcm (which is coincident with B’s geometric center Bo).
- Parameter
radius
: radius of the cylinder/half-sphere parts of the capsule.
- Parameter
length
: length of cylindrical part of the capsule.
- Parameter
unit_vector
: unit vector defining the axial direction of the cylindrical part of the capsule, expressed in a frame E.
- Returns
G_BBcm_E
: B’s unit inertia about Bcm expressed in the same frame E as the unit_vector is expressed.
Note
B’s unit inertia about Bcm is axially symmetric, meaning B has an equal moment of inertia about any line that both passes through Bcm and is perpendicular to unit_vector.
- Raises
RuntimeError if radius or length is negative or if ‖unit_vector‖ –
is not within 1.0E-14 of 1.0. –
- Parameter
- static SolidCube(L: pydrake.symbolic.Expression) pydrake.multibody.tree.UnitInertia_[Expression]
Computes the unit inertia for a unit-mass solid cube (a box with equal-sized sides) of uniform density taken about its geometric center.
- Parameter
L
: The length of each of the cube’s sides.
- Parameter
- static SolidCylinder(radius: pydrake.symbolic.Expression, length: pydrake.symbolic.Expression, unit_vector: numpy.ndarray[object[3, 1]]) pydrake.multibody.tree.UnitInertia_[Expression]
Creates a unit inertia for a uniform density solid cylinder B about its center of mass Bcm (which is coincident with B’s geometric center Bo).
- Parameter
radius
: radius of the cylinder (meters).
- Parameter
length
: length of cylinder in unit_vector direction (meters).
- Parameter
unit_vector
: unit vector defining the axial direction of the cylinder, expressed in a frame E.
- Returns
G_BBcm_E
: B’s unit inertia about Bcm expressed in the same frame E as the unit_vector is expressed.
Note
B’s unit inertia about Bcm is axially symmetric, meaning B has an equal moment of inertia about any line that both passes through Bcm and is perpendicular to unit_vector.
- Raises
RuntimeError if radius or length is negative or if ‖unit_vector‖ –
is not within 1.0E-14 of 1.0. –
See also
SolidCylinderAboutEnd() to calculate G_BBp_E, B’s unit inertia about point Bp (Bp is at the center of one of the cylinder’s circular ends).
- Parameter
- static SolidCylinderAboutEnd(radius: pydrake.symbolic.Expression, length: pydrake.symbolic.Expression, unit_vector: numpy.ndarray[object[3, 1]]) pydrake.multibody.tree.UnitInertia_[Expression]
Creates a unit inertia for a uniform-density solid cylinder B about an end-point Bp of the cylinder’s axis (see below for more about Bp).
- Parameter
radius
: radius of cylinder (meters).
- Parameter
length
: length of cylinder in unit_vector direction (meters).
- Parameter
unit_vector
: unit vector parallel to the axis of the cylinder and directed from Bp to Bcm (B’s center of mass), expressed in a frame E.
- Returns
G_BBp_E
: B’s unit inertia about Bp expressed in the same frame E as the unit_vector is expressed.
Note
The position from Bp to Bcm is p_BpBcm = length / 2 * unit_vector.
Note
B’s unit inertia about Bp is axially symmetric, meaning B has an equal moment of inertia about any line that both passes through Bp and is perpendicular to unit_vector.
- Raises
RuntimeError if radius or length is negative or if ‖unit_vector‖ –
is not within 1.0E-14 of 1.0. –
- Parameter
- static SolidEllipsoid(a: pydrake.symbolic.Expression, b: pydrake.symbolic.Expression, c: pydrake.symbolic.Expression) pydrake.multibody.tree.UnitInertia_[Expression]
Computes the unit inertia for a unit-mass solid ellipsoid of uniform density taken about its center. The lengths of the semi-axes of the ellipsoid in the principal x,y,z-axes are
a
, b, andc
respectively.
- static SolidSphere(r: pydrake.symbolic.Expression) pydrake.multibody.tree.UnitInertia_[Expression]
Computes the unit inertia for a unit-mass solid sphere of uniform density and radius
r
taken about its center.
- static StraightLine(moment_perpendicular: pydrake.symbolic.Expression, unit_vector: numpy.ndarray[object[3, 1]]) pydrake.multibody.tree.UnitInertia_[Expression]
Creates a unit inertia for a straight line segment B about a point Bp on the line segment.
- Parameter
moment_perpendicular
: Unit moment of inertia about any axis that passes through Bp and is perpendicular to the line segment.
- Parameter
unit_vector
: unit vector defining the line segment’s direction, expressed in a frame E.
- Returns
G_BBp_E
: B’s unit inertia about Bp, expressed in the same frame E that the unit_vector is expressed.
Note
B’s unit inertia about Bp is axially symmetric, meaning B has an equal moment of inertia about any line that both passes through Bp and is perpendicular to unit_vector.
- Raises
RuntimeError if moment_perpendicular is not positive or if –
‖unit_vector‖ is not within 1.0E-14 of 1.0. –
Note
B’s axial moment of inertia (along the line segment) is zero.
See also
ThinRod() is an example of an object that is axially symmetric and that has a zero moment of inertia about Bp in the unit_vector direction.
- Parameter
- static ThinRod(length: pydrake.symbolic.Expression, unit_vector: numpy.ndarray[object[3, 1]]) pydrake.multibody.tree.UnitInertia_[Expression]
Creates a unit inertia for a uniform density thin rod B about its center of mass Bcm (which is coincident with B’s geometric center Bo).
- Parameter
length
: length of rod in unit_vector direction (meters).
- Parameter
unit_vector
: unit vector defining the rod’s axial direction, expressed in a frame E.
- Returns
G_BBcm_E
: B’s unit inertia about Bcm expressed in the same frame E that the unit_vector is expressed.
Note
B’s unit inertia about Bcm is axially symmetric, meaning B has an equal moment of inertia about any line that both passes through Bcm and is perpendicular to unit_vector.
- Raises
RuntimeError if length is not positive or if ‖unit_vector‖ is not –
within 1.0E-14 of 1.0. –
Note
B’s axial moment of inertia (along the rod) is zero..
- Parameter
- static TriaxiallySymmetric(I_triaxial: pydrake.symbolic.Expression) pydrake.multibody.tree.UnitInertia_[Expression]
- class pydrake.multibody.tree.UniversalJoint
Bases:
pydrake.multibody.tree.Joint
This joint models a universal joint allowing two bodies to rotate relative to one another with two degrees of freedom. A universal joint can be thought of as a mechanism consisting of three bodies; the parent body P, an intermediate cross-shaped body I, and the child body B. In a physical universal joint, body I has a significantly smaller mass than P or B. This universal joint model corresponds to the mathematical limit of having a body I of negligible mass. Given a frame F attached to the parent body P and a frame M attached to the child body B (see the Joint class’s documentation), the orientation of M in F can then naturally be defined as follows using a body fixed rotation sequence. A first rotation of θ₁ about Fx defines the orientation R_FI of the intermediate frame I attached to body I (notice that by definition Ix = Fx at all times). A second rotation of θ₂ about Iy defines the orientation R_IM of frame M (notice that by definition My = Iy at all times). Mathematically, the orientation of frame M in F is given by
Click to expand C++ code...
R_FM(q) = R_FI(θ₁) * R_IM(θ₂)
No translational motion of M in F is allowed and the origins,
Mo
andFo
, of frames M and F respectively remain coincident. The angles of rotation about F’s x-axis and M’s y-axis, along with their rates, specify the state of the joint. Zero θ₁, θ₂ angles corresponds to frames F, I, and M being coincident. Angles (θ₁, θ₂) are defined to be positive according to the right-hand-rule with the thumb aligned in the direction of their respective axes.Note
This class is templated; see
UniversalJoint_
for the list of instantiations.- __init__(self: pydrake.multibody.tree.UniversalJoint, name: str, frame_on_parent: pydrake.multibody.tree.Frame, frame_on_child: pydrake.multibody.tree.Frame, damping: float = 0) None
Constructor to create a universal joint between two bodies so that frame F attached to the parent body P and frame M attached to the child body B rotate as described in the class’s documentation. See class documentation for details on the angles defining orientation. This constructor signature creates a joint with no joint limits, i.e. the joint position, velocity and acceleration limits are the pair
(-∞, ∞)
. These can be set using the Joint methods set_position_limits(), set_velocity_limits() and set_acceleration_limits(). The first three arguments to this constructor are those of the Joint class constructor. See the Joint class’s documentation for details. The additional parameters are:- Parameter
damping
: Viscous damping coefficient, in N⋅m⋅s, used to model losses within the joint. See documentation of default_damping() for details on modelling of the damping torque.
- Raises
RuntimeError if damping is negative. –
- Parameter
- default_damping(self: pydrake.multibody.tree.UniversalJoint) float
Returns
this
joint’s default damping constant in N⋅m⋅s. The damping torque (in N⋅m) is modeled asτᵢ = -damping⋅ωᵢ, i = 1, 2
i.e. opposing motion, with ωᵢ the angular rates about the i-th axis forthis
joint (see get_angular_rates())and τᵢ the torque on child body B about the same i-th axis.
- get_angles(self: pydrake.multibody.tree.UniversalJoint, context: pydrake.systems.framework.Context) numpy.ndarray[numpy.float64[2, 1]]
Gets the rotation angles of
this
joint fromcontext
. See class documentation for the definition of these angles.- Parameter
context
: The context of the model this joint belongs to.
- Returns
The angle coordinates of
this
joint stored in thecontext
ordered as (θ₁, θ₂).
- Parameter
- get_angular_rates(self: pydrake.multibody.tree.UniversalJoint, context: pydrake.systems.framework.Context) numpy.ndarray[numpy.float64[2, 1]]
Gets the rates of change, in radians per second, of
this
joint’s angles (see class documentation) fromcontext
.- Parameter
context
: The context of the model this joint belongs to.
- Returns
The rates of change of
this
joint’s angles as stored in thecontext
.
- Parameter
- get_default_angles(self: pydrake.multibody.tree.UniversalJoint) numpy.ndarray[numpy.float64[2, 1]]
Gets the default angles for
this
joint. Wrapper for the more generalJoint::default_positions()
.- Returns
The default angles of
this
stored indefault_positions_
- kTypeName = 'universal'
- set_angles(self: pydrake.multibody.tree.UniversalJoint, context: pydrake.systems.framework.Context, angles: numpy.ndarray[numpy.float64[2, 1]]) pydrake.multibody.tree.UniversalJoint
Sets the
context
so that the generalized coordinates corresponding to the rotation angles ofthis
joint equalsangles
.- Parameter
context
: The context of the model this joint belongs to.
- Parameter
angles
: The desired angles in radians to be stored in
context
ordered as (θ₁, θ₂). See class documentation for details.
- Returns
a constant reference to
this
joint.
- Parameter
- set_angular_rates(self: pydrake.multibody.tree.UniversalJoint, context: pydrake.systems.framework.Context, theta_dot: numpy.ndarray[numpy.float64[2, 1]]) pydrake.multibody.tree.UniversalJoint
Sets the rates of change, in radians per second, of this
this
joint’s angles (see class documentation) totheta_dot
. The new rates of change get stored incontext
.- Parameter
context
: The context of the model this joint belongs to.
- Parameter
theta_dot
: The desired rates of change of
this
joints’s angles in radians per second.
- Returns
a constant reference to
this
joint.
- Parameter
- set_default_angles(self: pydrake.multibody.tree.UniversalJoint, angles: numpy.ndarray[numpy.float64[2, 1]]) None
Sets the default angles of this joint.
- Parameter
angles
: The desired default angles of the joint
- Parameter
- set_random_angles_distribution(self: pydrake.multibody.tree.UniversalJoint, angles: numpy.ndarray[object[2, 1]]) None
Sets the random distribution that angles of this joint will be randomly sampled from. See class documentation for details on the definition of the angles.
- template pydrake.multibody.tree.UniversalJoint_
Instantiations:
UniversalJoint_[float]
,UniversalJoint_[AutoDiffXd]
,UniversalJoint_[Expression]
- class pydrake.multibody.tree.UniversalJoint_[AutoDiffXd]
Bases:
pydrake.multibody.tree.Joint_[AutoDiffXd]
This joint models a universal joint allowing two bodies to rotate relative to one another with two degrees of freedom. A universal joint can be thought of as a mechanism consisting of three bodies; the parent body P, an intermediate cross-shaped body I, and the child body B. In a physical universal joint, body I has a significantly smaller mass than P or B. This universal joint model corresponds to the mathematical limit of having a body I of negligible mass. Given a frame F attached to the parent body P and a frame M attached to the child body B (see the Joint class’s documentation), the orientation of M in F can then naturally be defined as follows using a body fixed rotation sequence. A first rotation of θ₁ about Fx defines the orientation R_FI of the intermediate frame I attached to body I (notice that by definition Ix = Fx at all times). A second rotation of θ₂ about Iy defines the orientation R_IM of frame M (notice that by definition My = Iy at all times). Mathematically, the orientation of frame M in F is given by
Click to expand C++ code...
R_FM(q) = R_FI(θ₁) * R_IM(θ₂)
No translational motion of M in F is allowed and the origins,
Mo
andFo
, of frames M and F respectively remain coincident. The angles of rotation about F’s x-axis and M’s y-axis, along with their rates, specify the state of the joint. Zero θ₁, θ₂ angles corresponds to frames F, I, and M being coincident. Angles (θ₁, θ₂) are defined to be positive according to the right-hand-rule with the thumb aligned in the direction of their respective axes.- __init__(self: pydrake.multibody.tree.UniversalJoint_[AutoDiffXd], name: str, frame_on_parent: pydrake.multibody.tree.Frame_[AutoDiffXd], frame_on_child: pydrake.multibody.tree.Frame_[AutoDiffXd], damping: float = 0) None
Constructor to create a universal joint between two bodies so that frame F attached to the parent body P and frame M attached to the child body B rotate as described in the class’s documentation. See class documentation for details on the angles defining orientation. This constructor signature creates a joint with no joint limits, i.e. the joint position, velocity and acceleration limits are the pair
(-∞, ∞)
. These can be set using the Joint methods set_position_limits(), set_velocity_limits() and set_acceleration_limits(). The first three arguments to this constructor are those of the Joint class constructor. See the Joint class’s documentation for details. The additional parameters are:- Parameter
damping
: Viscous damping coefficient, in N⋅m⋅s, used to model losses within the joint. See documentation of default_damping() for details on modelling of the damping torque.
- Raises
RuntimeError if damping is negative. –
- Parameter
- default_damping(self: pydrake.multibody.tree.UniversalJoint_[AutoDiffXd]) float
Returns
this
joint’s default damping constant in N⋅m⋅s. The damping torque (in N⋅m) is modeled asτᵢ = -damping⋅ωᵢ, i = 1, 2
i.e. opposing motion, with ωᵢ the angular rates about the i-th axis forthis
joint (see get_angular_rates())and τᵢ the torque on child body B about the same i-th axis.
- get_angles(self: pydrake.multibody.tree.UniversalJoint_[AutoDiffXd], context: pydrake.systems.framework.Context_[AutoDiffXd]) numpy.ndarray[object[2, 1]]
Gets the rotation angles of
this
joint fromcontext
. See class documentation for the definition of these angles.- Parameter
context
: The context of the model this joint belongs to.
- Returns
The angle coordinates of
this
joint stored in thecontext
ordered as (θ₁, θ₂).
- Parameter
- get_angular_rates(self: pydrake.multibody.tree.UniversalJoint_[AutoDiffXd], context: pydrake.systems.framework.Context_[AutoDiffXd]) numpy.ndarray[object[2, 1]]
Gets the rates of change, in radians per second, of
this
joint’s angles (see class documentation) fromcontext
.- Parameter
context
: The context of the model this joint belongs to.
- Returns
The rates of change of
this
joint’s angles as stored in thecontext
.
- Parameter
- get_default_angles(self: pydrake.multibody.tree.UniversalJoint_[AutoDiffXd]) numpy.ndarray[numpy.float64[2, 1]]
Gets the default angles for
this
joint. Wrapper for the more generalJoint::default_positions()
.- Returns
The default angles of
this
stored indefault_positions_
- kTypeName = 'universal'
- set_angles(self: pydrake.multibody.tree.UniversalJoint_[AutoDiffXd], context: pydrake.systems.framework.Context_[AutoDiffXd], angles: numpy.ndarray[object[2, 1]]) pydrake.multibody.tree.UniversalJoint_[AutoDiffXd]
Sets the
context
so that the generalized coordinates corresponding to the rotation angles ofthis
joint equalsangles
.- Parameter
context
: The context of the model this joint belongs to.
- Parameter
angles
: The desired angles in radians to be stored in
context
ordered as (θ₁, θ₂). See class documentation for details.
- Returns
a constant reference to
this
joint.
- Parameter
- set_angular_rates(self: pydrake.multibody.tree.UniversalJoint_[AutoDiffXd], context: pydrake.systems.framework.Context_[AutoDiffXd], theta_dot: numpy.ndarray[object[2, 1]]) pydrake.multibody.tree.UniversalJoint_[AutoDiffXd]
Sets the rates of change, in radians per second, of this
this
joint’s angles (see class documentation) totheta_dot
. The new rates of change get stored incontext
.- Parameter
context
: The context of the model this joint belongs to.
- Parameter
theta_dot
: The desired rates of change of
this
joints’s angles in radians per second.
- Returns
a constant reference to
this
joint.
- Parameter
- set_default_angles(self: pydrake.multibody.tree.UniversalJoint_[AutoDiffXd], angles: numpy.ndarray[numpy.float64[2, 1]]) None
Sets the default angles of this joint.
- Parameter
angles
: The desired default angles of the joint
- Parameter
- set_random_angles_distribution(self: pydrake.multibody.tree.UniversalJoint_[AutoDiffXd], angles: numpy.ndarray[object[2, 1]]) None
Sets the random distribution that angles of this joint will be randomly sampled from. See class documentation for details on the definition of the angles.
- class pydrake.multibody.tree.UniversalJoint_[Expression]
Bases:
pydrake.multibody.tree.Joint_[Expression]
This joint models a universal joint allowing two bodies to rotate relative to one another with two degrees of freedom. A universal joint can be thought of as a mechanism consisting of three bodies; the parent body P, an intermediate cross-shaped body I, and the child body B. In a physical universal joint, body I has a significantly smaller mass than P or B. This universal joint model corresponds to the mathematical limit of having a body I of negligible mass. Given a frame F attached to the parent body P and a frame M attached to the child body B (see the Joint class’s documentation), the orientation of M in F can then naturally be defined as follows using a body fixed rotation sequence. A first rotation of θ₁ about Fx defines the orientation R_FI of the intermediate frame I attached to body I (notice that by definition Ix = Fx at all times). A second rotation of θ₂ about Iy defines the orientation R_IM of frame M (notice that by definition My = Iy at all times). Mathematically, the orientation of frame M in F is given by
Click to expand C++ code...
R_FM(q) = R_FI(θ₁) * R_IM(θ₂)
No translational motion of M in F is allowed and the origins,
Mo
andFo
, of frames M and F respectively remain coincident. The angles of rotation about F’s x-axis and M’s y-axis, along with their rates, specify the state of the joint. Zero θ₁, θ₂ angles corresponds to frames F, I, and M being coincident. Angles (θ₁, θ₂) are defined to be positive according to the right-hand-rule with the thumb aligned in the direction of their respective axes.- __init__(self: pydrake.multibody.tree.UniversalJoint_[Expression], name: str, frame_on_parent: pydrake.multibody.tree.Frame_[Expression], frame_on_child: pydrake.multibody.tree.Frame_[Expression], damping: float = 0) None
Constructor to create a universal joint between two bodies so that frame F attached to the parent body P and frame M attached to the child body B rotate as described in the class’s documentation. See class documentation for details on the angles defining orientation. This constructor signature creates a joint with no joint limits, i.e. the joint position, velocity and acceleration limits are the pair
(-∞, ∞)
. These can be set using the Joint methods set_position_limits(), set_velocity_limits() and set_acceleration_limits(). The first three arguments to this constructor are those of the Joint class constructor. See the Joint class’s documentation for details. The additional parameters are:- Parameter
damping
: Viscous damping coefficient, in N⋅m⋅s, used to model losses within the joint. See documentation of default_damping() for details on modelling of the damping torque.
- Raises
RuntimeError if damping is negative. –
- Parameter
- default_damping(self: pydrake.multibody.tree.UniversalJoint_[Expression]) float
Returns
this
joint’s default damping constant in N⋅m⋅s. The damping torque (in N⋅m) is modeled asτᵢ = -damping⋅ωᵢ, i = 1, 2
i.e. opposing motion, with ωᵢ the angular rates about the i-th axis forthis
joint (see get_angular_rates())and τᵢ the torque on child body B about the same i-th axis.
- get_angles(self: pydrake.multibody.tree.UniversalJoint_[Expression], context: pydrake.systems.framework.Context_[Expression]) numpy.ndarray[object[2, 1]]
Gets the rotation angles of
this
joint fromcontext
. See class documentation for the definition of these angles.- Parameter
context
: The context of the model this joint belongs to.
- Returns
The angle coordinates of
this
joint stored in thecontext
ordered as (θ₁, θ₂).
- Parameter
- get_angular_rates(self: pydrake.multibody.tree.UniversalJoint_[Expression], context: pydrake.systems.framework.Context_[Expression]) numpy.ndarray[object[2, 1]]
Gets the rates of change, in radians per second, of
this
joint’s angles (see class documentation) fromcontext
.- Parameter
context
: The context of the model this joint belongs to.
- Returns
The rates of change of
this
joint’s angles as stored in thecontext
.
- Parameter
- get_default_angles(self: pydrake.multibody.tree.UniversalJoint_[Expression]) numpy.ndarray[numpy.float64[2, 1]]
Gets the default angles for
this
joint. Wrapper for the more generalJoint::default_positions()
.- Returns
The default angles of
this
stored indefault_positions_
- kTypeName = 'universal'
- set_angles(self: pydrake.multibody.tree.UniversalJoint_[Expression], context: pydrake.systems.framework.Context_[Expression], angles: numpy.ndarray[object[2, 1]]) pydrake.multibody.tree.UniversalJoint_[Expression]
Sets the
context
so that the generalized coordinates corresponding to the rotation angles ofthis
joint equalsangles
.- Parameter
context
: The context of the model this joint belongs to.
- Parameter
angles
: The desired angles in radians to be stored in
context
ordered as (θ₁, θ₂). See class documentation for details.
- Returns
a constant reference to
this
joint.
- Parameter
- set_angular_rates(self: pydrake.multibody.tree.UniversalJoint_[Expression], context: pydrake.systems.framework.Context_[Expression], theta_dot: numpy.ndarray[object[2, 1]]) pydrake.multibody.tree.UniversalJoint_[Expression]
Sets the rates of change, in radians per second, of this
this
joint’s angles (see class documentation) totheta_dot
. The new rates of change get stored incontext
.- Parameter
context
: The context of the model this joint belongs to.
- Parameter
theta_dot
: The desired rates of change of
this
joints’s angles in radians per second.
- Returns
a constant reference to
this
joint.
- Parameter
- set_default_angles(self: pydrake.multibody.tree.UniversalJoint_[Expression], angles: numpy.ndarray[numpy.float64[2, 1]]) None
Sets the default angles of this joint.
- Parameter
angles
: The desired default angles of the joint
- Parameter
- set_random_angles_distribution(self: pydrake.multibody.tree.UniversalJoint_[Expression], angles: numpy.ndarray[object[2, 1]]) None
Sets the random distribution that angles of this joint will be randomly sampled from. See class documentation for details on the definition of the angles.
- class pydrake.multibody.tree.WeldJoint
Bases:
pydrake.multibody.tree.Joint
This Joint fixes the relative pose between two frames as if “welding” them together.
Note
This class is templated; see
WeldJoint_
for the list of instantiations.- __init__(self: pydrake.multibody.tree.WeldJoint, name: str, frame_on_parent_F: pydrake.multibody.tree.Frame, frame_on_child_M: pydrake.multibody.tree.Frame, X_FM: pydrake.math.RigidTransform) None
Constructor for a WeldJoint between a
frame_on_parent_F
and aframe_on_child_M
so that their relative poseX_FM
is fixed as if they were “welded” together.
- kTypeName = 'weld'
- X_FM(self: pydrake.multibody.tree.WeldJoint) pydrake.math.RigidTransform
Returns the pose X_FM of frame M in F.
- template pydrake.multibody.tree.WeldJoint_
Instantiations:
WeldJoint_[float]
,WeldJoint_[AutoDiffXd]
,WeldJoint_[Expression]
- class pydrake.multibody.tree.WeldJoint_[AutoDiffXd]
Bases:
pydrake.multibody.tree.Joint_[AutoDiffXd]
This Joint fixes the relative pose between two frames as if “welding” them together.
- __init__(self: pydrake.multibody.tree.WeldJoint_[AutoDiffXd], name: str, frame_on_parent_F: pydrake.multibody.tree.Frame_[AutoDiffXd], frame_on_child_M: pydrake.multibody.tree.Frame_[AutoDiffXd], X_FM: pydrake.math.RigidTransform) None
Constructor for a WeldJoint between a
frame_on_parent_F
and aframe_on_child_M
so that their relative poseX_FM
is fixed as if they were “welded” together.
- kTypeName = 'weld'
- X_FM(self: pydrake.multibody.tree.WeldJoint_[AutoDiffXd]) pydrake.math.RigidTransform
Returns the pose X_FM of frame M in F.
- class pydrake.multibody.tree.WeldJoint_[Expression]
Bases:
pydrake.multibody.tree.Joint_[Expression]
This Joint fixes the relative pose between two frames as if “welding” them together.
- __init__(self: pydrake.multibody.tree.WeldJoint_[Expression], name: str, frame_on_parent_F: pydrake.multibody.tree.Frame_[Expression], frame_on_child_M: pydrake.multibody.tree.Frame_[Expression], X_FM: pydrake.math.RigidTransform) None
Constructor for a WeldJoint between a
frame_on_parent_F
and aframe_on_child_M
so that their relative poseX_FM
is fixed as if they were “welded” together.
- kTypeName = 'weld'
- X_FM(self: pydrake.multibody.tree.WeldJoint_[Expression]) pydrake.math.RigidTransform
Returns the pose X_FM of frame M in F.
- pydrake.multibody.tree.world_frame_index() pydrake.multibody.tree.FrameIndex
For every MultibodyPlant the world frame always has this unique index and it is always zero.
- pydrake.multibody.tree.world_index() pydrake.multibody.tree.BodyIndex
For every MultibodyPlant the world body always has this unique index and it is always zero.
- pydrake.multibody.tree.world_model_instance() pydrake.multibody.tree.ModelInstanceIndex
Returns the model instance containing the world body. For every MultibodyPlant the world body always has this unique model instance and it is always zero (as described in #3088).