hungpham2511 / toppra

robotic motion planning library
https://hungpham2511.github.io/toppra/index.html
MIT License
603 stars 167 forks source link

Using `CartesianVelocityNorm` in python #207

Closed jsbyysheng closed 2 years ago

jsbyysheng commented 2 years ago

The cpp implement of CartesianVelocityNorm has been add to toppra. In /cpp/bindings, I see

py::class_<CartesianVelocityNorm,
    std::shared_ptr<CartesianVelocityNorm>,
    LinearConstraint>(
      m, "CartesianVelocityNorm");

  {
    auto mod_jointTorque = m.def_submodule("cartesianVelocityNorm");
#ifdef BUILD_WITH_PINOCCHIO
    using cartesianVelocityNorm::Pinocchio;
#ifdef PINOCCHIO_WITH_PYTHON_INTERFACE
    py::module::import("pinocchio");
#endif
    py::class_<Pinocchio<>, std::shared_ptr<Pinocchio<> >, CartesianVelocityNorm>(
        mod_jointTorque, "Pinocchio")
#ifdef PINOCCHIO_WITH_PYTHON_INTERFACE
        .def(py::init([](py::object model, const Matrix& S, const double& limit, int frame_id) -> Pinocchio<>* {
              return new Pinocchio<>(
                  boost::python::extract<const pinocchio::Model&>(model.ptr()), S, limit, frame_id);
            }), py::keep_alive<1, 2>(), py::arg("model"), py::arg("S"), py::arg("limit"), py::arg("frame_id"))
#endif
      ;
#endif
  }

However, I cannot use CartesianVelocityNorm after building and installing from the source. I hope you can add support for CartesianVelocityNorm in python.

hungpham2511 commented 2 years ago

Hi, the python API and C++/C++ bindings are incompatible, i.e., you can't use constraints defined in the C++ bindings in the Python implementation.

We will eventually deprecate the Python API and use only the C++ API with bindings in near future. Unfortunately I can't really give you a date now. Probably in 1 month time.

jsbyysheng commented 2 years ago

Hi, the python API and C++/C++ bindings are incompatible, i.e., you can't use constraints defined in the C++ bindings in the Python implementation.

We will eventually deprecate the Python API and use only the C++ API with bindings in near future. Unfortunately I can't really give you a date now. Probably in 1 month time.

Thank you for your reply! Excellent job!