Skip to content

Commit

Permalink
Hello Robot obj causes ComputeSpatialInertia to throw.
Browse files Browse the repository at this point in the history
  • Loading branch information
RussTedrake committed Jul 2, 2024
1 parent 8780ea0 commit 2fe7f24
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 1 deletion.
2 changes: 2 additions & 0 deletions multibody/tree/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -689,10 +689,12 @@ drake_cc_googletest(
data = [
"//geometry:test_vtk_files",
"//multibody/parsing:test_models",
"@mujoco_menagerie_internal//:hello_robot_stretch",
],
deps = [
":geometry_spatial_inertia",
"//common:find_resource",
"//common:find_runfiles",
"//common/test_utilities:eigen_matrix_compare",
"//common/test_utilities:expect_throws_message",
"//geometry:shape_specification",
Expand Down
15 changes: 14 additions & 1 deletion multibody/tree/test/geometry_spatial_inertia_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include <gtest/gtest.h>

#include "drake/common/find_resource.h"
#include "drake/common/find_runfiles.h"
#include "drake/common/fmt_eigen.h"
#include "drake/common/test_utilities/eigen_matrix_compare.h"
#include "drake/common/test_utilities/expect_throws_message.h"
Expand Down Expand Up @@ -213,7 +214,19 @@ TYPED_TEST_P(MeshTypeSpatialInertaTest, Administrivia) {
}
}

REGISTER_TYPED_TEST_SUITE_P(MeshTypeSpatialInertaTest, Administrivia);
// Reproduction for issue #21666.
TYPED_TEST_P(MeshTypeSpatialInertaTest, HelloRobotStretch) {
using MeshType = TypeParam;

const RlocationOrError rlocation = FindRunfile(
"mujoco_menagerie_internal/hello_robot_stretch/assets/base_link_0.obj");
ASSERT_EQ(rlocation.error, "");
const MeshType unit_scale_obj(rlocation.abspath, 1.0);
EXPECT_NO_THROW(CalcSpatialInertia(unit_scale_obj, kDensity));
}

REGISTER_TYPED_TEST_SUITE_P(MeshTypeSpatialInertaTest, Administrivia,
HelloRobotStretch);
using MeshTypes = ::testing::Types<geometry::Convex, geometry::Mesh>;
INSTANTIATE_TYPED_TEST_SUITE_P(All, MeshTypeSpatialInertaTest, MeshTypes);

Expand Down
12 changes: 12 additions & 0 deletions tools/workspace/mujoco_menagerie_internal/package.BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,18 @@ filegroup(
]),
)

filegroup(
name = "hello_robot_stretch",
srcs = [
"hello_robot_stretch/stretch.xml",
"hello_robot_stretch/LICENSE",
] + glob([
"hello_robot_stretch/assets/*.obj",
"hello_robot_stretch/assets/*.png",
"hello_robot_stretch/assets/*.stl",
])
)

filegroup(
name = "kuka_iiwa_14",
srcs = [
Expand Down

0 comments on commit 2fe7f24

Please sign in to comment.