'Is there a way to detect if two bodies/frames are fixed in Drake?
Does anybody know of an easy way to determine if two bodies (or frames) are fixed with respect to one another in Pydrake? Thank you!
Solution 1:[1]
There is the GetBodiesWeldedTo() method on MultibodyPlant.
Python doc is here. Given some reference body, it will return a list of all the bodies connected to it by one or more weld joints.
If you are looking at welds for collision filtering purposes, note that Drake release 1.2.0 and later will ignore collisions within all welded groups of bodies by default.
Solution 2:[2]
Along Rico's post, this is what we use in Anzu (TRI codebase) which uses GetBodiesWeldedTo - nothing crazy, and Python looks about the same.
bool AreFramesWelded(
const MultibodyPlant<double>& plant,
const Frame<double>& A, const Frame<double>& B) {
if (&A.body() == &B.body())
return true;
for (const auto* body : plant.GetBodiesWeldedTo(A.body())) {
if (body == &B.body())
return true;
}
return false;
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | rpoyner-tri |
| Solution 2 | Eric Cousineau |
