Skip to content

Commit 8c9621c

Browse files
committed
Add option to build composites and compute kinematics
Modifies FrameBodyPoseCache, position kinematics cache, and velocity kinematics cache. Loosens two tolerances so that Mac CI passes. Rebased on body->link terminology change. Rebased on J^T F operator branch Working on acceleration kinematics. Working on force elements
1 parent 5d29def commit 8c9621c

37 files changed

Lines changed: 1835 additions & 530 deletions

bindings/generated_docstrings/multibody_plant.h

Lines changed: 103 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3744,7 +3744,7 @@ method computes:
37443744
where ``M(q)`` is the model's mass matrix (including rigid body mass
37453745
properties and reflected_inertia "reflected inertias"), ``C(q, v)v``
37463746
is the bias term for Coriolis and gyroscopic effects and ``tau_app``
3747-
consists of a vector applied generalized forces. The last term is a
3747+
consists of a vector of applied generalized forces. The last term is a
37483748
summation over all bodies in the model where ``Fapp_Bo_W`` is an
37493749
applied spatial force on body B at ``Bo`` which gets projected into
37503750
the space of generalized forces with the transpose of ``Jv_V_WB(q)``
@@ -4620,6 +4620,67 @@ Returns ``L_WSP_W``:
46204620
RuntimeError if model_instances contains an invalid
46214621
ModelInstanceIndex.)""";
46224622
} CalcSpatialMomentumInWorldAboutPoint;
4623+
// Symbol: drake::multibody::MultibodyPlant::CalcSystemJacobianTransposeTimesF
4624+
struct /* CalcSystemJacobianTransposeTimesF */ {
4625+
// Source: drake/multibody/plant/multibody_plant.h
4626+
const char* doc =
4627+
R"""((Advanced) Computes τ = Jᵀ⋅F, the transpose-times-vector product of
4628+
the System Jacobian against a per-mobilizd body spatial force, in O(n)
4629+
time without forming J.
4630+
4631+
Here J is the System Jacobian — the block-row-stacked Jacobian
4632+
Jv_V_WB_W whose B-th block is ``∂V_WB_W/∂v``, the Jacobian of
4633+
mobilized body B's spatial velocity in World (at Bo, expressed in W)
4634+
with respect to the generalized velocities v. See
4635+
EvalBlockSystemJacobian() for the matrix-form companion.
4636+
4637+
Given applied spatial forces ``F_Bo_W_array[k]`` for each mobilized
4638+
body k (about its body origin Bo, expressed in World), this method
4639+
returns
4640+
4641+
4642+
.. raw:: html
4643+
4644+
<details><summary>Click to expand C++ code...</summary>
4645+
4646+
.. code-block:: c++
4647+
4648+
τ = ∑ₖ J_WBₖᵀ ⋅ F_Boₖ_W (1)
4649+
4650+
.. raw:: html
4651+
4652+
</details>
4653+
4654+
the generalized forces equivalent to the applied spatial forces.
4655+
4656+
Warning:
4657+
The input array ``F_Bo_W_array`` is destroyed during the
4658+
computation. Callers that need to preserve their input should pass
4659+
a copy.
4660+
4661+
Parameter ``context``:
4662+
The state of the multibody system.
4663+
4664+
Parameter ``F_Bo_W_array``:
4665+
Per-mobilized-body applied spatial forces, sized
4666+
graph().forest().num_mobods(), ordered by MobodIndex (entry 0
4667+
corresponds to World; it is read but has no effect on τ). **This
4668+
array is destroyed during the computation**: the operator sweeps
4669+
tip-to-base, shifting each body's accumulated force into its
4670+
parent's entry of ``F_Bo_W_array`` in place to avoid allocating a
4671+
scratch copy.
4672+
4673+
Parameter ``tau``:
4674+
On exit, sized num_velocities(), the generalized force equivalent
4675+
to the applied spatial forces.
4676+
4677+
Raises:
4678+
RuntimeError if ``F_Bo_W_array`` or ``tau`` is nullptr or the
4679+
wrong size.
4680+
4681+
See also:
4682+
EvalBlockSystemJacobian(), CalcJacobianSpatialVelocity())""";
4683+
} CalcSystemJacobianTransposeTimesF;
46234684
// Symbol: drake::multibody::MultibodyPlant::CalcTotalMass
46244685
struct /* CalcTotalMass */ {
46254686
// Source: drake/multibody/plant/multibody_plant.h
@@ -4942,7 +5003,7 @@ be used by Finalize(); post-finalize it returns the joint type that
49425003
*was* used if there were any base bodies in need of a joint.
49435004
49445005
See also:
4945-
SetBaseBodyJointType(), Finalize())""";
5006+
SetBaseBodyJointType(), GetCombineWeldedBodies(), Finalize())""";
49465007
} GetBaseBodyJointType;
49475008
// Symbol: drake::multibody::MultibodyPlant::GetBodiesKinematicallyAffectedBy
49485009
struct /* GetBodiesKinematicallyAffectedBy */ {
@@ -5099,6 +5160,23 @@ geometries for ``body`` previously registered with a SceneGraph.
50995160
See also:
51005161
RegisterCollisionGeometry(), Finalize())""";
51015162
} GetCollisionGeometriesForBody;
5163+
// Symbol: drake::multibody::MultibodyPlant::GetCombineWeldedBodies
5164+
struct /* GetCombineWeldedBodies */ {
5165+
// Source: drake/multibody/plant/multibody_plant.h
5166+
const char* doc =
5167+
R"""(Returns the currently-set choice for whether welded-together bodies
5168+
should be combined or modeled separately, either for the global
5169+
setting or for a specific model instance. If a model instance is
5170+
provided for which no explicit choice was made, the global setting is
5171+
returned. Any model instance index is acceptable here; if not
5172+
recognized then the global setting is returned. This can be called any
5173+
time -- pre-finalize it returns the setting that will be used by
5174+
Finalize(); post-finalize it returns the setting that *was* used if
5175+
there were any welded-together bodies.
5176+
5177+
See also:
5178+
SetCombineWeldedBodies(), GetBaseBodyJointType(), Finalize())""";
5179+
} GetCombineWeldedBodies;
51025180
// Symbol: drake::multibody::MultibodyPlant::GetConstraintActiveStatus
51035181
struct /* GetConstraintActiveStatus */ {
51045182
// Source: drake/multibody/plant/multibody_plant.h
@@ -6602,8 +6680,30 @@ Parameter ``model_instance``:
66026680
RuntimeError if called after Finalize().
66036681
66046682
See also:
6605-
GetBaseBodyJointType(), Finalize())""";
6683+
GetBaseBodyJointType(), SetCombineWeldedBodies(), Finalize())""";
66066684
} SetBaseBodyJointType;
6685+
// Symbol: drake::multibody::MultibodyPlant::SetCombineWeldedBodies
6686+
struct /* SetCombineWeldedBodies */ {
6687+
// Source: drake/multibody/plant/multibody_plant.h
6688+
const char* doc =
6689+
R"""(Controls whether welded-together RigidBody elements are to be combined
6690+
into a single composite mobilized body in the generated model. If so,
6691+
the Weld joints will not appear in the post-Finalize() model and there
6692+
will be fewer bodies and joints in the generated model than in the
6693+
user's specification. Results for the original RigidBody elements can
6694+
still be obtained by name or BodyIndex, but no results (in particular,
6695+
no reaction forces) are available for the unmodeled Weld joints.
6696+
6697+
You can set this globally or on a per-model instance basis.
6698+
6699+
The default for Drake is *not* to combine welded RigidBody elements.
6700+
6701+
Raises:
6702+
RuntimeError if called after Finalize().
6703+
6704+
See also:
6705+
GetCombineWeldedBodies(), SetBaseBodyJointType(), Finalize())""";
6706+
} SetCombineWeldedBodies;
66076707
// Symbol: drake::multibody::MultibodyPlant::SetConstraintActiveStatus
66086708
struct /* SetConstraintActiveStatus */ {
66096709
// Source: drake/multibody/plant/multibody_plant.h

0 commit comments

Comments
 (0)