Skip to content

Commit

Permalink
Merge pull request #10505 from EricCousineau-TRI/issue/10207_rbt_attic
Browse files Browse the repository at this point in the history
py multibody: Separate out attic modules
  • Loading branch information
EricCousineau-TRI authored Jan 28, 2019
2 parents dc36b1c + 2d4ed55 commit 72d2063
Show file tree
Hide file tree
Showing 14 changed files with 225 additions and 116 deletions.
1 change: 1 addition & 0 deletions bindings/pydrake/attic/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ drake_py_library(
)

PY_LIBRARIES_WITH_INSTALL = [
"//bindings/pydrake/attic/multibody",
"//bindings/pydrake/attic/solvers",
]

Expand Down
1 change: 1 addition & 0 deletions bindings/pydrake/attic/all.py
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
from .multibody.all import *
from .solvers.all import *
168 changes: 168 additions & 0 deletions bindings/pydrake/attic/multibody/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,168 @@
# -*- python -*-

load("@drake//tools/install:install.bzl", "install")
load("//tools/lint:lint.bzl", "add_lint_tests")
load(
"@drake//tools/skylark:pybind.bzl",
"drake_pybind_library",
"get_drake_py_installs",
"get_pybind_package_info",
)
load(
"@drake//tools/skylark:drake_py.bzl",
"drake_py_library",
)

package(default_visibility = [
"//bindings/pydrake:__subpackages__",
])

# This determines how `PYTHONPATH` is configured, and how to install the
# bindings.
PACKAGE_INFO = get_pybind_package_info("//bindings")

drake_py_library(
name = "module_py",
srcs = ["__init__.py"],
imports = PACKAGE_INFO.py_imports,
deps = [
"//bindings/pydrake:module_py",
],
)

drake_py_library(
name = "parsers_py",
srcs = ["parsers.py"],
deps = [
# N.B. This is a package dependency cycle, but hopefully short-lived.
"//bindings/pydrake/multibody:parsing_py",
],
)

drake_pybind_library(
name = "rigid_body_plant_py",
cc_deps = [
"//bindings/pydrake:documentation_pybind",
"//bindings/pydrake/systems:systems_pybind",
"//lcmtypes:viewer",
],
cc_srcs = ["rigid_body_plant_py.cc"],
package_info = PACKAGE_INFO,
py_deps = [
":module_py",
":rigid_body_tree_py",
"//bindings/pydrake:lcm_py",
"//bindings/pydrake/systems:framework_py",
],
)

drake_pybind_library(
name = "rigid_body_tree_py",
cc_deps = [
"//bindings/pydrake:autodiff_types_pybind",
"//bindings/pydrake:documentation_pybind",
"//bindings/pydrake/common:type_pack",
],
cc_srcs = ["rigid_body_tree_py.cc"],
package_info = PACKAGE_INFO,
py_deps = [
":collision_py",
":joints_py",
":module_py",
":parsers_py",
":rigid_body_py",
":shapes_py",
"//bindings/pydrake:autodiffutils_py",
"//bindings/pydrake/common:eigen_geometry_py",
],
)

drake_pybind_library(
name = "collision_py",
cc_deps = ["//bindings/pydrake:documentation_pybind"],
cc_srcs = ["collision_py.cc"],
package_info = PACKAGE_INFO,
py_deps = [
":module_py",
":rigid_body_py",
":shapes_py",
],
)

drake_pybind_library(
name = "joints_py",
cc_deps = [
"//bindings/pydrake:documentation_pybind",
"//bindings/pydrake/common:eigen_geometry_pybind",
],
cc_srcs = ["joints_py.cc"],
package_info = PACKAGE_INFO,
py_deps = [
":module_py",
"//bindings/pydrake/common:eigen_geometry_py",
],
)

drake_pybind_library(
name = "rigid_body_py",
cc_deps = ["//bindings/pydrake:documentation_pybind"],
cc_srcs = ["rigid_body_py.cc"],
package_info = PACKAGE_INFO,
py_deps = [
":module_py",
":shapes_py",
],
)

