RobotLocomotion / drake

Model-based design and verification for robotics.
https://drake.mit.edu
Other
3.33k stars 1.26k forks source link

MultibodyPlant needs a function for getting the total mass of a plant (or model_instance). #14913

Closed RussTedrake closed 3 years ago

RussTedrake commented 3 years ago

I spent a few minutes looking for it... but couldn't find it. The documentation references composite_mass as a concept, but I think it only appears insider the center of mass methods: https://github.com/RobotLocomotion/drake/blob/0ac940e5f37d67a88f5fe19d1fb111f2f92d2197/multibody/tree/multibody_tree.cc#L1305

Of course it's not hard to implement myself... but my goodness this seems like one that we should offer.

sherm1 commented 3 years ago

@mitiguy I think this one is for you!

mitiguy commented 3 years ago

Proposed API for this method -- which is based on API for MultibodyPlant::CalcCenterOfMassPositionInWorld().

T CalcTotalMass(const systems::Context<T>& context) const;
T CalcTotalMass(const systems::Context<T>& context, const std::vector<ModelInstanceIndex>& model_instances) const;
mitiguy commented 3 years ago

PR #14957 addresses this issue #14913.

mitiguy commented 3 years ago

Resolved by PR #14957 FYI @RussTedrake