# -*- python -*-

load(
    "//tools:drake.bzl",
    "drake_cc_binary",
    "drake_cc_library",
)
load("//tools/lint:lint.bzl", "add_lint_tests")

filegroup(
    name = "mydata",
    srcs = glob([
        "**/*.urdf",
        "**/*.sdf",
        "robot_keyframes.txt",
    ]),
    visibility = ["//visibility:public"],
)

drake_cc_binary(
    name = "box_rotation_demo",
    srcs = ["box_rotation_demo.cc"],
    data = [
        ":mydata",
    ],
    deps = [
        "//common:find_resource",
        "//examples/kuka_iiwa_arm:iiwa_common",
        "@gflags",
    ],
)

drake_cc_library(
    name = "iiwa_box_diagram_factory",
    srcs = [
        "iiwa_box_diagram_factory.cc",
    ],
    hdrs = [
        "iiwa_box_diagram_factory.h",
    ],
    visibility = ["//examples/kuka_iiwa_arm:__subpackages__"],
    deps = [
        "//attic/multibody/rigid_body_plant",
        "//examples/kuka_iiwa_arm:iiwa_common",
        "//examples/kuka_iiwa_arm:oracular_state_estimator",
        "//manipulation/util:sim_diagram_builder",
        "//manipulation/util:world_sim_tree_builder",
        "//systems/controllers:inverse_dynamics_controller",
        "//systems/framework:diagram",
        "//systems/framework:diagram_builder",
    ],
)

drake_cc_binary(
    name = "iiwa_box_simulation",
    srcs = ["iiwa_box_simulation.cc"],
    add_test_rule = 1,
    data = [
        ":mydata",
        "//examples/kuka_iiwa_arm:models",
        "//manipulation/models/iiwa_description:models",
    ],
    test_rule_args = ["--simulation_sec=0.01"],
    # Flaky because LCM self-test can fail (PR #7311)
    test_rule_flaky = 1,
    deps = [
        ":iiwa_box_diagram_factory",
        "//attic/multibody/rigid_body_plant",
        "//attic/multibody/rigid_body_plant:contact_results_to_lcm",
        "//common:find_resource",
        "//examples/kuka_iiwa_arm:iiwa_common",
        "//examples/kuka_iiwa_arm:iiwa_lcm",
        "//examples/kuka_iiwa_arm:oracular_state_estimator",
        "//lcm",
        "//lcmtypes:contact_info_for_viz",
        "//lcmtypes:contact_results_for_viz",
        "//manipulation/util:frame_pose_tracker",
        "//manipulation/util:world_sim_tree_builder",
        "//systems/analysis",
        "//systems/primitives:constant_vector_source",
        "//systems/sensors:optitrack_sender",
        "@gflags",
        "@lcmtypes_bot2_core",
        "@lcmtypes_robotlocomotion",
    ],
)

add_lint_tests()
