Skip to content

Commit

Permalink
[pydrake] Fix signatures to use Python types (not C++) (RobotLocomoti…
Browse files Browse the repository at this point in the history
…on#21911)

Add missing imports to bindings, so that function signatures can look
up their requisite python types. (This set of changes is the set of
modules whose sole problem was missing imports.)
  • Loading branch information
jwnimmer-tri authored and RussTedrake committed Dec 15, 2024
1 parent 403cc28 commit 03f574d
Show file tree
Hide file tree
Showing 11 changed files with 15 additions and 0 deletions.
1 change: 1 addition & 0 deletions bindings/pydrake/manipulation/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ drake_pybind_library(
package_info = PACKAGE_INFO,
py_deps = [
"//bindings/pydrake/systems:framework_py",
"//bindings/pydrake/systems:primitives_py",
],
py_srcs = [
"_manipulation_extra.py",
Expand Down
1 change: 1 addition & 0 deletions bindings/pydrake/manipulation/manipulation_py.cc
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ PYBIND11_MODULE(manipulation, m) {
PYDRAKE_PREVENT_PYTHON3_MODULE_REIMPORT(m);

py::module::import("pydrake.systems.framework");
py::module::import("pydrake.systems.primitives");

// The order of these calls matters. Some modules rely on prior definitions.
internal::DefineManipulationKukaIiwa(m);
Expand Down
3 changes: 3 additions & 0 deletions bindings/pydrake/multibody/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ drake_pybind_library(
package_info = PACKAGE_INFO,
py_deps = [
":module_py",
":tree_py",
],
)

Expand Down Expand Up @@ -198,6 +199,7 @@ drake_pybind_library(
py_deps = [
":module_py",
":plant_py",
"//bindings/pydrake/planning",
"//bindings/pydrake/solvers",
],
)
Expand All @@ -217,6 +219,7 @@ drake_pybind_library(
":module_py",
":plant_py",
"//bindings/pydrake/solvers",
"//bindings/pydrake:trajectories_py",
],
)

Expand Down
1 change: 1 addition & 0 deletions bindings/pydrake/multibody/inverse_kinematics_py.cc
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ PYBIND11_MODULE(inverse_kinematics, m) {

py::module::import("pydrake.math");
py::module::import("pydrake.multibody.plant");
py::module::import("pydrake.planning");
py::module::import("pydrake.solvers");

{
Expand Down
1 change: 1 addition & 0 deletions bindings/pydrake/multibody/optimization_py.cc
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ PYBIND11_MODULE(optimization, m) {
py::module::import("pydrake.math");
py::module::import("pydrake.multibody.plant");
py::module::import("pydrake.solvers");
py::module::import("pydrake.trajectories");

{
using Class = CalcGridPointsOptions;
Expand Down
1 change: 1 addition & 0 deletions bindings/pydrake/multibody/parsing_py.cc
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ PYBIND11_MODULE(parsing, m) {
constexpr auto& doc = pydrake_doc.drake.multibody;

py::module::import("pydrake.common.schema");
py::module::import("pydrake.multibody.tree");

// CollisionFilterGroups
{
Expand Down
1 change: 1 addition & 0 deletions bindings/pydrake/multibody/tree_py.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1167,6 +1167,7 @@ PYBIND11_MODULE(tree, m) {

py::module::import("pydrake.common.eigen_geometry");
py::module::import("pydrake.multibody.math");
py::module::import("pydrake.systems.framework");

internal::DefineTreeInertia(m);
DoScalarIndependentDefinitions(m);
Expand Down
3 changes: 3 additions & 0 deletions bindings/pydrake/systems/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ drake_pybind_library(
py_deps = [
":framework_py",
":module_py",
"//bindings/pydrake:trajectories_py",
],
)

Expand All @@ -107,6 +108,7 @@ drake_pybind_library(
py_deps = [
":framework_py",
":module_py",
"//bindings/pydrake:trajectories_py",
"//bindings/pydrake/solvers",
],
)
Expand Down Expand Up @@ -140,6 +142,7 @@ drake_pybind_library(
py_deps = [
":framework_py",
":module_py",
":primitives_py",
],
)

Expand Down
1 change: 1 addition & 0 deletions bindings/pydrake/systems/analysis_py.cc
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ PYBIND11_MODULE(analysis, m) {

py::module::import("pydrake.systems.framework");
py::module::import("pydrake.solvers");
py::module::import("pydrake.trajectories");

{
using Class = SimulatorConfig;
Expand Down
1 change: 1 addition & 0 deletions bindings/pydrake/systems/estimators_py.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ PYBIND11_MODULE(estimators, m) {
using drake::systems::System;

py::module::import("pydrake.systems.framework");
py::module::import("pydrake.systems.primitives");

{
using Class = LuenbergerObserver<double>;
Expand Down
1 change: 1 addition & 0 deletions bindings/pydrake/systems/primitives_py.cc
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ PYBIND11_MODULE(primitives, m) {
constexpr auto& doc = pydrake_doc.drake.systems;

py::module::import("pydrake.systems.framework");
py::module::import("pydrake.trajectories");

py::enum_<PerceptronActivationType>(
m, "PerceptronActivationType", doc.PerceptronActivationType.doc)
Expand Down

0 comments on commit 03f574d

Please sign in to comment.