Skip to content

Commit 53aa3b2

Browse files
committed
Name changes in support of composites to come
1 parent f77eebe commit 53aa3b2

86 files changed

Lines changed: 1866 additions & 1553 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

bindings/generated_docstrings/multibody_math.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1005,6 +1005,13 @@ Parameter ``translational_tolerance``:
10051005
elements of ``this`` and ``other`` are equal within
10061006
translational_tolerance.)""";
10071007
} IsNearlyEqualWithinAbsoluteTolerance;
1008+
// Symbol: drake::multibody::SpatialVector::NaN
1009+
struct /* NaN */ {
1010+
// Source: drake/multibody/math/spatial_vector.h
1011+
const char* doc =
1012+
R"""(Factory to create a *NaN* spatial vector, i.e., a SpatialVector whose
1013+
rotational and translational components are all NaN.)""";
1014+
} NaN;
10081015
// Symbol: drake::multibody::SpatialVector::SetNaN
10091016
struct /* SetNaN */ {
10101017
// Source: drake/multibody/math/spatial_vector.h

bindings/generated_docstrings/multibody_plant.h

Lines changed: 5 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -186,32 +186,6 @@ This method must be called pre-Finalize.
186186
Raises:
187187
RuntimeError if ``plant`` is finalized or if time_step is changed.)""";
188188
} ApplyMultibodyPlantConfig;
189-
// Symbol: drake::multibody::BaseBodyJointType
190-
struct /* BaseBodyJointType */ {
191-
// Source: drake/multibody/plant/multibody_plant.h
192-
const char* doc =
193-
R"""(The kind of joint to be used to connect base bodies to world at
194-
Finalize(). See mbp_working_with_free_bodies "Working with free
195-
bodies" for definitions and discussion.
196-
197-
See also:
198-
SetBaseBodyJointType() for details.)""";
199-
// Symbol: drake::multibody::BaseBodyJointType::kQuaternionFloatingJoint
200-
struct /* kQuaternionFloatingJoint */ {
201-
// Source: drake/multibody/plant/multibody_plant.h
202-
const char* doc = R"""(6 dofs, unrestricted orientation.)""";
203-
} kQuaternionFloatingJoint;
204-
// Symbol: drake::multibody::BaseBodyJointType::kRpyFloatingJoint
205-
struct /* kRpyFloatingJoint */ {
206-
// Source: drake/multibody/plant/multibody_plant.h
207-
const char* doc = R"""(6 dofs using 3 angles; has singularity.)""";
208-
} kRpyFloatingJoint;
209-
// Symbol: drake::multibody::BaseBodyJointType::kWeldJoint
210-
struct /* kWeldJoint */ {
211-
// Source: drake/multibody/plant/multibody_plant.h
212-
const char* doc = R"""(0 dofs, fixed to World.)""";
213-
} kWeldJoint;
214-
} BaseBodyJointType;
215189
// Symbol: drake::multibody::CalcContactFrictionFromSurfaceProperties
216190
struct /* CalcContactFrictionFromSurfaceProperties */ {
217191
// Source: drake/multibody/plant/coulomb_friction.h
@@ -4968,7 +4942,7 @@ be used by Finalize(); post-finalize it returns the joint type that
49684942
*was* used if there were any base bodies in need of a joint.
49694943
49704944
See also:
4971-
SetBaseBodyJointType())""";
4945+
SetBaseBodyJointType(), Finalize())""";
49724946
} GetBaseBodyJointType;
49734947
// Symbol: drake::multibody::MultibodyPlant::GetBodiesKinematicallyAffectedBy
49744948
struct /* GetBodiesKinematicallyAffectedBy */ {
@@ -6625,7 +6599,10 @@ Parameter ``model_instance``:
66256599
is to be applied.
66266600
66276601
Raises:
6628-
RuntimeError if called after Finalize().)""";
6602+
RuntimeError if called after Finalize().
6603+
6604+
See also:
6605+
GetBaseBodyJointType(), Finalize())""";
66296606
} SetBaseBodyJointType;
66306607
// Symbol: drake::multibody::MultibodyPlant::SetConstraintActiveStatus
66316608
struct /* SetConstraintActiveStatus */ {

bindings/generated_docstrings/multibody_tree.h

Lines changed: 181 additions & 125 deletions
Large diffs are not rendered by default.

bindings/pydrake/multibody/plant_py.cc

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1775,17 +1775,6 @@ PYBIND11_MODULE(plant, m) {
17751775
.value("kLagged", Class::kLagged, cls_doc.kLagged.doc);
17761776
}
17771777

1778-
{
1779-
using Class = BaseBodyJointType;
1780-
constexpr auto& cls_doc = doc.BaseBodyJointType;
1781-
py::enum_<Class> cls(m, "BaseBodyJointType", cls_doc.doc);
1782-
cls.value("kQuaternionFloatingJoint", Class::kQuaternionFloatingJoint,
1783-
cls_doc.kQuaternionFloatingJoint.doc)
1784-
.value("kRpyFloatingJoint", Class::kRpyFloatingJoint,
1785-
cls_doc.kRpyFloatingJoint.doc)
1786-
.value("kWeldJoint", Class::kWeldJoint, cls_doc.kWeldJoint.doc);
1787-
}
1788-
17891778
{
17901779
using Class = MultibodyPlantConfig;
17911780
constexpr auto& cls_doc = doc.MultibodyPlantConfig;

bindings/pydrake/multibody/test/plant_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@
5959
AddMultibodyPlant,
6060
AddMultibodyPlantSceneGraph,
6161
ApplyMultibodyPlantConfig,
62-
BaseBodyJointType,
6362
CalcContactFrictionFromSurfaceProperties,
6463
ConnectContactResultsToDrakeVisualizer,
6564
ContactModel,
@@ -81,6 +80,7 @@
8180
)
8281
from pydrake.multibody.tree import (
8382
BallRpyJoint_,
83+
BaseBodyJointType,
8484
Body_, # dispreferred alias for RigidBody_
8585
BodyIndex,
8686
CalcSpatialInertia,

bindings/pydrake/multibody/tree_py.cc

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,17 @@ void DoScalarIndependentDefinitions(py::module m) {
148148
.value("kV", Enum::kV, enum_doc.kV.doc);
149149
}
150150

151+
{
152+
using Enum = BaseBodyJointType;
153+
constexpr auto& cls_doc = doc.BaseBodyJointType;
154+
py::enum_<Enum> cls(m, "BaseBodyJointType", cls_doc.doc);
155+
cls.value("kQuaternionFloatingJoint", Enum::kQuaternionFloatingJoint,
156+
cls_doc.kQuaternionFloatingJoint.doc)
157+
.value("kRpyFloatingJoint", Enum::kRpyFloatingJoint,
158+
cls_doc.kRpyFloatingJoint.doc)
159+
.value("kWeldJoint", Enum::kWeldJoint, cls_doc.kWeldJoint.doc);
160+
}
161+
151162
{
152163
using Class = ScopedName;
153164
constexpr auto& cls_doc = doc.ScopedName;

multibody/benchmarks/kuka_iiwa_robot/drake_kuka_iiwa_robot.h

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -85,16 +85,16 @@ class DrakeKukaIIwaRobot {
8585
MakeKukaIiwaModel<T>(false /* finalized model */,
8686
gravity /* acceleration of gravity */));
8787

88-
linkN_ = &tree().world_body();
88+
linkN_ = &tree().world_link();
8989

9090
// Get this robot's seven links.
91-
linkA_ = &tree().GetRigidBodyByName("iiwa_link_1");
92-
linkB_ = &tree().GetRigidBodyByName("iiwa_link_2");
93-
linkC_ = &tree().GetRigidBodyByName("iiwa_link_3");
94-
linkD_ = &tree().GetRigidBodyByName("iiwa_link_4");
95-
linkE_ = &tree().GetRigidBodyByName("iiwa_link_5");
96-
linkF_ = &tree().GetRigidBodyByName("iiwa_link_6");
97-
linkG_ = &tree().GetRigidBodyByName("iiwa_link_7");
91+
linkA_ = &tree().GetLinkByName("iiwa_link_1");
92+
linkB_ = &tree().GetLinkByName("iiwa_link_2");
93+
linkC_ = &tree().GetLinkByName("iiwa_link_3");
94+
linkD_ = &tree().GetLinkByName("iiwa_link_4");
95+
linkE_ = &tree().GetLinkByName("iiwa_link_5");
96+
linkF_ = &tree().GetLinkByName("iiwa_link_6");
97+
linkG_ = &tree().GetLinkByName("iiwa_link_7");
9898

9999
// Get this robot's seven joints.
100100
NA_joint_ = &tree().template GetJointByName<RevoluteJoint>("iiwa_joint_1");
@@ -111,7 +111,7 @@ class DrakeKukaIIwaRobot {
111111

112112
/// This method gets the number of rigid bodies in this robot.
113113
/// @returns the number of rigid bodies in this robot.
114-
int get_number_of_rigid_bodies() const { return tree().num_bodies(); }
114+
int get_number_of_rigid_bodies() const { return tree().num_links(); }
115115

116116
/// This method calculates kinematic properties of the end-effector (herein
117117
/// denoted as rigid body G) of a 7-DOF KUKA LBR iiwa robot (14 kg payload).
@@ -145,7 +145,7 @@ class DrakeKukaIIwaRobot {
145145
const SpatialVelocity<T>& V_NG_N = vc.get_V_WB(linkG_->mobod_index());
146146

147147
// Retrieve end-effector spatial acceleration from acceleration cache.
148-
std::vector<SpatialAcceleration<T>> A_WB(tree().num_bodies());
148+
std::vector<SpatialAcceleration<T>> A_WB(tree().num_links());
149149
// TODO(eric.cousineau): For this model, the end effector's BodyIndex
150150
// matches its MobodIndex, thus we're not really checking the difference
151151
// between MultibodyPlant and MultibodyTree's ordering.

multibody/benchmarks/kuka_iiwa_robot/make_kuka_iiwa_model.cc

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -75,13 +75,13 @@ KukaIiwaModelBuilder<T>::Build() const {
7575
I_GGcm_G_);
7676

7777
// Add this robot's seven links.
78-
const RigidBody<T>& linkA = model->AddRigidBody("iiwa_link_1", M_AAo_A);
79-
const RigidBody<T>& linkB = model->AddRigidBody("iiwa_link_2", M_BBo_B);
80-
const RigidBody<T>& linkC = model->AddRigidBody("iiwa_link_3", M_CCo_C);
81-
const RigidBody<T>& linkD = model->AddRigidBody("iiwa_link_4", M_DDo_D);
82-
const RigidBody<T>& linkE = model->AddRigidBody("iiwa_link_5", M_EEo_E);
83-
const RigidBody<T>& linkF = model->AddRigidBody("iiwa_link_6", M_FFo_F);
84-
const RigidBody<T>& linkG = model->AddRigidBody("iiwa_link_7", M_GGo_G);
78+
const Link<T>& linkA = model->AddLink("iiwa_link_1", M_AAo_A);
79+
const Link<T>& linkB = model->AddLink("iiwa_link_2", M_BBo_B);
80+
const Link<T>& linkC = model->AddLink("iiwa_link_3", M_CCo_C);
81+
const Link<T>& linkD = model->AddLink("iiwa_link_4", M_DDo_D);
82+
const Link<T>& linkE = model->AddLink("iiwa_link_5", M_EEo_E);
83+
const Link<T>& linkF = model->AddLink("iiwa_link_6", M_FFo_F);
84+
const Link<T>& linkG = model->AddLink("iiwa_link_7", M_GGo_G);
8585

8686
// Create a revolute joint between linkN (Newtonian frame/world) and linkA
8787
// using two joint-frames, namely "Na" and "An". The "inboard frame" Na is
@@ -91,7 +91,7 @@ KukaIiwaModelBuilder<T>::Build() const {
9191
// angles and a position vector. Alternately, frame An is regarded as
9292
// coincident with linkA.
9393
const Joint<T>* joint{nullptr};
94-
const RigidBody<T>& linkN = model->world_body();
94+
const Link<T>& linkN = model->world_link();
9595
joint = &AddRevoluteJointFromSpaceXYZAnglesAndXYZ(
9696
"iiwa_joint_1", linkN, joint_1_rpy_, joint_1_xyz_, linkA,
9797
Eigen::Vector3d::UnitZ(), model.get());
@@ -109,7 +109,7 @@ KukaIiwaModelBuilder<T>::Build() const {
109109
Eigen::Vector3d::UnitZ(), model.get());
110110
model->AddJointActuator("iiwa_actuator_3", *joint);
111111

112-
// Create a revolute joint between linkB and linkC.
112+
// Create a revolute joint between linkC and linkD.
113113
joint = &AddRevoluteJointFromSpaceXYZAnglesAndXYZ(
114114
"iiwa_joint_4", linkC, joint_4_rpy_, joint_4_xyz_, linkD,
115115
Eigen::Vector3d::UnitZ(), model.get());

multibody/math/spatial_vector.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -291,6 +291,14 @@ class SpatialVector {
291291
/// rotational and translational components are both zero.
292292
static SpatialQuantity Zero() { return SpatialQuantity{}.SetZero(); }
293293

294+
/// Factory to create a _NaN_ spatial vector, i.e., a %SpatialVector whose
295+
/// rotational and translational components are all NaN.
296+
static SpatialQuantity NaN() {
297+
SpatialQuantity quantity;
298+
quantity.SetNaN();
299+
return quantity;
300+
}
301+
294302
private:
295303
// Helper method to return a mutable reference to the derived spatial
296304
// quantity.

multibody/math/test/spatial_algebra_test.cc

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,27 @@ TYPED_TEST(SpatialQuantityTest, ZeroFactory) {
110110
EXPECT_TRUE(V.translational() == Vector3<T>::Zero());
111111
}
112112

113+
// Construction of a "NaN" spatial vector.
114+
TYPED_TEST(SpatialQuantityTest, NaNFactory) {
115+
typedef typename TestFixture::SpatialQuantityType SpatialQuantity;
116+
typedef typename TestFixture::ScalarType T;
117+
SpatialQuantity V = SpatialQuantity::NaN();
118+
auto is_nan = [](const T& x) -> bool {
119+
if constexpr (std::is_same_v<T, Expression>) {
120+
return symbolic::is_nan(x);
121+
}
122+
if constexpr (std::is_same_v<T, AutoDiffXd>) {
123+
return std::isnan(x.value());
124+
}
125+
if constexpr (std::is_same_v<T, double>) {
126+
return std::isnan(x);
127+
}
128+
};
129+
for (int i = 0; i < V.size(); ++i) {
130+
EXPECT_TRUE(is_nan(V[i]));
131+
}
132+
}
133+
113134
// Tests:
114135
// - Construction from a Eigen expressions.
115136
// - SetZero() method.

0 commit comments

Comments
 (0)