From e3fecddfb872aac5cab68bccd41a1294d507fcb0 Mon Sep 17 00:00:00 2001 From: Paul Sardin Date: Wed, 28 Jan 2026 08:13:41 +0100 Subject: [PATCH] Deprecate Device::asPinDevice() --- src/pyhpp/manipulation/device.cc | 16 +++++++++------- src/pyhpp/manipulation/device.hh | 1 - 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/pyhpp/manipulation/device.cc b/src/pyhpp/manipulation/device.cc index a68b273..801afd8 100644 --- a/src/pyhpp/manipulation/device.cc +++ b/src/pyhpp/manipulation/device.cc @@ -56,12 +56,6 @@ std::map Device::grippers() { ->grippers.map; } -PinDevicePtr_t Device::asPinDevice() { - hpp::pinocchio::DevicePtr_t pinDevice = - std::dynamic_pointer_cast(obj); - return pinDevice; -} - void Device::setJointBounds(const char* jointName, boost::python::list py_jointBounds) { Frame frame = obj->getFrameByName(jointName); @@ -172,6 +166,14 @@ void exposeHandle() { .def(boost::python::map_indexing_suite, true>()); } +object asPinDevice(object self) { + PyErr_WarnEx(PyExc_DeprecationWarning, + "asPinDevice() is deprecated: manipulation.Device already " + "inherits from pinocchio.Device, use the object directly", + 1); + return self; +} + void exposeDevice() { // DocClass(Device) class_, boost::shared_ptr, @@ -179,7 +181,7 @@ void exposeDevice() { .def("setRobotRootPosition", &Device::setRobotRootPosition) .def("handles", &Device::handles) .def("grippers", &Device::grippers) - .def("asPinDevice", &Device::asPinDevice) + .def("asPinDevice", &asPinDevice) .def("getJointNames", &Device::getJointNames) .def("getJointConfig", &Device::getJointConfig) .def("setJointBounds", &Device::setJointBounds); diff --git a/src/pyhpp/manipulation/device.hh b/src/pyhpp/manipulation/device.hh index 3b60042..ed22d4d 100644 --- a/src/pyhpp/manipulation/device.hh +++ b/src/pyhpp/manipulation/device.hh @@ -80,7 +80,6 @@ struct Device : public pyhpp::pinocchio::Device { const Transform3s& positionWRTParentJoint); std::map handles(); std::map grippers(); - PinDevicePtr_t asPinDevice(); boost::python::list getJointConfig(const char* jointName); boost::python::list getJointNames(); void setJointBounds(const char* jointName, boost::python::list jointBounds);