pydrake.multibody.plant¶
Bindings for MultibodyPlant and related classes.
-
pydrake.multibody.plant.
AddMultibodyPlantSceneGraph
(*args, **kwargs)¶ Overloaded function.
- AddMultibodyPlantSceneGraph(builder: pydrake.systems.framework.DiagramBuilder_[float], plant: pydrake.multibody.plant.MultibodyPlant_[float], scene_graph: pydrake.geometry.SceneGraph_[float] = None) -> tuple
Adds a MultibodyPlant and a SceneGraph instance to a diagram builder, connecting the geometry ports.
Note
Usage examples in add_multibody_plant_scene_graph “AddMultibodyPlantSceneGraph”.
- Parameter
builder
: - Builder to add to.
- Parameter
plant
: - Plant to be added to the builder.
- Parameter
scene_graph
: - (optional) Constructed scene graph. If none is provided, one will be created and used.
Returns: Pair of the registered plant and scene graph. - Precondition:
builder
andplant
must be non-null.
- AddMultibodyPlantSceneGraph(builder: pydrake.systems.framework.DiagramBuilder_[float], time_step: float, scene_graph: pydrake.geometry.SceneGraph_[float] = None) -> tuple
Makes a new MultibodyPlant with discrete update period
time_step
and adds it to a diagram builder together with the provided SceneGraph instance, connecting the geometry ports.Note
Usage examples in add_multibody_plant_scene_graph “AddMultibodyPlantSceneGraph”.
- Parameter
builder
: - Builder to add to.
- Parameter
time_step
: - The discrete update period for the new MultibodyPlant to be added.
Please refer to the documentation provided in
MultibodyPlant::MultibodyPlant(double) for further details on the
parameter
time_step
. - Parameter
scene_graph
: - (optional) Constructed scene graph. If none is provided, one will be created and used.
Returns: Pair of the registered plant and scene graph. - Precondition:
builder
must be non-null.
- AddMultibodyPlantSceneGraph(builder: pydrake.systems.framework.DiagramBuilder_[AutoDiffXd], plant: pydrake.multibody.plant.MultibodyPlant_[AutoDiffXd], scene_graph: pydrake.geometry.SceneGraph_[AutoDiffXd] = None) -> tuple
Adds a MultibodyPlant and a SceneGraph instance to a diagram builder, connecting the geometry ports.
Note
Usage examples in add_multibody_plant_scene_graph “AddMultibodyPlantSceneGraph”.
- Parameter
builder
: - Builder to add to.
- Parameter
plant
: - Plant to be added to the builder.
- Parameter
scene_graph
: - (optional) Constructed scene graph. If none is provided, one will be created and used.
Returns: Pair of the registered plant and scene graph. - Precondition:
builder
andplant
must be non-null.
- AddMultibodyPlantSceneGraph(builder: pydrake.systems.framework.DiagramBuilder_[AutoDiffXd], time_step: float, scene_graph: pydrake.geometry.SceneGraph_[AutoDiffXd] = None) -> tuple
Makes a new MultibodyPlant with discrete update period
time_step
and adds it to a diagram builder together with the provided SceneGraph instance, connecting the geometry ports.Note
Usage examples in add_multibody_plant_scene_graph “AddMultibodyPlantSceneGraph”.
- Parameter
builder
: - Builder to add to.
- Parameter
time_step
: - The discrete update period for the new MultibodyPlant to be added.
Please refer to the documentation provided in
MultibodyPlant::MultibodyPlant(double) for further details on the
parameter
time_step
. - Parameter
scene_graph
: - (optional) Constructed scene graph. If none is provided, one will be created and used.
Returns: Pair of the registered plant and scene graph. - Precondition:
builder
must be non-null.
-
pydrake.multibody.plant.
CalcContactFrictionFromSurfaceProperties
(*args, **kwargs)¶ Overloaded function.
- CalcContactFrictionFromSurfaceProperties(surface_properties1: pydrake.multibody.plant.CoulombFriction_[float], surface_properties2: pydrake.multibody.plant.CoulombFriction_[float]) -> pydrake.multibody.plant.CoulombFriction_[float]
Given the surface properties of two different surfaces, this method computes the Coulomb’s law coefficients of friction characterizing the interaction by friction of the given surface pair. The surface properties are specified by individual Coulomb’s law coefficients of friction. As outlined in the class’s documentation for CoulombFriction, friction coefficients characterize a surface pair and not individual surfaces. However, we find it useful in practice to associate the abstract idea of friction coefficients to a single surface. Please refer to the documentation for CoulombFriction for details on this topic.
More specifically, this method computes the contact coefficients for the given surface pair as:
μ = 2μₘμₙ/(μₘ + μₙ)
where the operation above is performed separately on the static and dynamic friction coefficients.
- Parameter
surface_properties1
: - Surface properties for surface 1. Specified as an individual set of Coulomb’s law coefficients of friction.
- Parameter
surface_properties2
: - Surface properties for surface 2. Specified as an individual set of Coulomb’s law coefficients of friction.
Returns: the combined friction coefficients for the interacting surfaces. - CalcContactFrictionFromSurfaceProperties(surface_properties1: pydrake.multibody.plant.CoulombFriction_[AutoDiffXd], surface_properties2: pydrake.multibody.plant.CoulombFriction_[AutoDiffXd]) -> pydrake.multibody.plant.CoulombFriction_[AutoDiffXd]
Given the surface properties of two different surfaces, this method computes the Coulomb’s law coefficients of friction characterizing the interaction by friction of the given surface pair. The surface properties are specified by individual Coulomb’s law coefficients of friction. As outlined in the class’s documentation for CoulombFriction, friction coefficients characterize a surface pair and not individual surfaces. However, we find it useful in practice to associate the abstract idea of friction coefficients to a single surface. Please refer to the documentation for CoulombFriction for details on this topic.
More specifically, this method computes the contact coefficients for the given surface pair as:
μ = 2μₘμₙ/(μₘ + μₙ)
where the operation above is performed separately on the static and dynamic friction coefficients.
- Parameter
surface_properties1
: - Surface properties for surface 1. Specified as an individual set of Coulomb’s law coefficients of friction.
- Parameter
surface_properties2
: - Surface properties for surface 2. Specified as an individual set of Coulomb’s law coefficients of friction.
Returns: the combined friction coefficients for the interacting surfaces. - CalcContactFrictionFromSurfaceProperties(surface_properties1: pydrake.multibody.plant.CoulombFriction_[Expression], surface_properties2: pydrake.multibody.plant.CoulombFriction_[Expression]) -> pydrake.multibody.plant.CoulombFriction_[Expression]
Given the surface properties of two different surfaces, this method computes the Coulomb’s law coefficients of friction characterizing the interaction by friction of the given surface pair. The surface properties are specified by individual Coulomb’s law coefficients of friction. As outlined in the class’s documentation for CoulombFriction, friction coefficients characterize a surface pair and not individual surfaces. However, we find it useful in practice to associate the abstract idea of friction coefficients to a single surface. Please refer to the documentation for CoulombFriction for details on this topic.
More specifically, this method computes the contact coefficients for the given surface pair as:
μ = 2μₘμₙ/(μₘ + μₙ)
where the operation above is performed separately on the static and dynamic friction coefficients.
- Parameter
surface_properties1
: - Surface properties for surface 1. Specified as an individual set of Coulomb’s law coefficients of friction.
- Parameter
surface_properties2
: - Surface properties for surface 2. Specified as an individual set of Coulomb’s law coefficients of friction.
Returns: the combined friction coefficients for the interacting surfaces.
-
pydrake.multibody.plant.
ConnectContactResultsToDrakeVisualizer
(builder: pydrake.systems.framework.DiagramBuilder_[float], plant: pydrake.multibody.plant.MultibodyPlant_[float], lcm: pydrake.lcm.DrakeLcmInterface = None) → pydrake.systems.lcm.LcmPublisherSystem¶ Extends a Diagram with the required components to publish contact results to drake_visualizer. This must be called during Diagram building and uses the given
builder
to add relevant subsystems and connections.This is a convenience method to simplify some common boilerplate for adding contact results visualization capability to a Diagram. What it does is:
- adds systems ContactResultsToLcmSystem and LcmPublisherSystem to
the Diagram and connects the draw message output to the publisher input, - connects the
multibody_plant
contact results output to the ContactResultsToLcmSystem system, and - sets the publishing rate to 1/60 of a second (simulated time).- Parameter
builder
: - The diagram builder being used to construct the Diagram.
- Parameter
multibody_plant
: - The System in
builder
containing the plant whose contact results are to be visualized. - Parameter
lcm
: - An optional lcm interface through which lcm messages will be dispatched. Will be allocated internally if none is supplied.
- Precondition:
- The given
multibody_plant
must be contained within the supplied DiagramBuilder.
Returns: the LcmPublisherSystem (in case callers, e.g., need to change the default publishing rate).
-
pydrake.multibody.plant.
ContactResults
¶
-
template
pydrake.multibody.plant.
ContactResults_
¶ Instantiations:
ContactResults_[float]
,ContactResults_[AutoDiffXd]
,ContactResults_[Expression]
-
class
ContactResults_[float]
¶ A container class storing the contact results information for each contact pair for a given state of the simulation. Note that copying this data structure is expensive when
num_hydroelastic_contacts() > 0
because a deep copy is performed.-
__init__
(self: pydrake.multibody.plant.ContactResults_[float]) → None¶
-
num_point_pair_contacts
(self: pydrake.multibody.plant.ContactResults_[float]) → int¶ Returns the number of point pair contacts.
-
point_pair_contact_info
(self: pydrake.multibody.plant.ContactResults_[float], i: int) → pydrake.multibody.plant.PointPairContactInfo_[float]¶ Retrieves the ith PointPairContactInfo instance. The input index i must be in the range [0,
num_point_pair_contacts()
- 1] or this method aborts.
-
-
class
-
class
pydrake.multibody.plant.
ContactResults_[AutoDiffXd]
¶ A container class storing the contact results information for each contact pair for a given state of the simulation. Note that copying this data structure is expensive when
num_hydroelastic_contacts() > 0
because a deep copy is performed.-
__init__
(self: pydrake.multibody.plant.ContactResults_[AutoDiffXd]) → None¶
-
num_point_pair_contacts
(self: pydrake.multibody.plant.ContactResults_[AutoDiffXd]) → int¶ Returns the number of point pair contacts.
-
point_pair_contact_info
(self: pydrake.multibody.plant.ContactResults_[AutoDiffXd], i: int) → pydrake.multibody.plant.PointPairContactInfo_[AutoDiffXd]¶ Retrieves the ith PointPairContactInfo instance. The input index i must be in the range [0,
num_point_pair_contacts()
- 1] or this method aborts.
-
-
class
pydrake.multibody.plant.
ContactResults_[Expression]
¶ A container class storing the contact results information for each contact pair for a given state of the simulation. Note that copying this data structure is expensive when
num_hydroelastic_contacts() > 0
because a deep copy is performed.-
__init__
(self: pydrake.multibody.plant.ContactResults_[Expression]) → None¶
-
num_point_pair_contacts
(self: pydrake.multibody.plant.ContactResults_[Expression]) → int¶ Returns the number of point pair contacts.
-
point_pair_contact_info
(self: pydrake.multibody.plant.ContactResults_[Expression], i: int) → pydrake.multibody.plant.PointPairContactInfo_[Expression]¶ Retrieves the ith PointPairContactInfo instance. The input index i must be in the range [0,
num_point_pair_contacts()
- 1] or this method aborts.
-
-
class
pydrake.multibody.plant.
ContactResults_[float]
¶ A container class storing the contact results information for each contact pair for a given state of the simulation. Note that copying this data structure is expensive when
num_hydroelastic_contacts() > 0
because a deep copy is performed.-
__init__
(self: pydrake.multibody.plant.ContactResults_[float]) → None¶
-
num_point_pair_contacts
(self: pydrake.multibody.plant.ContactResults_[float]) → int¶ Returns the number of point pair contacts.
-
point_pair_contact_info
(self: pydrake.multibody.plant.ContactResults_[float], i: int) → pydrake.multibody.plant.PointPairContactInfo_[float]¶ Retrieves the ith PointPairContactInfo instance. The input index i must be in the range [0,
num_point_pair_contacts()
- 1] or this method aborts.
-
-
class
pydrake.multibody.plant.
ContactResultsToLcmSystem
¶ Bases:
pydrake.systems.framework.LeafSystem_[float]
A System that encodes ContactResults into a lcmt_contact_results_for_viz message. It has a single input port with type ContactResults<T> and a single output port with lcmt_contact_results_for_viz.
-
__init__
(self: pydrake.multibody.plant.ContactResultsToLcmSystem, plant: pydrake.multibody.plant.MultibodyPlant_[float]) → None¶ Constructs a ContactResultsToLcmSystem.
- Parameter
plant
: - The MultibodyPlant that the ContactResults are generated from.
- Precondition:
- The
plant
must be finalized already. The input port of this system must be connected to the corresponding output port ofplant
(either directly or from an exported port in a Diagram).
- Parameter
-
get_contact_result_input_port
(self: pydrake.multibody.plant.ContactResultsToLcmSystem) → pydrake.systems.framework.InputPort_[float]¶
-
get_lcm_message_output_port
(self: pydrake.multibody.plant.ContactResultsToLcmSystem) → pydrake.systems.framework.OutputPort_[float]¶
-
-
pydrake.multibody.plant.
CoulombFriction
¶
-
template
pydrake.multibody.plant.
CoulombFriction_
¶ Instantiations:
CoulombFriction_[float]
,CoulombFriction_[AutoDiffXd]
,CoulombFriction_[Expression]
-
class
CoulombFriction_[float]
¶ Parameters for Coulomb’s Law of Friction, namely:
- Static friction coefficient, for a pair of surfaces at rest relative to each other.
- Dynamic (or kinematic) friction coefficient, for a pair of surfaces in relative motion.
 Friction coefficients depend upon the mechanical properties of the surfaces’ materials and on the roughness of the surfaces. They are determined experimentally.
Even though the Coulomb’s law coefficients of friction characterize a pair of surfaces interacting by friction, we associate the abstract idea of friction coefficients to a single surface by considering the coefficients for contact between two identical surfaces. For this case of two identical surfaces, the friction coefficients that describe the surface pair are taken to equal those of one of the identical surfaces. We extend this idea to the case of different surfaces by defining a combination law that allow us to obtain the Coulomb’s law coefficients of friction characterizing the pair of surfaces, given the individual friction coefficients of each surface. We would like this combination law to satisfy:
- The friction coefficient of two identical surfaces is the friction coefficient of one of the surfaces.
- The combination law is commutative. That is, surface A combined with surface B gives the same results as surface B combined with surface A.
- For two surfaces M and N with very different friction coefficients, say
μₘ ≪ μₙ
, the combined friction coefficient should be in the order of magnitude of the smallest friction coefficient (in the example μₘ). To understand this requirement, consider rubber (high friction coefficient) sliding on ice (low friction coefficient). We’d like the surface pair to be defined by a friction coefficient close to that of ice, since rubber will easily slide on ice.
These requirements are met by the following ad-hoc combination law:
μ = 2μₘμₙ/(μₘ + μₙ)
See CalcContactFrictionFromSurfaceProperties(), which implements this law. More complex combination laws could also be a function of other parameters such as the mechanical properties of the interacting surfaces or even their roughnesses. For instance, if the the rubber surface above has metal studs (somehow making the surface “rougher”), it will definitely have a better grip on an ice surface. Therefore this new variable should be taken into account in the combination law. Notice that in this example, this new combination law model for tires, will have a different set of requirements from the ones stated above.
-
__init__
(self: pydrake.multibody.plant.CoulombFriction_[float], static_friction: float, dynamic_friction: float) → None¶ Specifies both the static and dynamic friction coefficients for a given surface.
Raises: - RuntimeError if any of the friction coefficients are negative or
- if
dynamic_friction > static_friction
(they can be equal.)
-
dynamic_friction
(self: pydrake.multibody.plant.CoulombFriction_[float]) → float¶ Returns the coefficient of dynamic friction.
-
static_friction
(self: pydrake.multibody.plant.CoulombFriction_[float]) → float¶ Returns the coefficient of static friction.
-
class
-
class
pydrake.multibody.plant.
CoulombFriction_[AutoDiffXd]
¶ Parameters for Coulomb’s Law of Friction, namely:
- Static friction coefficient, for a pair of surfaces at rest relative to each other.
- Dynamic (or kinematic) friction coefficient, for a pair of surfaces in relative motion.
 Friction coefficients depend upon the mechanical properties of the surfaces’ materials and on the roughness of the surfaces. They are determined experimentally.
