Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
MAminSFV committed Sep 8, 2024
1 parent 2019b54 commit 7eeb3bf
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
3 changes: 1 addition & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ description = "An example minimal project that compiles bindings using nanobind
readme = "README.md"
requires-python = ">=3.12"
authors = [
{ name = "M. Amin Safavi",
email = "safavi.m.amin@gmail.com" }
{ name = "M. Amin Safavi", email = "safavi.m.amin@gmail.com" }
]
classifiers = [
"License :: OSI Approved :: MIT License"
Expand Down
13 changes: 7 additions & 6 deletions src/custom_system.cc
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
#include <pybind11/pybind11.h>
#include <nanobind/nanobind.h>
#include <drake/systems/framework/leaf_system.h>

namespace py = pybind11;
namespace nb = nanobind;
using namespace nb::literals;

using drake::systems::BasicVector;
using drake::systems::Context;
Expand Down Expand Up @@ -30,14 +31,14 @@ class SimpleAdder : public LeafSystem<T> {
const T add_{};
};

PYBIND11_MODULE(custom_system, m) {
NB_MODULE(custom_system, m) {
m.doc() = "Example module interfacing with pydrake and Drake C++";

py::module::import("pydrake.systems.framework");
nb::module_::import_("pydrake.systems.framework");

using T = double;

py::class_<SimpleAdder<T>, LeafSystem<T>>(m, "SimpleAdder")
.def(py::init<T>(), py::arg("add"));
nb::class_<SimpleAdder<T>, LeafSystem<T>>(m, "SimpleAdder")
.def(nb::init<T>(), nb::arg("add"));
}
} // namespace drake_extension

0 comments on commit 7eeb3bf

Please sign in to comment.