# -*- python -*-

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

package(
    default_visibility = [":__subpackages__"],
)

drake_cc_library(
    name = "jaco_common",
    srcs = [
        "jaco_common.cc",
    ],
    hdrs = [
        "jaco_common.h",
    ],
    deps = [
        "//attic/multibody/parsers",
        "//multibody:rigid_body_tree",
    ],
)

drake_cc_library(
    name = "jaco_lcm",
    srcs = ["jaco_lcm.cc"],
    hdrs = ["jaco_lcm.h"],
    deps = [
        "//lcmtypes:jaco",
        "//systems/framework:leaf_system",
    ],
)

drake_cc_binary(
    name = "jaco_controller",
    srcs = ["jaco_controller.cc"],
    data = [
        "//manipulation/models/jaco_description:models",
    ],
    deps = [
        ":jaco_lcm",
        "//common:find_resource",
        "//common:text_logging_gflags",
        "//lcm",
        "//manipulation/planner:robot_plan_interpolator",
        "//systems/controllers:pid_controller",
        "//systems/lcm:lcm_driven_loop",
        "//systems/lcm:lcm_pubsub_system",
        "//systems/primitives:adder",
        "//systems/primitives:demultiplexer",
        "//systems/primitives:multiplexer",
        "@gflags",
        "@lcmtypes_bot2_core",
        "@lcmtypes_robotlocomotion",
    ],
)

drake_cc_binary(
    name = "run_passive_jaco_demo",
    srcs = ["run_passive_jaco_demo.cc"],
    add_test_rule = 1,
    data = [
        "//manipulation/models/jaco_description:models",
    ],
    test_rule_args = ["--simulation_sec=0.1"],
    deps = [
        ":jaco_common",
        "//attic/multibody/rigid_body_plant",
        "//attic/multibody/rigid_body_plant:drake_visualizer",
        "//common:find_resource",
        "//common:text_logging_gflags",
        "//lcm",
        "//multibody:rigid_body_tree_construction",
        "//systems/analysis:simulator",
        "//systems/primitives:constant_vector_source",
        "@gflags",
    ],
)

drake_cc_binary(
    name = "run_setpose_jaco_demo",
    srcs = ["run_setpose_jaco_demo.cc"],
    add_test_rule = 1,
    data = [
        "//manipulation/models/jaco_description:models",
    ],
    test_rule_args = ["--simulation_sec=0.1"],
    deps = [
        ":jaco_common",
        "//attic/multibody/rigid_body_plant",
        "//attic/multibody/rigid_body_plant:drake_visualizer",
        "//common:find_resource",
        "//lcm",
        "//multibody:rigid_body_tree_construction",
        "//systems/analysis:simulator",
        "//systems/controllers:inverse_dynamics_controller",
        "//systems/primitives:constant_vector_source",
        "@gflags",
    ],
)

drake_cc_binary(
    name = "run_controlled_jaco_demo",
    srcs = ["run_controlled_jaco_demo.cc"],
    add_test_rule = 1,
    data = [
        "//manipulation/models/jaco_description:models",
    ],
    test_rule_args = ["--simulation_sec=0.1"],
    deps = [
        ":jaco_common",
        "//attic/multibody/rigid_body_plant",
        "//attic/multibody/rigid_body_plant:drake_visualizer",
        "//common:find_resource",
        "//common/trajectories:piecewise_polynomial",
        "//lcm",
        "//multibody:inverse_kinematics",
        "//multibody:rigid_body_tree_construction",
        "//systems/analysis:simulator",
        "//systems/controllers:inverse_dynamics_controller",
        "//systems/primitives:trajectory_source",
        "@gflags",
    ],
)

# === test/ ===

drake_cc_googletest(
    name = "jaco_lcm_test",
    deps = [
        ":jaco_lcm",
        "//systems/framework:diagram",
        "//systems/framework:diagram_builder",
    ],
)

add_lint_tests()