Even though the Coulomb’s law coefficients of friction characterize a pair of surfaces interacting by friction, we associate the abstract idea of friction coefficients to a single surface by considering the coefficients for contact between two identical surfaces. For this case of two identical surfaces, the friction coefficients that describe the surface pair are taken to equal those of one of the identical surfaces. We extend this idea to the case of different surfaces by defining a combination law that allow us to obtain the Coulomb’s law coefficients of friction characterizing the pair of surfaces, given the individual friction coefficients of each surface. We would like this combination law to satisfy:
- The friction coefficient of two identical surfaces is the friction coefficient of one of the surfaces.
- The combination law is commutative. That is, surface A combined with surface B gives the same results as surface B combined with surface A.
- For two surfaces M and N with very different friction coefficients, say
μₘ ≪ μₙ
, the combined friction coefficient should be in the order of magnitude of the smallest friction coefficient (in the example μₘ). To understand this requirement, consider rubber (high friction coefficient) sliding on ice (low friction coefficient). We’d like the surface pair to be defined by a friction coefficient close to that of ice, since rubber will easily slide on ice.
These requirements are met by the following ad-hoc combination law:
μ = 2μₘμₙ/(μₘ + μₙ)
See CalcContactFrictionFromSurfaceProperties(), which implements this law. More complex combination laws could also be a function of other parameters such as the mechanical properties of the interacting surfaces or even their roughnesses. For instance, if the the rubber surface above has metal studs (somehow making the surface “rougher”), it will definitely have a better grip on an ice surface. Therefore this new variable should be taken into account in the combination law. Notice that in this example, this new combination law model for tires, will have a different set of requirements from the ones stated above.
-
__init__
(self: pydrake.multibody.plant.CoulombFriction_[AutoDiffXd], static_friction: pydrake.autodiffutils.AutoDiffXd, dynamic_friction: pydrake.autodiffutils.AutoDiffXd) → None¶ Specifies both the static and dynamic friction coefficients for a given surface.
Raises: - RuntimeError if any of the friction coefficients are negative or
- if
dynamic_friction > static_friction
(they can be equal.)
-
dynamic_friction
(self: pydrake.multibody.plant.CoulombFriction_[AutoDiffXd]) → pydrake.autodiffutils.AutoDiffXd¶ Returns the coefficient of dynamic friction.
-
static_friction
(self: pydrake.multibody.plant.CoulombFriction_[AutoDiffXd]) → pydrake.autodiffutils.AutoDiffXd¶ Returns the coefficient of static friction.
-
class
pydrake.multibody.plant.
CoulombFriction_[Expression]
¶ Parameters for Coulomb’s Law of Friction, namely:
- Static friction coefficient, for a pair of surfaces at rest relative to each other.
- Dynamic (or kinematic) friction coefficient, for a pair of surfaces in relative motion.
 Friction coefficients depend upon the mechanical properties of the surfaces’ materials and on the roughness of the surfaces. They are determined experimentally.
Even though the Coulomb’s law coefficients of friction characterize a pair of surfaces interacting by friction, we associate the abstract idea of friction coefficients to a single surface by considering the coefficients for contact between two identical surfaces. For this case of two identical surfaces, the friction coefficients that describe the surface pair are taken to equal those of one of the identical surfaces. We extend this idea to the case of different surfaces by defining a combination law that allow us to obtain the Coulomb’s law coefficients of friction characterizing the pair of surfaces, given the individual friction coefficients of each surface. We would like this combination law to satisfy:
- The friction coefficient of two identical surfaces is the friction coefficient of one of the surfaces.
- The combination law is commutative. That is, surface A combined with surface B gives the same results as surface B combined with surface A.
- For two surfaces M and N with very different friction coefficients, say
μₘ ≪ μₙ
, the combined friction coefficient should be in the order of magnitude of the smallest friction coefficient (in the example μₘ). To understand this requirement, consider rubber (high friction coefficient) sliding on ice (low friction coefficient). We’d like the surface pair to be defined by a friction coefficient close to that of ice, since rubber will easily slide on ice.
These requirements are met by the following ad-hoc combination law:
μ = 2μₘμₙ/(μₘ + μₙ)
See CalcContactFrictionFromSurfaceProperties(), which implements this law. More complex combination laws could also be a function of other parameters such as the mechanical properties of the interacting surfaces or even their roughnesses. For instance, if the the rubber surface above has metal studs (somehow making the surface “rougher”), it will definitely have a better grip on an ice surface. Therefore this new variable should be taken into account in the combination law. Notice that in this example, this new combination law model for tires, will have a different set of requirements from the ones stated above.
-
__init__
(self: pydrake.multibody.plant.CoulombFriction_[Expression], static_friction: pydrake.symbolic.Expression, dynamic_friction: pydrake.symbolic.Expression) → None¶ Specifies both the static and dynamic friction coefficients for a given surface.
Raises: - RuntimeError if any of the friction coefficients are negative or
- if
dynamic_friction > static_friction
(they can be equal.)
-
dynamic_friction
(self: pydrake.multibody.plant.CoulombFriction_[Expression]) → pydrake.symbolic.Expression¶ Returns the coefficient of dynamic friction.
-
static_friction
(self: pydrake.multibody.plant.CoulombFriction_[Expression]) → pydrake.symbolic.Expression¶ Returns the coefficient of static friction.
-
class
pydrake.multibody.plant.
CoulombFriction_[float]
¶ Parameters for Coulomb’s Law of Friction, namely:
- Static friction coefficient, for a pair of surfaces at rest relative to each other.
- Dynamic (or kinematic) friction coefficient, for a pair of surfaces in relative motion.
 Friction coefficients depend upon the mechanical properties of the surfaces’ materials and on the roughness of the surfaces. They are determined experimentally.