drake_pybind_library(
name = "shapes_py",
cc_deps = ["//bindings/pydrake:documentation_pybind"],
cc_srcs = ["shapes_py.cc"],
package_info = PACKAGE_INFO,
py_deps = [
":module_py",
"//bindings/pydrake/common:eigen_geometry_py",
],
)

PY_LIBRARIES_WITH_INSTALL = [
":collision_py",
":joints_py",
":rigid_body_py",
":rigid_body_plant_py",
":rigid_body_tree_py",
":shapes_py",
]

PY_LIBRARIES = [
":module_py",
":parsers_py",
]

# Symbol roll-up (for user ease).
drake_py_library(
name = "all_py",
srcs = ["all.py"],
deps = PY_LIBRARIES_WITH_INSTALL + PY_LIBRARIES,
)

# Package roll-up (for Bazel dependencies).
drake_py_library(
name = "multibody",
deps = [":all_py"],
)

install(
name = "install",
targets = PY_LIBRARIES + [":all_py"],
py_dest = PACKAGE_INFO.py_dest,
deps = get_drake_py_installs(PY_LIBRARIES_WITH_INSTALL),
)

# NOTE: Unittests on `attic` should not move until the forwarding modules
# outside of the attic are deprecated!

add_lint_tests(
cpplint_data = ["//bindings/pydrake:.clang-format"],
enable_clang_format_lint = True,
)
1 change: 1 addition & 0 deletions bindings/pydrake/attic/multibody/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Blank Python module.
7 changes: 7 additions & 0 deletions bindings/pydrake/attic/multibody/all.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
from .collision import *
from .joints import *
from .parsers import *
from .rigid_body_plant import *
from .rigid_body_tree import *
from .rigid_body import *
from .shapes import *
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ PYBIND11_MODULE(collision, m) {

m.doc() = "Drake Collision types.";

py::module::import("pydrake.multibody.shapes");
py::module::import("pydrake.multibody.rigid_body");
py::module::import("pydrake.attic.multibody.shapes");
py::module::import("pydrake.attic.multibody.rigid_body");

py::class_<Element, DrakeShapes::Element>(
m, "CollisionElement", doc.Element.doc)
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ PYBIND11_MODULE(rigid_body_plant, m) {
constexpr auto& doc = pydrake_doc.drake.systems;

// Ensure we have bindings for dependencies.
py::module::import("pydrake.attic.multibody.rigid_body_tree");
py::module::import("pydrake.lcm");
py::module::import("pydrake.multibody.rigid_body_tree");
py::module::import("pydrake.systems.framework");

using T = double;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ PYBIND11_MODULE(rigid_body, m) {

m.doc() = "Bindings for the individual RigidBody class.";

py::module::import("pydrake.multibody.joints");
py::module::import("pydrake.attic.multibody.joints");

py::class_<RigidBody<double> >(m, "RigidBody", doc.RigidBody.doc)
.def(py::init(), doc.RigidBody.ctor.doc)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@ PYBIND11_MODULE(rigid_body_tree, m) {
namespace sdf = drake::parsers::sdf;
using std::shared_ptr;

py::module::import("pydrake.multibody.collision");
py::module::import("pydrake.multibody.joints");
py::module::import("pydrake.multibody.parsers");
py::module::import("pydrake.multibody.rigid_body");
py::module::import("pydrake.multibody.shapes");
py::module::import("pydrake.attic.multibody.collision");
py::module::import("pydrake.attic.multibody.joints");
py::module::import("pydrake.attic.multibody.parsers");
py::module::import("pydrake.attic.multibody.rigid_body");
py::module::import("pydrake.attic.multibody.shapes");
py::module::import("pydrake.common.eigen_geometry");

constexpr auto& joints_doc = doc.drake.multibody.joints;
Expand Down
File renamed without changes.
Loading

0 comments on commit 72d2063

Please sign in to comment.