Skip to content

Commit

Permalink
[models] Move allegro_hand_description into drake_models (#21184)
Browse files Browse the repository at this point in the history
  • Loading branch information
jwnimmer-tri authored Mar 25, 2024
1 parent 1d54460 commit 02992bd
Show file tree
Hide file tree
Showing 15 changed files with 59 additions and 3,231 deletions.
1 change: 0 additions & 1 deletion BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ filegroup(
"//examples/quadrotor:models",
"//examples/scene_graph:models",
"//examples/simple_gripper:simple_gripper_models",
"//manipulation/models/allegro_hand_description:models",
"//manipulation/models/franka_description:models",
"//manipulation/models/iiwa_description:models",
"//manipulation/models/jaco_description:models",
Expand Down
39 changes: 38 additions & 1 deletion examples/allegro_hand/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,31 @@ package(
default_visibility = [":__subpackages__"],
)

filegroup(
name = "models",
srcs = [
"@drake_models//:allegro_hand_description/meshes/allegro.mtl",
"@drake_models//:allegro_hand_description/meshes/base_link.obj",
"@drake_models//:allegro_hand_description/meshes/base_link_left.obj",
"@drake_models//:allegro_hand_description/meshes/link_0.0.obj",
"@drake_models//:allegro_hand_description/meshes/link_1.0.obj",
"@drake_models//:allegro_hand_description/meshes/link_12.0_left.obj",
"@drake_models//:allegro_hand_description/meshes/link_12.0_right.obj",
"@drake_models//:allegro_hand_description/meshes/link_13.0.obj",
"@drake_models//:allegro_hand_description/meshes/link_14.0.obj",
"@drake_models//:allegro_hand_description/meshes/link_15.0.obj",
"@drake_models//:allegro_hand_description/meshes/link_15.0_tip.obj",
"@drake_models//:allegro_hand_description/meshes/link_2.0.obj",
"@drake_models//:allegro_hand_description/meshes/link_3.0.obj",
"@drake_models//:allegro_hand_description/meshes/link_3.0_tip.obj",
"@drake_models//:allegro_hand_description/sdf/allegro_hand_description_left.sdf", # noqa
"@drake_models//:allegro_hand_description/sdf/allegro_hand_description_right.sdf", # noqa
"@drake_models//:allegro_hand_description/urdf/allegro_hand_description_left.urdf", # noqa
"@drake_models//:allegro_hand_description/urdf/allegro_hand_description_right.urdf", # noqa
],
visibility = ["//visibility:public"],
)

drake_cc_library(
name = "allegro_common",
srcs = ["allegro_common.cc"],
Expand All @@ -36,7 +61,7 @@ drake_cc_binary(
name = "run_allegro_constant_load_demo",
srcs = ["run_allegro_constant_load_demo.cc"],
data = [
"//manipulation/models/allegro_hand_description:models",
":models",
],
deps = [
"//common:add_text_logging_gflags",
Expand All @@ -62,4 +87,16 @@ drake_cc_googletest(
],
)

drake_cc_googletest(
name = "parse_test",
data = [
":models",
],
deps = [
"//common:find_resource",
"//multibody/parsing",
"//multibody/plant",
],
)

add_lint_tests(enable_clang_format_lint = False)
2 changes: 1 addition & 1 deletion examples/allegro_hand/joint_control/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ drake_cc_binary(
srcs = ["allegro_single_object_simulation.cc"],
data = [
":simple_mug.sdf",
"//manipulation/models/allegro_hand_description:models",
"//examples/allegro_hand:models",
],
deps = [
"//common:add_text_logging_gflags",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,11 @@ void DoMain() {
std::string hand_model_url;
if (FLAGS_use_right_hand) {
hand_model_url =
"package://drake/manipulation/models/"
"package://drake_models/"
"allegro_hand_description/sdf/allegro_hand_description_right.sdf";
} else {
hand_model_url =
"package://drake/manipulation/models/"
"package://drake_models/"
"allegro_hand_description/sdf/allegro_hand_description_left.sdf";
}

Expand Down
4 changes: 2 additions & 2 deletions examples/allegro_hand/run_allegro_constant_load_demo.cc
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,10 @@ void DoMain() {

std::string hand_url;
if (FLAGS_use_right_hand) {
hand_url = "package://drake/manipulation/models/"
hand_url = "package://drake_models/"
"allegro_hand_description/sdf/allegro_hand_description_right.sdf";
} else {
hand_url = "package://drake/manipulation/models/"
hand_url = "package://drake_models/"
"allegro_hand_description/sdf/allegro_hand_description_left.sdf";
}
multibody::Parser(&plant).AddModelsFromUrl(hand_url);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,21 @@ class ParseTest : public testing::TestWithParam<std::string> {};

TEST_P(ParseTest, Quantities) {
const std::string file_extension = GetParam();
const std::string path_right = FindResourceOrThrow(
fmt::format("drake/manipulation/models/allegro_hand_description/{}/"
const std::string url_right =
fmt::format("package://drake_models/allegro_hand_description/{}/"
"allegro_hand_description_right.{}",
file_extension, file_extension));
const std::string path_left = FindResourceOrThrow(
fmt::format("drake/manipulation/models/allegro_hand_description/{}/"
file_extension, file_extension);
const std::string url_left =
fmt::format("package://drake_models/allegro_hand_description/{}/"
"allegro_hand_description_left.{}",
file_extension, file_extension));
file_extension, file_extension);

MultibodyPlant<double> plant(0.0);
Parser parser(&plant);
const ModelInstanceIndex right_hand_index =
parser.AddModels(path_right).at(0);
const ModelInstanceIndex left_hand_index = parser.AddModels(path_left).at(0);
parser.AddModelsFromUrl(url_right).at(0);
const ModelInstanceIndex left_hand_index =
parser.AddModelsFromUrl(url_left).at(0);
plant.Finalize();

// MultibodyPlant always creates at least two model instances, one for the
Expand Down
1 change: 0 additions & 1 deletion manipulation/models/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ install(
name = "install_data",
visibility = ["//visibility:public"],
deps = [
"//manipulation/models/allegro_hand_description:install_data",
"//manipulation/models/franka_description:install_data",
"//manipulation/models/iiwa_description:install_data",
"//manipulation/models/jaco_description:install_data",
Expand Down
65 changes: 0 additions & 65 deletions manipulation/models/allegro_hand_description/BUILD.bazel

This file was deleted.

11 changes: 0 additions & 11 deletions manipulation/models/allegro_hand_description/LICENSE.TXT

This file was deleted.

Loading

0 comments on commit 02992bd

Please sign in to comment.