Even though the Coulomb’s law coefficients of friction characterize a pair of surfaces interacting by friction, we associate the abstract idea of friction coefficients to a single surface by considering the coefficients for contact between two identical surfaces. For this case of two identical surfaces, the friction coefficients that describe the surface pair are taken to equal those of one of the identical surfaces. We extend this idea to the case of different surfaces by defining a combination law that allow us to obtain the Coulomb’s law coefficients of friction characterizing the pair of surfaces, given the individual friction coefficients of each surface. We would like this combination law to satisfy:
- The friction coefficient of two identical surfaces is the friction coefficient of one of the surfaces.
- The combination law is commutative. That is, surface A combined with surface B gives the same results as surface B combined with surface A.
- For two surfaces M and N with very different friction coefficients, say
μₘ ≪ μₙ
, the combined friction coefficient should be in the order of magnitude of the smallest friction coefficient (in the example μₘ). To understand this requirement, consider rubber (high friction coefficient) sliding on ice (low friction coefficient). We’d like the surface pair to be defined by a friction coefficient close to that of ice, since rubber will easily slide on ice.
These requirements are met by the following ad-hoc combination law:
μ = 2μₘμₙ/(μₘ + μₙ)
See CalcContactFrictionFromSurfaceProperties(), which implements this law. More complex combination laws could also be a function of other parameters such as the mechanical properties of the interacting surfaces or even their roughnesses. For instance, if the the rubber surface above has metal studs (somehow making the surface “rougher”), it will definitely have a better grip on an ice surface. Therefore this new variable should be taken into account in the combination law. Notice that in this example, this new combination law model for tires, will have a different set of requirements from the ones stated above.
-
__init__
(self: pydrake.multibody.plant.CoulombFriction_[float], static_friction: float, dynamic_friction: float) → None¶ Specifies both the static and dynamic friction coefficients for a given surface.
Raises: - RuntimeError if any of the friction coefficients are negative or
- if
dynamic_friction > static_friction
(they can be equal.)
-
dynamic_friction
(self: pydrake.multibody.plant.CoulombFriction_[float]) → float¶ Returns the coefficient of dynamic friction.
-
static_friction
(self: pydrake.multibody.plant.CoulombFriction_[float]) → float¶ Returns the coefficient of static friction.
-
pydrake.multibody.plant.
ExternallyAppliedSpatialForce
¶ alias of
pydrake.multibody.plant.ExternallyAppliedSpatialForce_[float]
-
template
pydrake.multibody.plant.
ExternallyAppliedSpatialForce_
¶ Instantiations:
ExternallyAppliedSpatialForce_[float]
,ExternallyAppliedSpatialForce_[AutoDiffXd]
,ExternallyAppliedSpatialForce_[Expression]
-
class
ExternallyAppliedSpatialForce_[float]
¶ -
__init__
(self: pydrake.multibody.plant.ExternallyAppliedSpatialForce_[float]) → None¶
-
body_index
¶ The index of the body that the force is to be applied to.
-
F_Bq_W
¶ A spatial force applied to Body B at point Bq, expressed in the world frame.
-
p_BoBq_B
¶ A position vector from Body B’s origin (Bo) to a point Bq (a point of B), expressed in B’s frame.
-
-
class
-
class
pydrake.multibody.plant.
ExternallyAppliedSpatialForce_[AutoDiffXd]
¶ -
__init__
(self: pydrake.multibody.plant.ExternallyAppliedSpatialForce_[AutoDiffXd]) → None¶
-
body_index
¶ The index of the body that the force is to be applied to.
-
F_Bq_W
¶ A spatial force applied to Body B at point Bq, expressed in the world frame.
-
p_BoBq_B
¶ A position vector from Body B’s origin (Bo) to a point Bq (a point of B), expressed in B’s frame.
-
-
class
pydrake.multibody.plant.
ExternallyAppliedSpatialForce_[Expression]
¶ -
__init__
(self: pydrake.multibody.plant.ExternallyAppliedSpatialForce_[Expression]) → None¶
-
body_index
¶ The index of the body that the force is to be applied to.
-
F_Bq_W
¶ A spatial force applied to Body B at point Bq, expressed in the world frame.
-
p_BoBq_B
¶ A position vector from Body B’s origin (Bo) to a point Bq (a point of B), expressed in B’s frame.
-
-
class
pydrake.multibody.plant.
ExternallyAppliedSpatialForce_[float]
¶ -
__init__
(self: pydrake.multibody.plant.ExternallyAppliedSpatialForce_[float]) → None¶
-
body_index
¶ The index of the body that the force is to be applied to.
-
F_Bq_W
¶ A spatial force applied to Body B at point Bq, expressed in the world frame.
-
p_BoBq_B
¶ A position vector from Body B’s origin (Bo) to a point Bq (a point of B), expressed in B’s frame.
-
-
pydrake.multibody.plant.
MultibodyPlant
¶
-
template
pydrake.multibody.plant.
MultibodyPlant_
¶ Instantiations:
MultibodyPlant_[float]
,MultibodyPlant_[AutoDiffXd]
,MultibodyPlant_[Expression]
-
class
MultibodyPlant_[float]
¶ Bases:
pydrake.systems.framework.LeafSystem_[float]
MultibodyPlant is a Drake system framework representation (see systems::System) for the model of a physical system consisting of a collection of interconnected bodies. See multibody for an overview of concepts/notation.
<table align=center cellpadding=0 cellspacing=0><tr align=center><td style=”vertical-align:middle”><table cellspacing=0 cellpadding=0><tr><td align=right style=”padding:5px 0px 5px 0px”>applied_generalized_force→</td></tr><tr><td align=right style=”padding:5px 0px 5px 0px”>applied_spatial_force→</td></tr><tr><td align=right style=”padding:5px 0px 5px 0px”><em style=”color:gray”>model_instance_name[i]</em>_actuation→</td></tr><tr><td align=right style=”padding:5px 0px 5px 0px”><span style=”color:green”>geometry_query</span>→</td></tr></table></td><td align=center style=”border:solid;padding-left:20px;padding-right:20px;vertical-align:middle” bgcolor=#F0F0F0>MultibodyPlant</td><td style=”vertical-align:middle”><table cellspacing=0 cellpadding=0><tr><td align=left style=”padding:5px 0px 5px 0px”>→ continuous_state</td></tr><tr><td align=left style=”padding:5px 0px 5px 0px”>→ body_poses</td></tr><tr><td align=left style=”padding:5px 0px 5px 0px”>→ body_spatial_velocities</td></tr><tr><td align=left style=”padding:5px 0px 5px 0px”>→ body_spatial_accelerations</td></tr><tr><td align=left style=”padding:5px 0px 5px 0px”>→ generalized_acceleration</td></tr><tr><td align=left style=”padding:5px 0px 5px 0px”>→ reaction_forces</td></tr><tr><td align=left style=”padding:5px 0px 5px 0px”>→ contact_results</td></tr><tr><td align=left style=”padding:5px 0px 5px 0px”>→ <em style=”color:gray”>model_instance_name[i]</em>_continuous_state</td></tr><tr><td align=left style=”padding:5px 0px 5px 0px”>→ <em style=”color:gray”> model_instance_name[i]</em>_generalized_acceleration</td></tr><tr><td align=left style=”padding:5px 0px 5px 0px”>→ <em style=”color:gray”> model_instance_name[i]</em>_generalized_contact_forces</td></tr><tr><td align=left style=”padding:5px 0px 5px 0px”>→ <span style=”color:green”>geometry_pose</span></td></tr></table></td></tr></table>
The ports whose names begin with <em style=”color:gray”> model_instance_name[i]</em> represent groups of ports, one for each of the model_instances “model instances”, with i ∈ {0, …, N-1} for the N model instances. If a model instance does not contain any data of the indicated type the port will still be present but its value will be a zero-length vector. (Model instances
world_model_instance()
anddefault_model_instance()
always exist.)The ports shown in <span style=”color:green”> green</span> are for communication with Drake’s geometry::SceneGraph “SceneGraph” system for dealing with geometry.
MultibodyPlant provides a user-facing API for:
- mbp_input_and_output_ports “Ports”: Access input and output ports. -
mbp_construction “Construction”: Add bodies, joints, frames, force elements, and actuators. - mbp_geometry “Geometry”: Register geometries to a provided SceneGraph instance. - mbp_contact_modeling “Contact modeling”: Select and parameterize contact models. - mbp_state_accessors_and_mutators “State access and modification”: Obtain and manipulate position and velocity state variables. - mbp_working_with_free_bodies “Free bodies”: Work conveniently with free (floating) bodies. - mbp_kinematic_and_dynamic_computations “Kinematics and dynamics”: Perform systems::Context “Context”-dependent kinematic and dynamic queries. - mbp_system_matrix_computations “System matrices”: Explicitly form matrices that appear in the equations of motion. - mbp_introspection “Introspection”: Perform introspection to find out what’s in the MultibodyPlant.
**** Model Instances
A MultiBodyPlant may contain multiple model instances. Each model instance corresponds to a set of bodies and their connections (joints). Model instances provide methods to get or set the state of the set of bodies (e.g., through GetPositionsAndVelocities() and SetPositionsAndVelocities()), connecting controllers (through get_state_output_port() and get_actuation_input_port()), and organizing duplicate models (read through a parser). In fact, many MultibodyPlant methods are overloaded to allow operating on the entire plant or just the subset corresponding to the model instance; for example, one GetPositions() method obtains the generalized positions for the entire plant while another GetPositions() method obtains the generalized positions for model instance.
Model instances are frequently defined through SDF files (using the
model
tag) and are automatically created when SDF files are parsed (by Parser). There are two special multibody::ModelInstanceIndex values. The world body is always multibody::ModelInstanceIndex 0. multibody::ModelInstanceIndex 1 is reserved for all elements with no explicit model instance and is generally only relevant for elements created programmatically (and only when a model instance is not explicitly specified). Note that Parser creates model instances (resulting in a multibody::ModelInstanceIndex ≥ 2) as needed.See num_model_instances(), num_positions(), num_velocities(), num_actuated_dofs(), AddModelInstance() GetPositionsAndVelocities(), GetPositions(), GetVelocities(), SetPositionsAndVelocities(), SetPositions(), SetVelocities(), GetPositionsFromArray(), GetVelocitiesFromArray(), SetPositionsInArray(), SetVelocitiesInArray(), SetActuationInArray(), HasModelInstanceNamed(), GetModelInstanceName(), get_state_output_port(), get_actuation_input_port().
**** System dynamics
The state of a multibody system
x = [q; v]
is given by its generalized positions vector q, of sizenq
(see num_positions()), and by its generalized velocities vector v, of sizenv
(see num_velocities()). As a Drake systems::System “System”, MultibodyPlant implements the governing equations for a multibody dynamical system in the formẋ = f(t, x, u)
with t being time and u the actuation forces. The governing equations for the dynamics of a multibody system modeled with MultibodyPlant are [Featherstone 2008, Jain 2010]:q̇ = N(q)v (1) M(q)v̇ + C(q, v)v = τ
where
M(q)
is the mass matrix of the multibody system,C(q, v)v
contains Coriolis, centripetal, and gyroscopic terms andN(q)
is the kinematic coupling matrix describing the relationship between q̇ (the time derivatives of the generalized positions) and the generalized velocities v, [Seth 2010].N(q)
is annq x nv
matrix. The vectorτ ∈ ℝⁿᵛ
on the right hand side of Eq. (1) is the system’s generalized forces. These incorporate gravity, springs, externally applied body forces, constraint forces, and contact forces.**** Loading models from SDF files
Drake has the capability to load multibody models from SDF and URDF files. Consider the example below which loads an acrobot model:
MultibodyPlant<T> acrobot; SceneGraph<T> scene_graph; Parser parser(&acrobot, &scene_graph); const std::string relative_name = "drake/multibody/benchmarks/acrobot/acrobot.sdf"; const std::string full_name = FindResourceOrThrow(relative_name); parser.AddModelFromFile(full_name);
As in the example above, for models including visual geometry, collision geometry or both, the user must specify a SceneGraph for geometry handling. You can find a full example of the LQR controlled acrobot in examples/multibody/acrobot/run_lqr.cc.
AddModelFromFile() can be invoked multiple times on the same plant in order to load multiple model instances. Other methods are available on Parser such as AddAllModelsFromFile() which allows creating model instances per each
<model>
tag found in the file. Please refer to each of these methods’ documentation for further details.**** Working with SceneGraph
** Adding a MultibodyPlant connected to a SceneGraph to your Diagram
Probably the simplest way to add and wire up a MultibodyPlant with a SceneGraph in your Diagram is using AddMultibodyPlantSceneGraph().
Recommended usages:
Assign to a MultibodyPlant reference (ignoring the SceneGraph):
MultibodyPlant<double>& plant = AddMultibodyPlantSceneGraph(&builder, 0.0 /* time_step */); plant.DoFoo(...);
This flavor is the simplest, when the SceneGraph is not explicitly needed. (It can always be retrieved later via GetSubsystemByName(“scene_graph”).)
Assign to auto, and use the named public fields:
auto items = AddMultibodyPlantSceneGraph(&builder, 0.0 /* time_step */); items.plant.DoFoo(...); items.scene_graph.DoBar(...);
or taking advantage of C++17’s structured binding
auto [plant, scene_graph] = AddMultibodyPlantSceneGraph(&builder, 0.0); ... plant.DoFoo(...); scene_graph.DoBar(...);
This is the easiest way to use both the plant and scene_graph.
Assign to already-declared pointer variables:
MultibodyPlant<double>* plant{}; SceneGraph<double>* scene_graph{}; std::tie(plant, scene_graph) = AddMultibodyPlantSceneGraph(&builder, 0.0 /* time_step */); plant->DoFoo(...); scene_graph->DoBar(...);
This flavor is most useful when the pointers are class member fields (and so perhaps cannot be references).
** Registering geometry with a SceneGraph
MultibodyPlant users can register geometry with a SceneGraph for essentially two purposes; a) visualization and, b) contact modeling.
Before any geometry registration takes place, a user must first make a call to RegisterAsSourceForSceneGraph() in order to register the MultibodyPlant as a client of a SceneGraph instance, point at which the plant will have assigned a valid geometry::SourceId. At Finalize(), MultibodyPlant will declare input/output ports as appropriate to communicate with the SceneGraph instance on which registrations took place. All geometry registration must be performed pre-finalize.
Multibodyplant declares an input port for geometric queries, see get_geometry_query_input_port(). If MultibodyPlant registers geometry with a SceneGraph via calls to RegisterCollisionGeometry(), users may use this port for geometric queries. Users must connect this input port to the output port for geometric queries of the SceneGraph used for registration, which can be obtained with SceneGraph::get_query_output_port(). In summary, if MultibodyPlant registers collision geometry, the setup process will include:
1. Call to RegisterAsSourceForSceneGraph(). 2. Calls to RegisterCollisionGeometry(), as many as needed. 3. Call to Finalize(), user is done specifying the model. 4. Connect SceneGraph::get_query_output_port() to get_geometry_query_input_port().
Refer to the documentation provided in each of the methods above for further details.
** Accessing point contact parameters MultibodyPlant’s point contact model looks for model parameters stored as geometry::ProximityProperties by geometry::SceneGraph. These properties can be obtained before or after context creation through geometry::SceneGraphInspector APIs as outlined below. MultibodyPlant expects the following properties for point contact modeling:
Group name | Property Name | Required | Property Type | PropertyDescription | | :——–: | :————–: | :——: | :—————-: | :——————- | | material | coulomb_friction | yes¹ | CoulombFriction<T> | Static and Dynamic friction. | | material | point_contact_stiffness | no² | T | Penalty method stiffness. | | material | hunt_crossley_dissipation | no² | T | Penalty method dissipation. |
¹ Collision geometry is required to be registered with a geometry::ProximityProperties object that contains the (“material”, “coulomb_friction”) property. If the property is missing, MultibodyPlant will throw an exeception.
² If the property is missing, MultibodyPlant will use a heuristic value as the default. Refer to the section mbp_penalty_method “Penalty method point contact” for further details.
Accessing and modifying contact properties requires interfacing with geometry::SceneGraph’s model inspector. Interfacing with a model inspector obtained from geometry::SceneGraph will provide the default registered values for a given parameter. These are the values that will initially appear in a systems::Context created by CreateDefaultContext(). Subsequently, true system paramters can be accessed and changed through a systems::Context once available. For both of the above cases, proximity properties are accessed through geometry::SceneGraphInspector APIs.
Before context creation an inspector can be retrieved directly from SceneGraph as:
// For a SceneGraph<T> instance called scene_graph. const geometry::SceneGraphInspector<T>& inspector = scene_graph.model_inspector();
After context creation, an inspector can be retrieved from the state stored in the context by the plant’s geometry query input port:
// For a MultibodyPlant<T> instance called mbp and a // Context<T> called context. const geometry::QueryObject<T>& query_object = mbp.get_geometry_query_input_port() .template Eval<geometry::QueryObject<T>>(context); const geometry::SceneGraphInspector<T>& inspector = query_object.inspector();
Once an inspector is available, proximity properties can be retrieved as:
// For a body with GeometryId called geometry_id const geometry::ProximityProperties* props = inspector.GetProximityProperties(geometry_id); const CoulombFriction<T>& geometry_friction = props->GetProperty<CoulombFriction<T>>("material", "coulomb_friction");
**** Adding modeling elements
Add multibody elements to a MultibodyPlant with methods like:
- Bodies: AddRigidBody() - Joints: AddJoint() - see mbp_construction
“Construction” for more.
All modeling elements must be added before Finalize() is called. See mbp_finalize_stage “Finalize stage” for a discussion.
**** Modeling contact
Please refer to drake_contacts “Contact Modeling in Drake” for details on the available approximations, setup, and considerations for a multibody simulation with frictional contact.
**** Energy and Power
MultibodyPlant implements the System energy and power methods, with some limitations. - Kinetic energy: fully implemented. - Potential energy and conservative power: currently include only gravity and contributions from ForceElement objects; potential energy from compliant contact and joint limits are not included. - Nonconservative power: currently includes only contributions from ForceElement objects; actuation and input port forces, joint damping, and dissipation from joint limits, friction, and contact dissipation are not included.
See Drake issue #12942 for more discussion.
**** Finalize() stage
Once the user is done adding modeling elements and registering geometry, a call to Finalize() must be performed. This call will: - Build the underlying MultibodyTree topology, see MultibodyTree::Finalize() for details, - declare the plant’s state, - declare the plant’s input and output ports, - declare input and output ports for communication with a SceneGraph.
**** References
- [Featherstone 2008] Featherstone, R., 2008. Rigid body dynamics
algorithms. Springer. - [Jain 2010] Jain, A., 2010. Robot and multibody dynamics: analysis and algorithms. Springer Science & Business Media. - [Seth 2010] Seth, A., Sherman, M., Eastman, P. and Delp, S., 2010. Minimal formulation of joint motion for biomechanisms. Nonlinear dynamics, 62(1), pp.291-303.
-
__init__
(self: pydrake.multibody.plant.MultibodyPlant_[float], time_step: float) → None¶ This constructor creates a plant with a single “world” body. Therefore, right after creation, num_bodies() returns one.
MultibodyPlant offers two different modalities to model mechanical systems in time. These are: 1. As a discrete system with periodic updates,
time_step
is strictly greater than zero. 2. As a continuous system,time_step
equals exactly zero.Currently the discrete model is preferred for simulation given its robustness and speed in problems with frictional contact. However this might change as we work towards developing better strategies to model contact. See time_advancement_strategy “Choice of Time Advancement Strategy” for further details.
Warning
Users should be aware of current limitations in either modeling modality. While the discrete model is often the preferred option for problems with frictional contact given its robustness and speed, it might become unstable when using large feedback gains, high damping or large external forcing. MultibodyPlant will throw an exception whenever the discrete solver is detected to fail. Conversely, the continuous modality has the potential to leverage the robustness and accuracy control provide by Drake’s integrators. However thus far this has proved difficult in practice and especially due to poor performance.
- Parameter
time_step
: - Indicates whether
this
plant is modeled as a continuous system (time_step = 0
) or as a discrete system with periodic updates of periodtime_step > 0
. See time_advancement_strategy “Choice of Time Advancement Strategy” for further details.
Warning
Currently the continuous modality with
time_step = 0
does not support joint limits for simulation, these are ignored. MultibodyPlant prints a warning to console if joint limits are provided. If your simulation requires joint limits currently you must use a discrete MultibodyPlant model.Raises: RuntimeError if time_step
is negative.- Parameter
-
AddForceElement
(self: pydrake.multibody.plant.MultibodyPlant_[float], force_element: pydrake.multibody.tree.ForceElement_[float]) → pydrake.multibody.tree.ForceElement_[float]¶ Adds a new force element model of type
ForceElementType
tothis
MultibodyPlant. The arguments to this methodargs
are forwarded to ``ForceElementType`’s constructor.- Parameter
args
: - Zero or more parameters provided to the constructor of the new force element. It must be the case that ForceElementType<T>(args)` is a valid constructor.
- Template parameter
ForceElementType
: - The type of the ForceElement to add. As there is always a UniformGravityFieldElement present (accessible through gravity_field()), an exception will be thrown if this function is called to add another UniformGravityFieldElement.
Returns: A constant reference to the new ForceElement just added, of type ForceElementType<T>
specialized on the scalar type T ofthis
MultibodyPlant. It will remain valid for the lifetime ofthis
MultibodyPlant.See also
The ForceElement class’s documentation for further details on how a force element is defined.
- Parameter
-
AddFrame
(self: pydrake.multibody.plant.MultibodyPlant_[float], frame: pydrake.multibody.tree.Frame_[float]) → pydrake.multibody.tree.Frame_[float]¶ This method adds a Frame of type
FrameType<T>
. For more information, please see the corresponding constructor ofFrameType
.- Template parameter
FrameType
: - Template which will be instantiated on
T
. - Parameter
frame
: - Unique pointer frame instance.
Returns: A constant reference to the new Frame just added, which will remain valid for the lifetime of this
MultibodyPlant.- Template parameter
-
AddJoint
(self: pydrake.multibody.plant.MultibodyPlant_[float], joint: pydrake.multibody.tree.Joint_[float]) → pydrake.multibody.tree.Joint_[float]¶ This method adds a Joint of type
JointType
between two bodies. For more information, see the below overload ofAddJoint<>
, and the relatedMultibodyTree::AddJoint<>
method.
-
AddJointActuator
(self: pydrake.multibody.plant.MultibodyPlant_[float], name: str, joint: pydrake.multibody.tree.Joint_[float], effort_limit: float = inf) → pydrake.multibody.tree.JointActuator_[float]¶ Creates and adds a JointActuator model for an actuator acting on a given
joint
. This method returns a constant reference to the actuator just added, which will remain valid for the lifetime ofthis
plant.- Parameter
name
: - A string that uniquely identifies the new actuator to be added to
this
model. A RuntimeError is thrown if an actuator with the same name already exists in the model. See HasJointActuatorNamed(). - Parameter
joint
: - The Joint to be actuated by the new JointActuator.
- Parameter
effort_limit
: - The maximum effort for the actuator. It must be strictly positive, otherwise an RuntimeError is thrown. If +∞, the actuator has no limit, which is the default. The effort limit has physical units in accordance to the joint type it actuates. For instance, it will have units of N⋅m (torque) for revolute joints while it will have units of N (force) for prismatic joints.
Returns: A constant reference to the new JointActuator just added, which will remain valid for the lifetime of
this
plant.Raises: - RuntimeError if
joint.num_velocities() > 1
since for now we - only support actuators for single dof joints.
- Parameter
-
AddModelInstance
(self: pydrake.multibody.plant.MultibodyPlant_[float], name: str) → pydrake.multibody.tree.ModelInstanceIndex¶ Creates a new model instance. Returns the index for the model instance.
- Parameter
name
: - A string that uniquely identifies the new instance to be added to
this
model. An exception is thrown if an instance with the same name already exists in the model. See HasModelInstanceNamed().
- Parameter
-
AddRigidBody
(*args, **kwargs)¶ Overloaded function.
- AddRigidBody(self: pydrake.multibody.plant.MultibodyPlant_[float], name: str, M_BBo_B: pydrake.multibody.tree.SpatialInertia_[float]) -> pydrake.multibody.tree.RigidBody_[float]
Creates a rigid body with the provided name and spatial inertia. This method returns a constant reference to the body just added, which will remain valid for the lifetime of
this
MultibodyPlant. The body will use the default model instance (model_instance “more on model instances”).Example of usage:
MultibodyPlant<T> plant; // ... Code to define spatial_inertia, a SpatialInertia<T> object ... const RigidBody<T>& body = plant.AddRigidBody("BodyName", spatial_inertia);
- Parameter
name
: - A string that identifies the new body to be added to
this
model. A RuntimeError is thrown if a body namedname
already is part of the model in the default model instance. See HasBodyNamed(), Body::name(). - Parameter
M_BBo_B
: - The SpatialInertia of the new rigid body to be added to
this
MultibodyPlant, computed about the body frame originBo
and expressed in the body frame B.
Returns: A constant reference to the new RigidBody just added, which will remain valid for the lifetime of
this
MultibodyPlant.Raises: - RuntimeError if additional model instances have been created
- beyond the world and default instances.
- AddRigidBody(self: pydrake.multibody.plant.MultibodyPlant_[float], name: str, model_instance: pydrake.multibody.tree.ModelInstanceIndex, M_BBo_B: pydrake.multibody.tree.SpatialInertia_[float]) -> pydrake.multibody.tree.RigidBody_[float]
Creates a rigid body with the provided name and spatial inertia. This method returns a constant reference to the body just added, which will remain valid for the lifetime of
this
MultibodyPlant.Example of usage:
MultibodyPlant<T> plant; // ... Code to define spatial_inertia, a SpatialInertia<T> object ... ModelInstanceIndex model_instance = plant.AddModelInstance("instance"); const RigidBody<T>& body = plant.AddRigidBody("BodyName", model_instance, spatial_inertia);
- Parameter
name
: - A string that identifies the new body to be added to
this
model. A RuntimeError is thrown if a body namedname
already is part ofmodel_instance
. See HasBodyNamed(), Body::name(). - Parameter
model_instance
: - A model instance index which this body is part of.
- Parameter
M_BBo_B
: - The SpatialInertia of the new rigid body to be added to
this
MultibodyPlant, computed about the body frame originBo
and expressed in the body frame B.
Returns: A constant reference to the new RigidBody just added, which will remain valid for the lifetime of this
MultibodyPlant.
-
CalcBiasSpatialAcceleration
(self: pydrake.multibody.plant.MultibodyPlant_[float], context: pydrake.systems.framework.Context_[float], with_respect_to: pydrake.multibody.tree.JacobianWrtVariable, frame_B: pydrake.multibody.tree.Frame_[float], p_BoBp_B: numpy.ndarray[numpy.float64[3, 1]], frame_A: pydrake.multibody.tree.Frame_[float], frame_E: pydrake.multibody.tree.Frame_[float]) → pydrake.multibody.math.SpatialAcceleration_[float]¶ For one point Bp affixed/welded to a frame B, calculates A𝑠Bias_ABp, Bp’s spatial acceleration bias in frame A with respect to “speeds” 𝑠, where 𝑠 is either q̇ (time-derivatives of generalized positions) or v (generalized velocities). A𝑠Bias_ABp is the term in A_ABp (Bp’s spatial acceleration in A) that does not include 𝑠̇, i.e., A𝑠Bias_ABp is Bi’s translational acceleration in A when 𝑠̇ = 0.
A_ABp = J𝑠_V_ABp ⋅ 𝑠̇ + J̇𝑠_V_ABp ⋅ 𝑠 (𝑠 = q̇ or 𝑠 = v), hence A𝑠Bias_ABp = J̇𝑠_V_ABp ⋅ 𝑠
where J𝑠_V_ABp is Bp’s spatial velocity Jacobian in frame A for speeds s (see CalcJacobianSpatialVelocity() for details on J𝑠_V_ABp).
- Parameter
context
: - The state of the multibody system.
- Parameter
with_respect_to
: - Enum equal to JacobianWrtVariable::kQDot or JacobianWrtVariable::kV, indicating whether the spatial accceleration bias is with respect to 𝑠 = q̇ or 𝑠 = v.
- Parameter
frame_B
: - The frame on which point Bp is affixed/welded.
- Parameter
p_BoBp_B
: - Position vector from Bo (frame_B’s origin) to point Bp (regarded as affixed/welded to B), expressed in frame_B.
- Parameter
frame_A
: - The frame that measures A𝑠Bias_ABp. Currently, an exception is thrown if frame_A is not the World frame.
- Parameter
frame_E
: - The frame in which A𝑠Bias_ABp is expressed on output.
Returns: A𝑠Bias_ABp_E Point Bp’s spatial acceleration bias in frame A with respect to speeds 𝑠 (𝑠 = q̇ or 𝑠 = v), expressed in frame E. Note
Shown below, A𝑠Bias_ABp_E = J̇𝑠_V_ABp ⋅ 𝑠 is quadratic in 𝑠.
V_ABp = J𝑠_V_ABp ⋅ 𝑠 which upon vector differentiation in A gives A_ABp = J𝑠_V_ABp ⋅ 𝑠̇ + J̇𝑠_V_ABp ⋅ 𝑠 Since J̇𝑠_V_ABp is linear in 𝑠, A𝑠Bias_ABp = J̇𝑠_V_ABp ⋅ 𝑠 is quadratic in 𝑠.
See also
CalcJacobianSpatialVelocity() to compute J𝑠_V_ABp, point Bp’s translational velocity Jacobian in frame A with respect to 𝑠.
Raises: RuntimeError if with_respect_to is not JacobianWrtVariable::kV Raises: RuntimeError if frame_A is not the world frame. - Parameter
-
CalcBiasTerm
(self: pydrake.multibody.plant.MultibodyPlant_[float], context: pydrake.systems.framework.Context_[float]) → numpy.ndarray[numpy.float64[m, 1]]¶ Computes the bias term
C(q, v)v
containing Coriolis, centripetal, and gyroscopic effects in the multibody equations of motion:M(q) v̇ + C(q, v) v = tau_app + ∑ (Jv_V_WBᵀ(q) ⋅ Fapp_Bo_W)
where
M(q)
is the multibody model’s mass matrix andtau_app
is a vector of generalized forces. The last term is a summation over all bodies of the dot-product ofFapp_Bo_W
(applied spatial force on body B at Bo) withJv_V_WB(q)
(B’s spatial Jacobian in world W with respect to generalized velocities v). Note: B’s spatial velocity in W can be writtenV_WB = Jv_V_WB * v
.- Parameter
context
: - The context containing the state of the model. It stores the generalized positions q and the generalized velocities v.
- Parameter
Cv
: - On output,
Cv
will contain the productC(q, v)v
. It must be a valid (non-null) pointer to a column vector inℛⁿ
with n the number of generalized velocities (num_velocities()) of the model. This method aborts if Cv is nullptr or if it does not have the proper size.
- Parameter
-
CalcBiasTranslationalAcceleration
(self: pydrake.multibody.plant.MultibodyPlant_[float], context: pydrake.systems.framework.Context_[float], with_respect_to: pydrake.multibody.tree.JacobianWrtVariable, frame_B: pydrake.multibody.tree.Frame_[float], p_BoBi_B: numpy.ndarray[numpy.float64[3, n], flags.f_contiguous], frame_A: pydrake.multibody.tree.Frame_[float], frame_E: pydrake.multibody.tree.Frame_[float]) → numpy.ndarray[numpy.float64[3, n]]¶ For each point Bi affixed/welded to a frame B, calculates a𝑠Bias_ABi, Bi’s translational acceleration bias in frame A with respect to “speeds” 𝑠, where 𝑠 is either q̇ (time-derivatives of generalized positions) or v (generalized velocities). a𝑠Bias_ABi is the term in a_ABi (Bi’s translational acceleration in A) that does not include 𝑠̇, i.e., a𝑠Bias_ABi is Bi’s translational acceleration in A when 𝑠̇ = 0.
a_ABi = J𝑠_v_ABi ⋅ 𝑠̇ + J̇𝑠_v_ABi ⋅ 𝑠 (𝑠 = q̇ or 𝑠 = v), hence a𝑠Bias_ABi = J̇𝑠_v_ABi ⋅ 𝑠
where J𝑠_v_ABi is Bi’s translational velocity Jacobian in frame A for s (see CalcJacobianTranslationalVelocity() for details on J𝑠_v_ABi).
- Parameter
context
: - The state of the multibody system.
- Parameter
with_respect_to
: - Enum equal to JacobianWrtVariable::kQDot or JacobianWrtVariable::kV, indicating whether the translational accceleration bias is with respect to 𝑠 = q̇ or 𝑠 = v.
- Parameter
frame_B
: - The frame on which points Bi are affixed/welded.
- Parameter
p_BoBi_B
: - A position vector or list of p position vectors from Bo (frame_B’s
origin) to points Bi (regarded as affixed to B), where each
position vector is expressed in frame_B. Each column in the
3 x p
matrix p_BoBi_B corresponds to a position vector. - Parameter
frame_A
: - The frame that measures a𝑠Bias_ABi. Currently, an exception is thrown if frame_A is not the World frame.
- Parameter
frame_E
: - The frame in which a𝑠Bias_ABi is expressed on output.
Returns: a𝑠Bias_ABi_E Point Bi’s translational acceleration bias in frame A with respect to speeds 𝑠 (𝑠 = q̇ or 𝑠 = v), expressed in frame E. a𝑠Bias_ABi_E is a 3 x p
matrix, where p is the number of points Bi.Note
Shown below, a𝑠Bias_ABi_E = J̇𝑠_v_ABp ⋅ 𝑠 is quadratic in 𝑠.
v_ABi = J𝑠_v_ABi ⋅ 𝑠 which upon vector differentiation in A gives a_ABi = J𝑠_v_ABi ⋅ 𝑠̇ + J̇𝑠_v_ABi ⋅ 𝑠 Since J̇𝑠_v_ABi is linear in 𝑠, a𝑠Bias_ABi = J̇𝑠_v_ABi ⋅ 𝑠 is quadratic in 𝑠.
See also
CalcJacobianTranslationalVelocity() to compute J𝑠_v_ABi, point Bi’s translational velocity Jacobian in frame A with respect to 𝑠.
- Precondition:
- p_BoBi_B must have 3 rows.
Raises: RuntimeError if with_respect_to is not JacobianWrtVariable::kV Raises: RuntimeError if frame_A is not the world frame. - Parameter
-
CalcCenterOfMassPosition
(self: pydrake.multibody.plant.MultibodyPlant_[float], context: pydrake.systems.framework.Context_[float]) → numpy.ndarray[numpy.float64[3, 1]]¶ This method computes the center of mass position p_WCcm of all bodies in
MultibodyPlant
measured and expressed in world frame W. The bodies are considered as a single composite body C, whose center of masscomposite_mass
is located at Ccm. The world_body() is ignored.- Parameter
context
: - The context containing the state of the model. It stores the generalized positions q of the model.
- Returns
p_WCcm
: - The output position of center of mass in the world frame W.
Raises: - RuntimeError if
MultibodyPlant
has no body except world_body()
.
Raises: RuntimeError unless
composite_mass > 0
.- Parameter
-
CalcForceElementsContribution
(self: pydrake.multibody.plant.MultibodyPlant_[float], context: pydrake.systems.framework.Context_[float], forces: pydrake.multibody.tree.MultibodyForces_[float]) → None¶ Computes the combined force contribution of ForceElement objects in the model. A ForceElement can apply forces as a spatial force per body or as generalized forces, depending on the ForceElement model. ForceElement contributions are a function of the state and time only. The output from this method can immediately be used as input to CalcInverseDynamics() to include the effect of applied forces by force elements.
- Parameter
context
: - The context containing the state of this model.
- Parameter
forces
: - A pointer to a valid, non nullptr, multibody forces object. On
output
forces
will store the forces exerted by all the ForceElement objects in the model.
Raises: - RuntimeError if
forces
is null or not compatible with this - model, per MultibodyForces::CheckInvariants().
- Parameter
-
CalcGravityGeneralizedForces
(self: pydrake.multibody.plant.MultibodyPlant_[float], context: pydrake.systems.framework.Context_[float]) → numpy.ndarray[numpy.float64[m, 1]]¶ Computes the generalized forces
tau_g(q)
due to gravity as a function of the generalized positionsq
stored in the inputcontext
. The vector of generalized forces due to gravitytau_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: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 model.
Returns: tau_g A vector containing the generalized forces due to gravity. The generalized forces are consistent with the vector of generalized velocities v
forthis
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 the gravitational potential energy.- Parameter
-
CalcInverseDynamics
(self: pydrake.multibody.plant.MultibodyPlant_[float], context: pydrake.systems.framework.Context_[float], known_vdot: numpy.ndarray[numpy.float64[m, 1]], external_forces: pydrake.multibody.tree.MultibodyForces_[float]) → numpy.ndarray[numpy.float64[m, 1]]¶ Given the state of this model in
context
and a known vector of generalized accelerationsvdot
, this method computes the set of generalized forcestau
that would need to be applied in order to attain the specified generalized accelerations. Mathematically, this method computes:tau = M(q)v̇ + C(q, v)v - tau_app - ∑ J_WBᵀ(q) Fapp_Bo_W
where
M(q)
is the model’s mass matrix,C(q, v)v
is the bias term containing Coriolis and gyroscopic effects andtau_app
consists of a vector applied generalized forces. The last term is a summation over all bodies in the model whereFapp_Bo_W
is an applied spatial force on body B atBo
which gets projected into the space of generalized forces with the transpose ofJv_V_WB(q)
(whereJv_V_WB
is B’s spatial velocity Jacobian in W with respect to generalized velocities v). Note: B’s spatial velocity in W can be written asV_WB = Jv_V_WB * v
. This method does not compute explicit expressions for the mass matrix nor for the bias term, which would be of at leastO(n²)
complexity, but it implements anO(n)
Newton-Euler recursive algorithm, where n is the number of bodies in the model. The explicit formation of the mass matrixM(q)
would require the calculation ofO(n²)
entries while explicitly forming the productC(q, v) * v
could require up toO(n³)
operations (see [Featherstone 1987, §4]), depending on the implementation. The recursive Newton-Euler algorithm is the most efficient currently known general method for solving inverse dynamics [Featherstone 2008].- Parameter
context
: - The context containing the state of the model.
- Parameter
known_vdot
: - A vector with the known generalized accelerations
vdot
for the full model. Use the provided Joint APIs in order to access entries into this array. - Parameter
external_forces
: - A set of forces to be applied to the system either as body spatial
forces
Fapp_Bo_W
or generalized forcestau_app
, see MultibodyForces for details.
Returns: the vector of generalized forces that would need to be applied to the mechanical system in order to achieve the desired acceleration given by known_vdot
.- Parameter
-
CalcJacobianAngularVelocity
(self: pydrake.multibody.plant.MultibodyPlant_[float], context: pydrake.systems.framework.Context_[float], with_respect_to: pydrake.multibody.tree.JacobianWrtVariable, frame_B: pydrake.multibody.tree.Frame_[float], frame_A: pydrake.multibody.tree.Frame_[float], frame_E: pydrake.multibody.tree.Frame_[float]) → numpy.ndarray[numpy.float64[3, n]]¶ Calculates J𝑠_w_AB, a frame B’s angular velocity Jacobian in a frame A with respect to “speeds” 𝑠.
J𝑠_w_AB ≜ [ ∂(w_AB)/∂𝑠₁, ... ∂(w_AB)/∂𝑠ₙ ] (n is j or k) w_AB = J𝑠_w_AB ⋅ 𝑠 w_AB is linear in 𝑠 ≜ [𝑠₁ ... 𝑠ₙ]ᵀ
w_AB
is B’s angular velocity in frame A and “speeds” 𝑠 is either q̇ ≜ [q̇₁ … q̇ⱼ]ᵀ (time-derivatives of j generalized positions) or v ≜ [v₁ … vₖ]ᵀ (k generalized velocities).- Parameter
context
: - The state of the multibody system.
- Parameter
with_respect_to
: - Enum equal to JacobianWrtVariable::kQDot or
JacobianWrtVariable::kV, indicating whether the Jacobian
J𝑠_w_AB
is partial derivatives with respect to 𝑠 = q̇ (time-derivatives of generalized positions) or with respect to 𝑠 = v (generalized velocities). - Parameter
frame_B
: - The frame B in
w_AB
(B’s angular velocity in A). - Parameter
frame_A
: - The frame A in
w_AB
(B’s angular velocity in A). - Parameter
frame_E
: - The frame in which
w_AB
is expressed on input and the frame in which the JacobianJ𝑠_w_AB
is expressed on output. - Parameter
J𝑠_w_AB_E
: - Frame B’s angular velocity Jacobian in frame A with respect to
speeds 𝑠 (which is either q̇ or v), expressed in frame E. The
Jacobian is a function of only generalized positions q (which are
pulled from the context). The previous definition shows
J𝑠_w_AB_E
is a matrix of size3 x n
, where n is the number of elements in 𝑠.
Raises: RuntimeError if J𝑠_w_AB_E
is nullptr or not of size3 x n
.- Parameter
-
CalcJacobianSpatialVelocity
(self: pydrake.multibody.plant.MultibodyPlant_[float], context: pydrake.systems.framework.Context_[float], with_respect_to: pydrake.multibody.tree.JacobianWrtVariable, frame_B: pydrake.multibody.tree.Frame_[float], p_BP: numpy.ndarray[numpy.float64[3, 1]], frame_A: pydrake.multibody.tree.Frame_[float], frame_E: pydrake.multibody.tree.Frame_[float]) → numpy.ndarray[numpy.float64[m, n]]¶ For one point Bp fixed/welded to a frame B, calculates J𝑠_V_ABp, Bp’s spatial velocity Jacobian in frame A with respect to “speeds” 𝑠.
J𝑠_V_ABp ≜ [ ∂(V_ABp)/∂𝑠₁, ... ∂(V_ABp)/∂𝑠ₙ ] (n is j or k) V_ABp = J𝑠_V_ABp ⋅ 𝑠 V_ABp is linear in 𝑠 ≜ [𝑠₁ ... 𝑠ₙ]ᵀ
V_ABp
is Bp’s spatial velocity in frame A and “speeds” 𝑠 is either q̇ ≜ [q̇₁ … q̇ⱼ]ᵀ (time-derivatives of j generalized positions) or v ≜ [v₁ … vₖ]ᵀ (k generalized velocities).- Parameter
context
: - The state of the multibody system.
- Parameter
with_respect_to
: - Enum equal to JacobianWrtVariable::kQDot or
JacobianWrtVariable::kV, indicating whether the Jacobian
J𝑠_V_ABp
is partial derivatives with respect to 𝑠 = q̇ (time-derivatives of generalized positions) or with respect to 𝑠 = v (generalized velocities). - Parameter
frame_B
: - The frame on which point Bp is fixed/welded.
- Parameter
p_BoBp_B
: - A position vector from Bo (frame_B’s origin) to point Bp (regarded as fixed/welded to B), expressed in frame_B.
- Parameter
frame_A
: - The frame that measures
v_ABp
(Bp’s velocity in A). Note: It is natural to wonder why there is no parameter p_AoAp_A (similar to the parameter p_BoBp_B for frame_B). There is no need for p_AoAp_A because Bp’s velocity in A is defined as the derivative in frame A of Bp’s position vector from any point fixed to A. - Parameter
frame_E
: - The frame in which
v_ABp
is expressed on input and the frame in which the JacobianJ𝑠_V_ABp
is expressed on output. - Parameter
J𝑠_V_ABp_E
: - Point Bp’s spatial velocity Jacobian in frame A with respect to
speeds 𝑠 (which is either q̇ or v), expressed in frame E.
J𝑠_V_ABp_E
is a6 x n
matrix, where n is the number of elements in 𝑠. The Jacobian is a function of only generalized positions q (which are pulled from the context). Note: The returned6 x n
matrix stores frame B’s angular velocity Jacobian in A in rows 1-3 and stores point Bp’s translational velocity Jacobian in A in rows 4-6, i.e.,
J𝑠_w_AB_E = J𝑠_V_ABp_E.topRows<3>(); J𝑠_v_ABp_E = J𝑠_V_ABp_E.bottomRows<3>();
Note: Consider CalcJacobianTranslationalVelocity() for multiple points fixed to frame B and consider CalcJacobianAngularVelocity() to calculate frame B’s angular velocity Jacobian.
Raises: RuntimeError if J𝑠_V_ABp_E
is nullptr or not sized6 x n
.- Parameter
-
CalcJacobianTranslationalVelocity
(self: pydrake.multibody.plant.MultibodyPlant_[float], context: pydrake.systems.framework.Context_[float], with_respect_to: pydrake.multibody.tree.JacobianWrtVariable, frame_B: pydrake.multibody.tree.Frame_[float], p_BoBi_B: numpy.ndarray[numpy.float64[3, n], flags.f_contiguous], frame_A: pydrake.multibody.tree.Frame_[float], frame_E: pydrake.multibody.tree.Frame_[float]) → numpy.ndarray[numpy.float64[m, n]]¶ For each point Bi affixed/welded to a frame B, calculates J𝑠_v_ABi, Bi’s translational velocity Jacobian in frame A with respect to “speeds” 𝑠.
J𝑠_v_ABi ≜ [ ∂(v_ABi)/∂𝑠₁, ... ∂(v_ABi)/∂𝑠ₙ ] (n is j or k) v_ABi = J𝑠_v_ABi ⋅ 𝑠 v_ABi is linear in 𝑠 ≜ [𝑠₁ ... 𝑠ₙ]ᵀ
v_ABi
is Bi’s translational velocity in frame A and “speeds” 𝑠 is either q̇ ≜ [q̇₁ … q̇ⱼ]ᵀ (time-derivatives of j generalized positions) or v ≜ [v₁ … vₖ]ᵀ (k generalized velocities).- Parameter
context
: - The state of the multibody system.
- Parameter
with_respect_to
: - Enum equal to JacobianWrtVariable::kQDot or
JacobianWrtVariable::kV, indicating whether the Jacobian
J𝑠_v_ABi
is partial derivatives with respect to 𝑠 = q̇ (time-derivatives of generalized positions) or with respect to 𝑠 = v (generalized velocities). - Parameter
frame_B
: - The frame on which point Bi is affixed/welded.
- Parameter
p_BoBi_B
: - A position vector or list of p position vectors from Bo (frame_B’s origin) to points Bi (regarded as affixed to B), where each position vector is expressed in frame_B.
- Parameter
frame_A
: - The frame that measures
v_ABi
(Bi’s velocity in A). Note: It is natural to wonder why there is no parameter p_AoAi_A (similar to the parameter p_BoBi_B for frame_B). There is no need for p_AoAi_A because Bi’s velocity in A is defined as the derivative in frame A of Bi’s position vector from any point affixed to A. - Parameter
frame_E
: - The frame in which
v_ABi
is expressed on input and the frame in which the JacobianJ𝑠_v_ABi
is expressed on output. - Parameter
J𝑠_v_ABi_E
: - Point Bi’s velocity Jacobian in frame A with respect to speeds 𝑠
(which is either q̇ or v), expressed in frame E.
J𝑠_v_ABi_E
is a3*p x n
matrix, where p is the number of points Bi and n is the number of elements in 𝑠. The Jacobian is a function of only generalized positions q (which are pulled from the context).
Raises: - RuntimeError if
J𝑠_v_ABi_E
is nullptr or not sized ``3*p x - n``.
Note
When 𝑠 = q̇,
Jq̇_v_ABi = Jq_p_AoBi
. In other words, point Bi’s velocity Jacobian in frame A with respect to q̇ is equal to point Bi’s position Jacobian from Ao (A’s origin) in frame A with respect to q.[∂(v_ABi)/∂q̇₁, ... ∂(v_ABi)/∂q̇ⱼ] = [∂(p_AoBi)/∂q₁, ... ∂(p_AoBi)/∂qⱼ]
Note: Each partial derivative of p_AoBi is taken in frame A.
- Parameter
-
CalcMassMatrixViaInverseDynamics
(self: pydrake.multibody.plant.MultibodyPlant_[float], context: pydrake.systems.framework.Context_[float]) → numpy.ndarray[numpy.float64[m, n]]¶
-
CalcPointsPositions
(self: pydrake.multibody.plant.MultibodyPlant_[float], context: pydrake.systems.framework.Context_[float], frame_B: pydrake.multibody.tree.Frame_[float], p_BQi: numpy.ndarray[numpy.float64[m, n], flags.f_contiguous], frame_A: pydrake.multibody.tree.Frame_[float]) → numpy.ndarray[numpy.float64[m, n]]¶ Given the positions
p_BQi
for a set of pointsQi
measured and expressed in a frame B, this method computes the positionsp_AQi(q)
of each pointQi
in the set as measured and expressed in another frame A, as a function of the generalized positions q of the model.- Parameter
context
: - The context containing the state of the model. It stores the generalized positions q of the model.
- Parameter
frame_B
: - The frame B in which the positions
p_BQi
of a set of pointsQi
are given. - Parameter
p_BQi
: - The input positions of each point
Qi
in frame B.p_BQi ∈ ℝ³ˣⁿᵖ
withnp
the number of points in the set. Each column ofp_BQi
corresponds to a vector in ℝ³ holding the position of one of the points in the set as measured and expressed in frame B. - Parameter
frame_A
: - The frame A in which it is desired to compute the positions
p_AQi
of each pointQi
in the set. - Parameter
p_AQi
: - The output positions of each point
Qi
now computed as measured and expressed in frame A. The outputp_AQi
must have the same size as the inputp_BQi
or otherwise this method aborts. That isp_AQi
must be inℝ³ˣⁿᵖ
.
Note
Both
p_BQi
andp_AQi
must have three rows. Otherwise this method will throw a RuntimeError exception. This method also throws a RuntimeError exception ifp_BQi
andp_AQi
differ in the number of columns.- Parameter
-
CalcRelativeTransform
(self: pydrake.multibody.plant.MultibodyPlant_[float], context: pydrake.systems.framework.Context_[float], frame_A: pydrake.multibody.tree.Frame_[float], frame_B: pydrake.multibody.tree.Frame_[float]) → pydrake.math.RigidTransform_[float]¶ Calculates the rigid transform (pose)
X_FG
relating frame F and frame G.- Parameter
context
: - The state of the multibody system, which includes the system’s
generalized positions q. Note:
X_FG
is a function of q. - Parameter
frame_F
: - The frame F designated in the rigid transform
X_FG
. - Parameter
frame_G
: - The frame G designated in the rigid transform
X_FG
. - Returns
X_FG
: - The RigidTransform relating frame F and frame G.
- Parameter
-
CalcSpatialAccelerationsFromVdot
(self: pydrake.multibody.plant.MultibodyPlant_[float], context: pydrake.systems.framework.Context_[float], known_vdot: numpy.ndarray[numpy.float64[m, 1]]) → List[pydrake.multibody.math.SpatialAcceleration_[float]]¶ Given the state of this model in
context
and a known vector of generalized accelerationsknown_vdot
, this method computes the spatial accelerationA_WB
for each body as measured and expressed in the world frame W.- Parameter
context
: - The context containing the state of this model.
- Parameter
known_vdot
: - A vector with the generalized accelerations for the full model.
- Parameter
A_WB_array
: - A pointer to a valid, non nullptr, vector of spatial accelerations
containing the spatial acceleration
A_WB
for each body. It must be of size equal to the number of bodies in the model. On output, entries will be ordered by BodyIndex.
Raises: RuntimeError if A_WB_array is not of size num_bodies()
.- Parameter
-
CollectRegisteredGeometries
(self: pydrake.multibody.plant.MultibodyPlant_[float], bodies: List[pydrake.multibody.tree.Body_[float]]) → pydrake.geometry.GeometrySet¶ For each of the provided
bodies
, collects up all geometries that have been registered to that body. Intended to be used in conjunction with SceneGraph::ExcludeCollisionsWithin() and SceneGraph::ExcludeCollisionsBetween() to filter collisions between the geometries registered to the bodies.For example:
// Don't report on collisions between geometries affixed to ``body1``, // ``body2``, or ``body3``. std::vector<const RigidBody<T>*> bodies{&body1, &body2, &body3}; geometry::GeometrySet set = plant.CollectRegisteredGeometries(bodies); scene_graph.ExcludeCollisionsWithin(set);
Note
There is a very specific order of operations:
- Bodies and geometries must be added to the MultibodyPlant.
- The MultibodyPlant must be finalized (via Finalize()).
- Create GeometrySet instances from bodies (via this method).
- Invoke SceneGraph::ExcludeCollisions*() to filter collisions.
- Allocate context.
Changing the order will cause exceptions to be thrown.
Raises: RuntimeError if called pre-finalize.
-
default_coulomb_friction
(self: pydrake.multibody.plant.MultibodyPlant_[float], geometry_id: pydrake.geometry.GeometryId) → pydrake.multibody.plant.CoulombFriction_[float]¶ Returns the friction coefficients provided during geometry registration for the given geometry
id
. We call these the “default” coefficients but note that we mean user-supplied per-geometry default, not something more global.Raises: - RuntimeError if
id
does not correspond to a geometry in this
model registered for contact modeling.
See also
RegisterCollisionGeometry() for details on geometry registration. (Deprecated.)
- Deprecated:
- default_coulomb_friction() will be removed. Please use SceneGraph which now stores friction properties in ProximityProperties. See the section “Accessing point contact parameters” in the documentation for MultibodyPlant. This will be removed from Drake on or after 2020-09-01.
- RuntimeError if
-
EvalBodyPoseInWorld
(self: pydrake.multibody.plant.MultibodyPlant_[float], context: pydrake.systems.framework.Context_[float], body: pydrake.multibody.tree.Body_[float]) → pydrake.math.RigidTransform_[float]¶ Evaluate the pose
X_WB
of a body B in the world frame W.- Parameter
context
: - The context storing the state of the model.
- Parameter
body_B
: - The body B for which the pose is requested.
- Returns
X_WB
: - The pose of body frame B in the world frame W.
Raises: - RuntimeError if Finalize() was not called on
this
model or if body_B
does not belong to this model.
- Parameter
-
EvalBodySpatialVelocityInWorld
(self: pydrake.multibody.plant.MultibodyPlant_[float], context: pydrake.systems.framework.Context_[float], body: pydrake.multibody.tree.Body_[float]) → pydrake.multibody.math.SpatialVelocity_[float]¶ Evaluate the spatial velocity
V_WB
of a body B in the world frame W.- Parameter
context
: - The context storing the state of the model.
- Parameter
body_B
: - The body B for which the spatial velocity is requested.
Returns: V_WB The spatial velocity of body frame B in the world frame W.
Raises: - RuntimeError if Finalize() was not called on
this
model or if body_B
does not belong to this model.
- Parameter
-
Finalize
(self: pydrake.multibody.plant.MultibodyPlant_[float]) → None¶ This method must be called after all elements in the model (joints, bodies, force elements, constraints, etc.) are added and before any computations are performed. It essentially compiles all the necessary “topological information”, i.e. how bodies, joints and, any other elements connect with each other, and performs all the required pre-processing to enable computations at a later stage.
If the finalize stage is successful, the topology of this MultibodyPlant is valid, meaning that the topology is up-to-date after this call. No more multibody elements can be added after a call to Finalize().
At Finalize(), state and input/output ports for
this
plant are declared. Ifthis
plant registered geometry with a SceneGraph, input and output ports to enable communication with that SceneGraph are declared as well.If geometry has been registered on a SceneGraph instance, that instance must be provided to the Finalize() method so that any geometric implications of the finalization process can be appropriately handled.
See also
is_finalized().
Raises: RuntimeError if the MultibodyPlant has already been finalized.
-
geometry_source_is_registered
(self: pydrake.multibody.plant.MultibodyPlant_[float]) → bool¶ Returns
True
ifthis
MultibodyPlant was registered with a SceneGraph. This method can be called at any time during the lifetime ofthis
plant to query ifthis
plant has been registered with a SceneGraph, either pre- or post-finalize, see Finalize().
-
get_actuation_input_port
(*args, **kwargs)¶ Overloaded function.
- get_actuation_input_port(self: pydrake.multibody.plant.MultibodyPlant_[float]) -> pydrake.systems.framework.InputPort_[float]
Returns a constant reference to the input port for external actuation for the case where only one model instance has actuated dofs. This input port is a vector valued port, which can be set with JointActuator::set_actuation_vector().
- Precondition:
- Finalize() was already called on
this
plant.
Raises: - RuntimeError if called before Finalize(), if the model does not
- contain any actuators, or if multiple model instances have
- actuated dofs.
- get_actuation_input_port(self: pydrake.multibody.plant.MultibodyPlant_[float], model_instance: pydrake.multibody.tree.ModelInstanceIndex) -> pydrake.systems.framework.InputPort_[float]
Returns a constant reference to the input port for external actuation for a specific model instance. This input port is a vector valued port, which can be set with JointActuator::set_actuation_vector().
- Precondition:
- Finalize() was already called on
this
plant.
Raises: RuntimeError if called before Finalize(). Raises: RuntimeError if the model instance does not exist.
-
get_applied_generalized_force_input_port
(self: pydrake.multibody.plant.MultibodyPlant_[float]) → pydrake.systems.framework.InputPort_[float]¶ Returns a constant reference to the vector-valued input port for applied generalized forces, and the vector will be added directly into
tau
(see mbp_equations_of_motion “System dynamics”). This vector is ordered using the same convention as the plant velocities: you can set the generalized forces that will be applied to model instance i using, e.g.,SetVelocitiesInArray(i, model_forces, &force_array)
.Raises: RuntimeError if called before Finalize().
-
get_applied_spatial_force_input_port
(self: pydrake.multibody.plant.MultibodyPlant_[float]) → pydrake.systems.framework.InputPort_[float]¶ Returns a constant reference to the input port for applying spatial forces to bodies in the plant. The data type for the port is an std::vector of ExternallyAppliedSpatialForce; any number of spatial forces can be applied to any number of bodies in the plant.
-
get_body
(self: pydrake.multibody.plant.MultibodyPlant_[float], body_index: pydrake.multibody.tree.BodyIndex) → pydrake.multibody.tree.Body_[float]¶ Returns a constant reference to the body with unique index
body_index
.Raises: - RuntimeError if
body_index
does not correspond to a body in - this model.
- RuntimeError if
-
get_body_poses_output_port
(self: pydrake.multibody.plant.MultibodyPlant_[float]) → pydrake.systems.framework.OutputPort_[float]¶ Returns the output port of all body poses in the world frame. You can obtain the pose
X_WB
of a body B in the world frame W with:const auto& X_WB_all = plant.get_body_poses_output_port(). .Eval<std::vector<math::RigidTransform<double>>>(plant_context); const BodyIndex arm_body_index = plant.GetBodyByName("arm").index(); const math::RigidTransform<double>& X_WArm = X_WB_all[arm_body_index];
As shown in the example above, the resulting
std::vector
of body poses is indexed by BodyIndex, and it has size num_bodies(). BodyIndex “zero” (0) always corresponds to the world body, with pose equal to the identity at all times.Raises: RuntimeError if called pre-finalize.
-
get_body_spatial_accelerations_output_port
(self: pydrake.multibody.plant.MultibodyPlant_[float]) → pydrake.systems.framework.OutputPort_[float]¶ Returns the output port of all body spatial accelerations in the world frame. You can obtain the spatial acceleration
A_WB
of a body B in the world frame W with:const auto& A_WB_all = plant.get_body_spatial_accelerations_output_port(). .Eval<std::vector<SpatialAcceleration<double>>>(plant_context); const BodyIndex arm_body_index = plant.GetBodyByName("arm").index(); const SpatialVelocity<double>& A_WArm = A_WB_all[arm_body_index];
As shown in the example above, the resulting
std::vector
of body spatial accelerations is indexed by BodyIndex, and it has size num_bodies(). BodyIndex “zero” (0) always corresponds to the world body, with zero spatial acceleration at all times.Raises: RuntimeError if called pre-finalize.
-
get_body_spatial_velocities_output_port
(self: pydrake.multibody.plant.MultibodyPlant_[float]) → pydrake.systems.framework.OutputPort_[float]¶ Returns the output port of all body spatial velocities in the world frame. You can obtain the spatial velocity
V_WB
of a body B in the world frame W with:const auto& V_WB_all = plant.get_body_spatial_velocities_output_port(). .Eval<std::vector<SpatialVelocity<double>>>(plant_context); const BodyIndex arm_body_index = plant.GetBodyByName("arm").index(); const SpatialVelocity<double>& V_WArm = V_WB_all[arm_body_index];
As shown in the example above, the resulting
std::vector
of body spatial velocities is indexed by BodyIndex, and it has size num_bodies(). BodyIndex “zero” (0) always corresponds to the world body, with zero spatial velocity at all times.Raises: RuntimeError if called pre-finalize.
-
get_contact_penalty_method_time_scale
(self: pydrake.multibody.plant.MultibodyPlant_[float]) → float¶ Returns a time-scale estimate
tc
based on the requested penetration allowance δ set with set_penetration_allowance(). For the penalty method in use to enforce non-penetration, this time scale relates to the time it takes the relative normal velocity between two bodies to go to zero. This time scaletc
is artificially introduced by the penalty method and goes to zero in the limit to ideal rigid contact. Since numerical integration methods for continuum systems must be able to resolve a system’s dynamics, the time step used by an integrator must in general be much smaller than the time scaletc
. How much smaller will depend on the details of the problem and the convergence characteristics of the integrator and should be tuned appropriately. Another factor to take into account for setting up the simulation’s time step is the speed of the objects in your simulation. Ifvn
represents a reference velocity scale for the normal relative velocity between bodies, the new time scaletn = δ / vn
represents the time it would take for the distance between two bodies approaching with relative normal velocityvn
to decrease by the penetration_allowance δ. In this case a user should choose a time step for simulation that can resolve the smallest of the two time scalestc
andtn
.
-
get_contact_results_output_port
(self: pydrake.multibody.plant.MultibodyPlant_[float]) → pydrake.systems.framework.OutputPort_[float]¶ Returns a constant reference to the port that outputs ContactResults.
Raises: RuntimeError if called pre-finalize, see Finalize().
-
get_frame
(self: pydrake.multibody.plant.MultibodyPlant_[float], frame_index: pydrake.multibody.tree.FrameIndex) → pydrake.multibody.tree.Frame_[float]¶ Returns a constant reference to the frame with unique index
frame_index
.Raises: - RuntimeError if
frame_index
does not correspond to a frame in - this plant.
- RuntimeError if
-
get_generalized_acceleration_output_port
(*args, **kwargs)¶ Overloaded function.
- get_generalized_acceleration_output_port(self: pydrake.multibody.plant.MultibodyPlant_[float]) -> pydrake.systems.framework.OutputPort_[float]
Returns a constant reference to the output port for generalized accelerations v̇ of the model.
- Precondition:
- Finalize() was already called on
this
plant.
Raises: RuntimeError if called before Finalize(). - get_generalized_acceleration_output_port(self: pydrake.multibody.plant.MultibodyPlant_[float], model_instance: pydrake.multibody.tree.ModelInstanceIndex) -> pydrake.systems.framework.OutputPort_[float]
Returns a constant reference to the output port for the generalized accelerations v̇ᵢ ⊆ v̇ for model instance i.
- Precondition:
- Finalize() was already called on
this
plant.
Raises: RuntimeError if called before Finalize(). Raises: RuntimeError if the model instance does not exist.
-
get_generalized_contact_forces_output_port
(self: pydrake.multibody.plant.MultibodyPlant_[float], model_instance: pydrake.multibody.tree.ModelInstanceIndex) → pydrake.systems.framework.OutputPort_[float]¶ Returns a constant reference to the output port of generalized contact forces for a specific model instance.
- Precondition:
- Finalize() was already called on
this
plant.
Raises: RuntimeError if called before Finalize(). Raises: RuntimeError if the model instance does not exist.
-
get_geometry_poses_output_port
(self: pydrake.multibody.plant.MultibodyPlant_[float]) → pydrake.systems.framework.OutputPort_[float]¶ Returns the output port of frames’ poses to communicate with a SceneGraph.
-
get_geometry_query_input_port
(self: pydrake.multibody.plant.MultibodyPlant_[float]) → pydrake.systems.framework.InputPort_[float]¶ Returns a constant reference to the input port used to perform geometric queries on a SceneGraph. See SceneGraph::get_query_output_port(). Refer to section mbp_geometry “Geometry” of this class’s documentation for further details on collision geometry registration and connection with a SceneGraph.
-
get_joint
(self: pydrake.multibody.plant.MultibodyPlant_[float], joint_index: pydrake.multibody.tree.JointIndex) → pydrake.multibody.tree.Joint_[float]¶ Returns a constant reference to the joint with unique index
joint_index
.Raises: - RuntimeError when
joint_index
does not correspond to a joint - in this model.
- RuntimeError when
-
get_joint_actuator
(self: pydrake.multibody.plant.MultibodyPlant_[float], actuator_index: pydrake.multibody.tree.JointActuatorIndex) → pydrake.multibody.tree.JointActuator_[float]¶ Returns a constant reference to the joint actuator with unique index
actuator_index
.Raises: - RuntimeError if
actuator_index
does not correspond to a joint - actuator in this tree.
- RuntimeError if
-
get_reaction_forces_output_port
(self: pydrake.multibody.plant.MultibodyPlant_[float]) → pydrake.systems.framework.OutputPort_[float]¶ Returns the port for joint reaction forces. A Joint models the kinematical relationship which characterizes the possible relative motion between two bodies. In Drake, a joint connects a frame
Jp
on parent body P with a frameJc
on a child body C. This usage of the terms parent and child is just a convention and implies nothing about the inboard-outboard relationship between the bodies. Since a Joint imposes a kinematical relationship which characterizes the possible relative motion between frames Jp and Jc, reaction forces on each body are established. That is, we could cut the model at the joint and replace it with equivalent forces equal to these reaction forces in order to attain the same motions of the mechanical system.This output port allows to evaluate the reaction force
F_CJc_Jc
on the child body C, atJc
, and expressed in Jc for all joints in the model. This port evaluates to a vector of type std::vector<SpatialForce<T>> and size num_joints() indexed by JointIndex, see Joint::index(). Each entry corresponds to the spatial forceF_CJc_Jc
applied on the joint’s child body C (Joint::child_body()), at the joint’s child frameJc
(Joint::frame_on_child()) and expressed in frameJc
.Raises: RuntimeError if called pre-finalize.
-
get_source_id
(self: pydrake.multibody.plant.MultibodyPlant_[float]) → Optional[pydrake.geometry.SourceId]¶ Returns the unique id identifying
this
plant as a source for a SceneGraph. Returnsnullopt
ifthis
plant did not register any geometry. This method can be called at any time during the lifetime ofthis
plant to query ifthis
plant has been registered with a SceneGraph, either pre- or post-finalize, see Finalize(). However, a geometry::SourceId is only assigned once at the first call of any of this plant’s geometry registration methods, and it does not change after that. Post-finalize calls will always return the same value.
-
get_state_output_port
(*args, **kwargs)¶ Overloaded function.
- get_state_output_port(self: pydrake.multibody.plant.MultibodyPlant_[float]) -> pydrake.systems.framework.OutputPort_[float]
Returns a constant reference to the output port for the multibody state x = [q, v] of the model.
- Precondition:
- Finalize() was already called on
this
plant.
Raises: RuntimeError if called before Finalize(). - get_state_output_port(self: pydrake.multibody.plant.MultibodyPlant_[float], model_instance: pydrake.multibody.tree.ModelInstanceIndex) -> pydrake.systems.framework.OutputPort_[float]
Returns a constant reference to the output port for the state xᵢ = [qᵢ vᵢ] of model instance i. (Here qᵢ ⊆ q and vᵢ ⊆ v.)
- Precondition:
- Finalize() was already called on
this
plant.
Raises: RuntimeError if called before Finalize(). Raises: RuntimeError if the model instance does not exist.
-
GetAccelerationLowerLimits
(self: pydrake.multibody.plant.MultibodyPlant_[float]) → numpy.ndarray[numpy.float64[m, 1]]¶ Returns a vector of size
num_velocities()
containing the lower acceleration limits for every generalized velocity coordinate. These include joint and free body coordinates. Any unbounded or unspecified limits will be -infinity.Raises: RuntimeError if called pre-finalize.
-
GetAccelerationUpperLimits
(self: pydrake.multibody.plant.MultibodyPlant_[float]) → numpy.ndarray[numpy.float64[m, 1]]¶ Upper limit analog of GetAccelerationsLowerLimits(), where any unbounded or unspecified limits will be +infinity.
See also
GetAccelerationLowerLimits() for more information.
-
GetBodyByName
(*args, **kwargs)¶ Overloaded function.
- GetBodyByName(self: pydrake.multibody.plant.MultibodyPlant_[float], name: str) -> pydrake.multibody.tree.Body_[float]
Returns a constant reference to a body that is identified by the string
name
inthis
MultibodyPlant.Raises: RuntimeError if there is no body with the requested name. Raises: RuntimeError if the body name occurs in multiple model instances. See also
HasBodyNamed() to query if there exists a body in
this
MultibodyPlant with a given specified name.- GetBodyByName(self: pydrake.multibody.plant.MultibodyPlant_[float], name: str, model_instance: pydrake.multibody.tree.ModelInstanceIndex) -> pydrake.multibody.tree.Body_[float]
Returns a constant reference to the body that is uniquely identified by the string
name
andmodel_instance
inthis
MultibodyPlant.Raises: RuntimeError if there is no body with the requested name. See also
HasBodyNamed() to query if there exists a body in
this
MultibodyPlant with a given specified name.
-
GetBodyFrameIdIfExists
(self: pydrake.multibody.plant.MultibodyPlant_[float], body_index: pydrake.multibody.tree.BodyIndex) → Optional[pydrake.geometry.FrameId]¶ If the body with
body_index
belongs to the called plant, it returns the geometry::FrameId associated with it. Otherwise, it returns nullopt.
-
GetBodyFrameIdOrThrow
(self: pydrake.multibody.plant.MultibodyPlant_[float], body_index: pydrake.multibody.tree.BodyIndex) → pydrake.geometry.FrameId¶ If the body with
body_index
belongs to the called plant, it returns the geometry::FrameId associated with it. Otherwise this method throws an exception.Raises: - RuntimeError if the called plant does not have the body indicated
- by
body_index
.
-
GetBodyFromFrameId
(self: pydrake.multibody.plant.MultibodyPlant_[float], arg0: pydrake.geometry.FrameId) → pydrake.multibody.tree.Body_[float]¶ Given a geometry frame identifier, returns a pointer to the body associated with that id (nullptr if there is no such body).
-
GetBodyIndices
(self: pydrake.multibody.plant.MultibodyPlant_[float], model_instance: pydrake.multibody.tree.ModelInstanceIndex) → List[pydrake.multibody.tree.BodyIndex]¶ Returns a list of body indices associated with
model_instance
.
-
GetCollisionGeometriesForBody
(self: pydrake.multibody.plant.MultibodyPlant_[float], body: pydrake.multibody.tree.Body_[float]) → List[pydrake.geometry.GeometryId]¶ Returns an array of GeometryId’s identifying the different contact geometries for
body
previously registered with a SceneGraph.Note
This method can be called at any time during the lifetime of
this
plant, either pre- or post-finalize, see Finalize(). Post-finalize calls will always return the same value.See also
RegisterCollisionGeometry(), Finalize()
-
GetDefaultFreeBodyPose
(self: pydrake.multibody.plant.MultibodyPlant_[float], body: pydrake.multibody.tree.Body_[float]) → pydrake.math.RigidTransform_[float]¶ Gets the default pose of
body
as set by SetDefaultFreeBodyPose().- Parameter
body
: - Body whose default pose will be retrieved.
- Parameter
-
GetFrameByName
(*args, **kwargs)¶ Overloaded function.
- GetFrameByName(self: pydrake.multibody.plant.MultibodyPlant_[float], name: str) -> pydrake.multibody.tree.Frame_[float]
Returns a constant reference to a frame that is identified by the string
name
inthis
model.Raises: RuntimeError if there is no frame with the requested name. Raises: RuntimeError if the frame name occurs in multiple model instances. See also
HasFrameNamed() to query if there exists a frame in
this
model with a given specified name.- GetFrameByName(self: pydrake.multibody.plant.MultibodyPlant_[float], name: str, model_instance: pydrake.multibody.tree.ModelInstanceIndex) -> pydrake.multibody.tree.Frame_[float]
Returns a constant reference to the frame that is uniquely identified by the string
name
inmodel_instance
.Raises: RuntimeError if there is no frame with the requested name. Raises: RuntimeError if model_instance
is not valid for this model.See also
HasFrameNamed() to query if there exists a frame in
this
model with a given specified name.
-
GetJointActuatorByName
(self: pydrake.multibody.plant.MultibodyPlant_[float], name: str) → pydrake.multibody.tree.JointActuator_[float]¶ Returns a constant reference to an actuator that is identified by the string
name
inthis
MultibodyPlant.Raises: RuntimeError if there is no actuator with the requested name.
Raises: - RuntimeError if the actuator name occurs in multiple model
instances.
See also
HasJointActuatorNamed() to query if there exists an actuator in
this
MultibodyPlant with a given specified name.
-
GetJointByName
(self: pydrake.multibody.plant.MultibodyPlant_[float], name: str, model_instance: Optional[pydrake.multibody.tree.ModelInstanceIndex] = None) → pydrake.multibody.tree.Joint_[float]¶ Returns a constant reference to a joint that is identified by the string
name
inthis
MultibodyPlant. If the optional template argument is supplied, then the returned value is downcast to the specifiedJointType
.- Template parameter
JointType
: - The specific type of the Joint to be retrieved. It must be a subclass of Joint.
Raises: - RuntimeError if the named joint is not of type
JointType
or if - there is no Joint with that name.
Raises: RuntimeError if
model_instance
is not valid for this model.See also
HasJointNamed() to query if there exists a joint in
this
MultibodyPlant with a given specified name.- Template parameter
-
GetModelInstanceByName
(self: pydrake.multibody.plant.MultibodyPlant_[float], name: str) → pydrake.multibody.tree.ModelInstanceIndex¶ Returns the index to the model instance that is uniquely identified by the string
name
inthis
MultibodyPlant.Raises: RuntimeError if there is no instance with the requested name. See also
HasModelInstanceNamed() to query if there exists an instance in
this
MultibodyPlant with a given specified name.
-
GetModelInstanceName
(self: pydrake.multibody.plant.MultibodyPlant_[float], model_instance: pydrake.multibody.tree.ModelInstanceIndex) → str¶ Returns the name of a
model_instance
.Raises: - RuntimeError when
model_instance
does not correspond to a - model in this model.
- RuntimeError when
-
GetMutableJointByName
(self: pydrake.multibody.plant.MultibodyPlant_[float], name: str, model_instance: Optional[pydrake.multibody.tree.ModelInstanceIndex] = None) → pydrake.multibody.tree.Joint_[float]¶ Returns a constant reference to a joint that is identified by the string
name
inthis
MultibodyPlant. If the optional template argument is supplied, then the returned value is downcast to the specifiedJointType
.- Template parameter
JointType
: - The specific type of the Joint to be retrieved. It must be a subclass of Joint.
Raises: - RuntimeError if the named joint is not of type
JointType
or if - there is no Joint with that name.
Raises: RuntimeError if
model_instance
is not valid for this model.See also
HasJointNamed() to query if there exists a joint in
this
MultibodyPlant with a given specified name.- Template parameter
-
GetMutablePositions
(self: pydrake.multibody.plant.MultibodyPlant_[float], context: pydrake.systems.framework.Context_[float]) → numpy.ndarray[numpy.float64[m, 1], flags.writeable]¶ (Advanced) Returns a mutable vector reference containing the vector of generalized positions (see warning).
Note
This method returns a reference to existing data, exhibits constant i.e., O(1) time complexity, and runs very quickly.
Warning
You should use SetPositions() instead of this method unless you are fully aware of the possible interactions with the caching mechanism (see dangerous_get_mutable).
Raises: - RuntimeError if the
context
is nullptr or if it does not - correspond to the context for a multibody model.
- RuntimeError if the
-
GetMutablePositionsAndVelocities
(self: pydrake.multibody.plant.MultibodyPlant_[float], context: pydrake.systems.framework.Context_[float]) → numpy.ndarray[numpy.float64[m, 1], flags.writeable]¶ (Advanced) Returns a mutable vector containing the vector
[q; v]
of the model withq
the vector of generalized positions andv
the vector of generalized velocities (see warning).Warning
You should use SetPositionsAndVelocities() instead of this method unless you are fully aware of the interactions with the caching mechanism (see dangerous_get_mutable).
Raises: - RuntimeError if the
context
is nullptr or if it does not - correspond to the context for a multibody model.
- RuntimeError if the
-
GetMutableVelocities
(self: pydrake.multibody.plant.MultibodyPlant_[float], context: pydrake.systems.framework.Context_[float]) → numpy.ndarray[numpy.float64[m, 1], flags.writeable]¶ See GetMutableVelocities() method above.
-
GetPositionLowerLimits
(self: pydrake.multibody.plant.MultibodyPlant_[float]) → numpy.ndarray[numpy.float64[m, 1]]¶ Returns a vector of size
num_positions()
containing the lower position limits for every generalized position coordinate. These include joint and free body coordinates. Any unbounded or unspecified limits will be -infinity.Raises: RuntimeError if called pre-finalize.
-
GetPositions
(*args, **kwargs)¶ Overloaded function.
- GetPositions(self: pydrake.multibody.plant.MultibodyPlant_[float], context: pydrake.systems.framework.Context_[float]) -> numpy.ndarray[numpy.float64[m, 1]]
Returns a const vector reference containing the vector of generalized positions.
Note
This method returns a reference to existing data, exhibits constant i.e., O(1) time complexity, and runs very quickly.
Raises: - RuntimeError if the
context
does not correspond to the context - for a multibody model.
- GetPositions(self: pydrake.multibody.plant.MultibodyPlant_[float], context: pydrake.systems.framework.Context_[float], model_instance: pydrake.multibody.tree.ModelInstanceIndex) -> numpy.ndarray[numpy.float64[m, 1]]
Returns an vector containing the generalized positions (
q
) for the given model instance.Raises: - RuntimeError if the
context
does not correspond to the context - for a multibody model.
Note
returns a dense vector of dimension
q.size()
associated withmodel_instance
in O(q.size()
) time.- GetPositions(self: pydrake.multibody.plant.MultibodyPlant_[float], context: pydrake.systems.framework.Context_[float]) -> numpy.ndarray[numpy.float64[m, 1]]
Returns a const vector reference containing the vector of generalized positions.
Note
This method returns a reference to existing data, exhibits constant i.e., O(1) time complexity, and runs very quickly.
Raises: - RuntimeError if the
context
does not correspond to the context - for a multibody model.
- GetPositions(self: pydrake.multibody.plant.MultibodyPlant_[float], context: pydrake.systems.framework.Context_[float], model_instance: pydrake.multibody.tree.ModelInstanceIndex) -> numpy.ndarray[numpy.float64[m, 1]]
Returns an vector containing the generalized positions (
q
) for the given model instance.Raises: - RuntimeError if the
context
does not correspond to the context - for a multibody model.
Note
returns a dense vector of dimension
q.size()
associated withmodel_instance
in O(q.size()
) time.
-
GetPositionsAndVelocities
(*args, **kwargs)¶ Overloaded function.
- GetPositionsAndVelocities(self: pydrake.multibody.plant.MultibodyPlant_[float], context: pydrake.systems.framework.Context_[float]) -> numpy.ndarray[numpy.float64[m, 1]]
Returns a const vector reference containing the vector
[q; v]
withq
the vector of generalized positions andv
the vector of generalized velocities.Note
This method returns a reference to existing data, exhibits constant i.e., O(1) time complexity, and runs very quickly.
Raises: - RuntimeError if the
context
does not correspond to the context - for a multibody model.
- GetPositionsAndVelocities(self: pydrake.multibody.plant.MultibodyPlant_[float], context: pydrake.systems.framework.Context_[float], model_instance: pydrake.multibody.tree.ModelInstanceIndex) -> numpy.ndarray[numpy.float64[m, 1]]
Returns the vector
[q; v]
of the model withq
the vector of generalized positions andv
the vector of generalized velocities for model instancemodel_instance
.Raises: - RuntimeError if the
context
does not correspond to the context - for a multibody model or
model_instance
is invalid.
Note
returns a dense vector of dimension
q.size() + v.size()
associated withmodel_instance
in O(q.size()
) time.
-
GetPositionsFromArray
(self: pydrake.multibody.plant.MultibodyPlant_[float], model_instance: pydrake.multibody.tree.ModelInstanceIndex, q: numpy.ndarray[numpy.float64[m, 1]]) → numpy.ndarray[numpy.float64[m, 1]]¶ Returns a vector of generalized positions for
model_instance
from a vectorq_array
of generalized positions for the entire model model. This method throws an exception ifq
is not of size MultibodyPlant::num_positions().
-
GetPositionUpperLimits
(self: pydrake.multibody.plant.MultibodyPlant_[float]) → numpy.ndarray[numpy.float64[m, 1]]¶ Upper limit analog of GetPositionsLowerLimits(), where any unbounded or unspecified limits will be +infinity.
See also
GetPositionLowerLimits() for more information.
-
GetTopologyGraphvizString
(self: pydrake.multibody.plant.MultibodyPlant_[float]) → str¶ Returns a Graphviz string describing the topology of this plant. To render the string, use the Graphviz tool,
dot
. http://www.graphviz.org/Note: this method can be called either before or after
Finalize()
.
-
GetVelocities
(*args, **kwargs)¶ Overloaded function.
- GetVelocities(self: pydrake.multibody.plant.MultibodyPlant_[float], context: pydrake.systems.framework.Context_[float]) -> numpy.ndarray[numpy.float64[m, 1]]
Returns a const vector reference containing the generalized velocities.
Note
This method returns a reference to existing data, exhibits constant i.e., O(1) time complexity, and runs very quickly.
- GetVelocities(self: pydrake.multibody.plant.MultibodyPlant_[float], context: pydrake.systems.framework.Context_[float], model_instance: pydrake.multibody.tree.ModelInstanceIndex) -> numpy.ndarray[numpy.float64[m, 1]]
Returns a vector containing the generalized velocities (
v
) for the given model instance.Raises: - RuntimeError if the
context
does not correspond to the context - for a multibody model.
Note
returns a dense vector of dimension
v.size()
associated withmodel_instance
in O(v.size()
) time.- GetVelocities(self: pydrake.multibody.plant.MultibodyPlant_[float], context: pydrake.systems.framework.Context_[float]) -> numpy.ndarray[numpy.float64[m, 1]]
Returns a const vector reference containing the generalized velocities.
Note
This method returns a reference to existing data, exhibits constant i.e., O(1) time complexity, and runs very quickly.
- GetVelocities(self: pydrake.multibody.plant.MultibodyPlant_[float], context: pydrake.systems.framework.Context_[float], model_instance: pydrake.multibody.tree.ModelInstanceIndex) -> numpy.ndarray[numpy.float64[m, 1]]
Returns a vector containing the generalized velocities (
v
) for the given model instance.Raises: - RuntimeError if the
context
does not correspond to the context - for a multibody model.
Note
returns a dense vector of dimension
v.size()
associated withmodel_instance
in O(v.size()
) time.
-
GetVelocitiesFromArray
(self: pydrake.multibody.plant.MultibodyPlant_[float], model_instance: pydrake.multibody.tree.ModelInstanceIndex, v: numpy.ndarray[numpy.float64[m, 1]]) → numpy.ndarray[numpy.float64[m, 1]]¶ Returns a vector of generalized velocities for
model_instance
from a vectorv
of generalized velocities for the entire MultibodyPlant model. This method throws an exception if the input array is not of size MultibodyPlant::num_velocities().
-
GetVelocityLowerLimits
(self: pydrake.multibody.plant.MultibodyPlant_[float]) → numpy.ndarray[numpy.float64[m, 1]]¶ Returns a vector of size
num_velocities()
containing the lower velocity limits for every generalized velocity coordinate. These include joint and free body coordinates. Any unbounded or unspecified limits will be -infinity.Raises: RuntimeError if called pre-finalize.
-
GetVelocityUpperLimits
(self: pydrake.multibody.plant.MultibodyPlant_[float]) → numpy.ndarray[numpy.float64[m, 1]]¶ Upper limit analog of GetVelocitysLowerLimits(), where any unbounded or unspecified limits will be +infinity.
See also
GetVelocityLowerLimits() for more information.
-
gravity_field
(self: pydrake.multibody.plant.MultibodyPlant_[float]) → pydrake.multibody.tree.UniformGravityFieldElement_[float]¶ An accessor to the current gravity field.
-
HasBodyNamed
(*args, **kwargs)¶ Overloaded function.
- HasBodyNamed(self: pydrake.multibody.plant.MultibodyPlant_[float], name: str) -> bool
Returns: True
if a body namedname
was added to the MultibodyPlant.See also
AddRigidBody().
Raises: RuntimeError if the body name occurs in multiple model instances. - HasBodyNamed(self: pydrake.multibody.plant.MultibodyPlant_[float], name: str, model_instance: pydrake.multibody.tree.ModelInstanceIndex) -> bool
Returns: True
if a body namedname
was added to the MultibodyPlant inmodel_instance
.See also
AddRigidBody().
Raises: RuntimeError if model_instance
is not valid for this model.
-
HasJointActuatorNamed
(*args, **kwargs)¶ Overloaded function.
- HasJointActuatorNamed(self: pydrake.multibody.plant.MultibodyPlant_[float], name: str) -> bool
Returns: True
if an actuator namedname
was added to this model.See also
AddJointActuator().
Raises: - RuntimeError if the actuator name occurs in multiple model
instances.
- HasJointActuatorNamed(self: pydrake.multibody.plant.MultibodyPlant_[float], name: str, model_instance: pydrake.multibody.tree.ModelInstanceIndex) -> bool
Returns: True
if an actuator namedname
was added tomodel_instance
.See also
AddJointActuator().
Raises: RuntimeError if model_instance
is not valid for this model.
-
HasJointNamed
(*args, **kwargs)¶ Overloaded function.
- HasJointNamed(self: pydrake.multibody.plant.MultibodyPlant_[float], name: str) -> bool
Returns: True
if a joint namedname
was added to this model.See also
AddJoint().
Raises: RuntimeError if the joint name occurs in multiple model instances. - HasJointNamed(self: pydrake.multibody.plant.MultibodyPlant_[float], name: str, model_instance: pydrake.multibody.tree.ModelInstanceIndex) -> bool
Returns: True
if a joint namedname
was added tomodel_instance
.See also
AddJoint().
Raises: RuntimeError if model_instance
is not valid for this model.
-
HasModelInstanceNamed
(self: pydrake.multibody.plant.MultibodyPlant_[float], name: str) → bool¶ Returns: True
if a model instance namedname
was added to this model.See also
AddModelInstance().
-
is_finalized
(self: pydrake.multibody.plant.MultibodyPlant_[float]) → bool¶ Returns
True
if this MultibodyPlant was finalized with a call to Finalize().See also
Finalize().
-
MakeActuationMatrix
(self: pydrake.multibody.plant.MultibodyPlant_[float]) → numpy.ndarray[numpy.float64[m, n]]¶ This method creates an actuation matrix B mapping a vector of actuation values u into generalized forces
tau_u = B * u
, where B is a matrix of sizenv x nu
withnu
equal to num_actuators() andnv
equal to num_velocities(). The vector u of actuation values is of size num_actuators(). For a given JointActuator,u[JointActuator::index()]
stores the value for the external actuation corresponding to that actuator.tau_u
on the other hand is indexed by generalized velocity indexes according toJoint::velocity_start()
.Warning
B is a permutation matrix. While making a permutation has
O(n)
complexity, making a full B matrix hasO(n²)
complexity. For most applications this cost can be neglected but it could become significant for very large systems.
-
MapQDotToVelocity
(self: pydrake.multibody.plant.MultibodyPlant_[float], context: pydrake.systems.framework.Context_[float], qdot: numpy.ndarray[numpy.float64[m, 1]]) → numpy.ndarray[numpy.float64[m, 1]]¶ Transforms the time derivative
qdot
of the generalized positions vectorq
(stored incontext
) to generalized velocitiesv
. v andq̇
are related linearly byq̇ = N(q)⋅v
. AlthoughN(q)
is not necessarily square, its left pseudo-inverseN⁺(q)
can be used to invert that relationship without residual error, provided thatqdot
is in the range space ofN(q)
(that is, if it could have been produced asq̇ = N(q)⋅v
for somev
). Using the configurationq
stored in the givencontext
this method calculatesv = N⁺(q)⋅q̇
.- Parameter
context
: - The context containing the state of the model.
- Parameter
qdot
: - A vector containing the time derivatives of the generalized
positions. This method aborts if
qdot
is not of size num_positions(). - Parameter
v
: - A valid (non-null) pointer to a vector in
ℛⁿ
with n the number of generalized velocities. This method aborts if v is nullptr or if it is not of size num_velocities().
See also
MapVelocityToQDot()
See also
Mobilizer::MapQDotToVelocity()
- Parameter
-
MapVelocityToQDot
(self: pydrake.multibody.plant.MultibodyPlant_[float], context: pydrake.systems.framework.Context_[float], v: numpy.ndarray[numpy.float64[m, 1]]) → numpy.ndarray[numpy.float64[m, 1]]¶ Transforms generalized velocities v to time derivatives
qdot
of the generalized positions vectorq
(stored incontext
). v andqdot
are related linearly byq̇ = N(q)⋅v
. Using the configurationq
stored in the givencontext
this method calculatesq̇ = N(q)⋅v
.- Parameter
context
: - The context containing the state of the model.
- Parameter
v
: - A vector of of generalized velocities for this model. This method aborts if v is not of size num_velocities().
- Parameter
qdot
: - A valid (non-null) pointer to a vector in
ℝⁿ
with n being the number of generalized positions in this model, given bynum_positions()
. This method aborts ifqdot
is nullptr or if it is not of size num_positions().
See also
MapQDotToVelocity()
See also
Mobilizer::MapVelocityToQDot()
- Parameter
-
mutable_gravity_field
(self: pydrake.multibody.plant.MultibodyPlant_[float]) → pydrake.multibody.tree.UniformGravityFieldElement_[float]¶ A mutable accessor to the current gravity field.
-
num_actuated_dofs
(*args, **kwargs)¶ Overloaded function.
- num_actuated_dofs(self: pydrake.multibody.plant.MultibodyPlant_[float]) -> int
Returns the total number of actuated degrees of freedom. That is, the vector of actuation values u has this size. See AddJointActuator().
- num_actuated_dofs(self: pydrake.multibody.plant.MultibodyPlant_[float], model_instance: pydrake.multibody.tree.ModelInstanceIndex) -> int
Returns the total number of actuated degrees of freedom for a specific model instance. That is, the vector of actuation values u has this size. See AddJointActuator().
-
num_actuators
(self: pydrake.multibody.plant.MultibodyPlant_[float]) → int¶ Returns the number of joint actuators in the model.
See also
AddJointActuator().
-
num_bodies
(self: pydrake.multibody.plant.MultibodyPlant_[float]) → int¶ Returns the number of bodies in the model, including the “world” body, which is always part of the model.
See also
AddRigidBody().
-
num_collision_geometries
(self: pydrake.multibody.plant.MultibodyPlant_[float]) → int¶ Returns the number of geometries registered for contact modeling. This method can be called at any time during the lifetime of
this
plant, either pre- or post-finalize, see Finalize(). Post-finalize calls will always return the same value.
-
num_force_elements
(self: pydrake.multibody.plant.MultibodyPlant_[float]) → int¶ Returns the number of ForceElement objects.
See also
AddForceElement().
-
num_frames
(self: pydrake.multibody.plant.MultibodyPlant_[float]) → int¶ Returns the number of Frame objects in this model. Frames include body frames associated with each of the bodies, including the world body. This means the minimum number of frames is one.
-
num_joints
(self: pydrake.multibody.plant.MultibodyPlant_[float]) → int¶ Returns the number of joints in the model.
See also
AddJoint().
-
num_model_instances
(self: pydrake.multibody.plant.MultibodyPlant_[float]) → int¶ Returns the number of model instances in the model.
See also
AddModelInstance().
-
num_multibody_states
(*args, **kwargs)¶ Overloaded function.
- num_multibody_states(self: pydrake.multibody.plant.MultibodyPlant_[float]) -> int
Returns the size of the multibody system state vector x = [q v]. This will be
num_positions()
plusnum_velocities()
.- num_multibody_states(self: pydrake.multibody.plant.MultibodyPlant_[float], model_instance: pydrake.multibody.tree.ModelInstanceIndex) -> int
Returns the size of the multibody system state vector xᵢ = [qᵢ vᵢ] for model instance i. (Here qᵢ ⊆ q and vᵢ ⊆ v.) will be
num_positions(model_instance)
plusnum_velocities(model_instance)
.
-
num_positions
(*args, **kwargs)¶ Overloaded function.
- num_positions(self: pydrake.multibody.plant.MultibodyPlant_[float]) -> int
Returns the size of the generalized position vector q for this model.
- num_positions(self: pydrake.multibody.plant.MultibodyPlant_[float], model_instance: pydrake.multibody.tree.ModelInstanceIndex) -> int
Returns the size of the generalized position vector qᵢ for model instance i.
-
num_velocities
(*args, **kwargs)¶ Overloaded function.
- num_velocities(self: pydrake.multibody.plant.MultibodyPlant_[float]) -> int
Returns the size of the generalized velocity vector v for this model.
- num_velocities(self: pydrake.multibody.plant.MultibodyPlant_[float], model_instance: pydrake.multibody.tree.ModelInstanceIndex) -> int
Returns the size of the generalized velocity vector vᵢ for model instance i.
-
RegisterAsSourceForSceneGraph
(self: pydrake.multibody.plant.MultibodyPlant_[float], scene_graph: pydrake.geometry.SceneGraph_[float]) → pydrake.geometry.SourceId¶ Registers
this
plant to serve as a source for an instance of SceneGraph. This registration allows MultibodyPlant to register geometry withscene_graph
for visualization and/or collision queries. Successive registration calls with SceneGraph must be performed on the same instance to which the pointer argumentscene_graph
points to. Failure to do so will result in runtime exceptions.- Parameter
scene_graph
: - A valid non nullptr to the SceneGraph instance for which
this
plant will sever as a source, see SceneGraph documentation for further details.
Returns: the SourceId of this
plant inscene_graph
. It can also later on be retrieved with get_source_id().Raises: RuntimeError if called post-finalize. Raises: RuntimeError if scene_graph
is the nullptr.Raises: RuntimeError if called more than once. - Parameter
-
RegisterCollisionGeometry
(*args, **kwargs)¶ Overloaded function.
- RegisterCollisionGeometry(self: pydrake.multibody.plant.MultibodyPlant_[float], body: pydrake.multibody.tree.Body_[float], X_BG: pydrake.math.RigidTransform_[float], shape: pydrake.geometry.Shape, name: str, properties: pydrake.geometry.ProximityProperties) -> pydrake.geometry.GeometryId
Registers geometry in a SceneGraph with a given geometry::Shape to be used for the contact modeling of a given
body
. More than one geometry can be registered with a body, in which case the body’s contact geometry is the union of all geometries registered to that body.- Parameter
body
: - The body for which geometry is being registered.
- Parameter
X_BG
: - The fixed pose of the geometry frame G in the body frame B.
- Parameter
shape
: - The geometry::Shape used for visualization. E.g.: geometry::Sphere, geometry::Cylinder, etc.
- Parameter
properties
: - The proximity properties associated with the collision geometry.
They must include the (
material
, coulomb_friction) property of type CoulombFriction<double>.
Raises: - RuntimeError if called post-finalize or if the properties are
- missing the coulomb friction property (or if it is of the wrong
type).
- RegisterCollisionGeometry(self: pydrake.multibody.plant.MultibodyPlant_[float], body: pydrake.multibody.tree.Body_[float], X_BG: pydrake.math.RigidTransform_[float], shape: pydrake.geometry.Shape, name: str, coulomb_friction: pydrake.multibody.plant.CoulombFriction_[float]) -> pydrake.geometry.GeometryId
Overload which specifies a single property: coulomb_friction.
-
RegisterVisualGeometry
(*args, **kwargs)¶ Overloaded function.
- RegisterVisualGeometry(self: pydrake.multibody.plant.MultibodyPlant_[float], body: pydrake.multibody.tree.Body_[float], X_BG: pydrake.math.RigidTransform_[float], shape: pydrake.geometry.Shape, name: str, diffuse_color: numpy.ndarray[numpy.float64[4, 1]]) -> pydrake.geometry.GeometryId
Overload for visual geometry registration; it converts the
diffuse_color
(RGBA with values in the range [0, 1]) into a geometry::ConnectDrakeVisualizer()-compatible set of geometry::IllustrationProperties.- RegisterVisualGeometry(self: pydrake.multibody.plant.MultibodyPlant_[float], body: pydrake.multibody.tree.Body_[float], X_BG: pydrake.common.eigen_geometry.Isometry3_[float], shape: pydrake.geometry.Shape, name: str, diffuse_color: numpy.ndarray[numpy.float64[4, 1]], scene_graph: pydrake.geometry.SceneGraph_[float] = None) -> pydrake.geometry.GeometryId
This API using Isometry3 is / will be deprecated soon with the resolution of #9865. We only offer it for backwards compatibility. DO NOT USE!.
-
set_penetration_allowance
(self: pydrake.multibody.plant.MultibodyPlant_[float], penetration_allowance: float = 0.001) → None¶ Sets the penetration allowance used to estimate the coefficients in the penalty method used to impose non-penetration among bodies. Refer to the section mbp_penalty_method “Contact by penalty method” for further details.
Raises: RuntimeError if penetration_allowance is not positive.
-
set_stiction_tolerance
(self: pydrake.multibody.plant.MultibodyPlant_[float], v_stiction: float = 0.001) → None¶ **** Stribeck model of friction
Currently MultibodyPlant uses the Stribeck approximation to model dry friction. The Stribeck model of friction is an approximation to Coulomb’s law of friction that allows using continuous time integration without the need to specify complementarity constraints. While this results in a simpler model immediately tractable with standard numerical methods for integration of ODE’s, it often leads to stiff dynamics that require an explicit integrator to take very small time steps. It is therefore recommended to use error controlled integrators when using this model or the discrete time stepping (see time_advancement_strategy “Choice of Time Advancement Strategy”). See stribeck_approximation for a detailed discussion of the Stribeck model.
Sets the stiction tolerance
v_stiction
for the Stribeck model, wherev_stiction
must be specified in m/s (meters per second.)v_stiction
defaults to a value of 1 millimeter per second. In selecting a value forv_stiction
, you must ask yourself the question, “When two objects are ostensibly in stiction, how much slip am I willing to allow?” There are two opposing design issues in picking a value for vₛ. On the one hand, small values of vₛ make the problem numerically stiff during stiction, potentially increasing the integration cost. On the other hand, it should be picked to be appropriate for the scale of the problem. For example, a car simulation could allow a “large” value for vₛ of 1 cm/s (1×10⁻² m/s), but reasonable stiction for grasping a 10 cm box might require limiting residual slip to 1×10⁻³ m/s or less. Ultimately, picking the largest viable value will allow your simulation to run faster and more robustly. Note thatv_stiction
is the slip velocity that we’d have when we are at edge of the friction cone. For cases when the friction force is well within the friction cone the slip velocity will always be smaller than this value. See also stribeck_approximation.Raises: RuntimeError if v_stiction
is non-positive.
-
SetActuationInArray
(self: pydrake.multibody.plant.MultibodyPlant_[float], model_instance: pydrake.multibody.tree.ModelInstanceIndex, u_instance: numpy.ndarray[numpy.float64[m, 1]], u: numpy.ndarray[numpy.float64[m, 1], flags.writeable]) → None¶ Given the actuation values
u_instance
for all actuators inmodel_instance
, this method sets the actuation vector u for the entire model to which this actuator belongs to. This method throws an exception if the size ofu_instance
is not equal to the number of degrees of freedom of all of the actuated joints inmodel_instance
.- Parameter
u_instance
: - Actuation values for the actuators. It must be of size equal to
the number of degrees of freedom of all of the actuated joints in
model_instance
. - Parameter
u
: - The vector containing the actuation values for the entire model.
- Parameter
-
SetDefaultFreeBodyPose
(self: pydrake.multibody.plant.MultibodyPlant_[float], body: pydrake.multibody.tree.Body_[float], X_WB: pydrake.math.RigidTransform_[float]) → None¶ Sets the default pose of
body
. Ifbody.is_floating()
is true, this will affect subsequent calls to SetDefaultState(); otherwise, this value is effectively ignored.- Parameter
body
: - Body whose default pose will be set.
- Parameter
X_WB
: - Default pose of the body.
- Parameter
-
SetDefaultState
(self: pydrake.multibody.plant.MultibodyPlant_[float], context: pydrake.systems.framework.Context_[float], state: pydrake.systems.framework.State_[float]) → None¶ Sets
state
according to defaults set by the user for joints (e.g. RevoluteJoint::set_default_angle()) and free bodies (SetDefaultFreeBodyPose()). If the user does not specify defaults, the state corresponds to zero generalized positions and velocities.Raises: RuntimeError if called pre-finalize. See Finalize().
-
SetFreeBodyPose
(*args, **kwargs)¶ Overloaded function.
- SetFreeBodyPose(self: pydrake.multibody.plant.MultibodyPlant_[float], context: pydrake.systems.framework.Context_[float], body: pydrake.multibody.tree.Body_[float], X_WB: pydrake.math.RigidTransform_[float]) -> None
Sets
context
to store the poseX_WB
of a givenbody
B in the world frame W.Note
In general setting the pose and/or velocity of a body in the model would involve a complex inverse kinematics problem. This method allows us to simplify this process when we know the body is free in space.
Raises: RuntimeError if body
is not a free body in the model.Raises: RuntimeError if called pre-finalize. - SetFreeBodyPose(self: pydrake.multibody.plant.MultibodyPlant_[float], context: pydrake.systems.framework.Context_[float], body: pydrake.multibody.tree.Body_[float], X_WB: pydrake.common.eigen_geometry.Isometry3_[float]) -> None
This API using Isometry3 is / will be deprecated soon with the resolution of #9865. We only offer it for backwards compatibility. DO NOT USE!.
-
SetFreeBodySpatialVelocity
(self: pydrake.multibody.plant.MultibodyPlant_[float], body: pydrake.multibody.tree.Body_[float], V_WB: pydrake.multibody.math.SpatialVelocity_[float], context: pydrake.systems.framework.Context_[float]) → None¶ Sets
context
to store the spatial velocityV_WB
of a givenbody
B in the world frame W.Note