Skip to content
Snippets Groups Projects
Commit f5d21f2d authored by Rohan Budhiraja's avatar Rohan Budhiraja
Browse files

[wip/sot-dynamic-pinocchio-v3][patch] managing pinocchio version 1.2.1r2. Update python bindings

parent 3864f861
No related branches found
No related tags found
No related merge requests found
......@@ -3,7 +3,7 @@
#
VERSION= 3.1.1
PKGREVISION= 1
PKGREVISION= 2
DISTNAME= sot-dynamic-pinocchio-v3-${VERSION}
MASTER_SITES= ${MASTER_SITE_OPENROBOTS:=sot-dynamic-pinocchio-v3/}
MASTER_REPOSITORY= ${MASTER_REPOSITORY_GITHUB}proyan/sot-dynamic/
......
......@@ -3,3 +3,4 @@ RMD160 (sot-dynamic-pinocchio-v3-3.1.1.tar.gz) = beddcd9fae060cbf371b80075978e20
Size (sot-dynamic-pinocchio-v3-3.1.1.tar.gz) = 922041 bytes
SHA1 (patch-aa) = c57a914a6fc1140f348dec8c1cd2627c79a4de7d
SHA1 (patch-ab) = 70878ef8071dfce1eddb895b35e3cdb4942a848f
SHA1 (patch-ac) = deb468df72d57de00d079edfbec8725f292fd8b5
--- src/python-module-py.cpp 2016-11-08 11:38:20.163431833 +0100
+++ src/python-module-py.cpp 2016-11-08 11:14:03.243064192 +0100
@@ -26,54 +26,11 @@
namespace dynamicgraph{
namespace sot{
- /* PyObject* getPinocchioModel(PyObject* // self
- ,PyObject* args) {
- PyObject* object = NULL;
- void* pointer = NULL;
-
- if (!PyArg_ParseTuple(args, "O", &object))
- return NULL;
-
- if (!PyCObject_Check(object)) {
- PyErr_SetString(PyExc_TypeError,
- "function takes a PyCObject as argument");
- return NULL;
- }
-
- pointer = PyCObject_AsVoidPtr(object);
- Dynamic* dyn_entity = (Dynamic*) pointer;
-
- se3::Model* model_ptr = NULL;
-
- try {
- model_ptr = dyn_entity->m_model;
- se3::python::ModelHandler& _model(& (dyn_entity->m_model));
- }
- catch (const std::exception& exc) {
- PyErr_SetString(dgpyError, exc.what());
- return NULL;
- }
- catch (const char* s) {
- PyErr_SetString(dgpyError, s);
- return NULL;
- }
- catch (...) {
- PyErr_SetString(dgpyError, "Unknown exception");
- return NULL;
- }
- //CATCH_ALL_EXCEPTIONS();
-
- // Return the pointer to the signal without destructor since the signal
- // is not owned by the calling object but by the Entity.
- //return boost::python::incref();
- return PyCObject_FromVoidPtr((void*)model_ptr, NULL);
- }
- */
-
PyObject* setPinocchioModel(PyObject* /* self */,PyObject* args) {
PyObject* object = NULL;
PyObject* pyPinocchioObject;
void* pointer1 = NULL;
+ se3::Model* pointer2 = NULL;
if (!PyArg_ParseTuple(args, "OO", &object, &pyPinocchioObject))
return NULL;
@@ -87,10 +44,9 @@
Dynamic* dyn_entity = (Dynamic*) pointer1;
try {
- se3::python::Handler<se3::Model> cppModelHandle =
- boost::python::extract< se3::python::Handler<se3::Model> >(pyPinocchioObject);
- dyn_entity->setModel(cppModelHandle.ptr());
- //dyn_entity->m_model = cppModelHandle.ptr();
+ boost::python::extract<se3::Model&> cppHandle(pyPinocchioObject);
+ pointer2 = (se3::Model*) &cppHandle();
+ dyn_entity->setModel(pointer2);
}
catch (const std::exception& exc) {
//PyErr_SetString(dgpyError, exc.what());
@@ -104,9 +60,7 @@
//PyErr_SetString(dgpyError, "Unknown exception");
return NULL;
}
- // Return the pointer to the signal without destructor since the signal
- // is not owned by the calling object but by the Entity.
- //return boost::python::incref();
+
return Py_BuildValue("");
}
@@ -114,6 +68,7 @@
PyObject* object = NULL;
PyObject* pyPinocchioObject;
void* pointer1 = NULL;
+ se3::Data* pointer2 = NULL;
if (!PyArg_ParseTuple(args, "OO", &object, &pyPinocchioObject))
return NULL;
@@ -127,10 +82,9 @@
Dynamic* dyn_entity = (Dynamic*) pointer1;
try {
- se3::python::Handler<se3::Data> cppDataHandle =
- boost::python::extract< se3::python::Handler<se3::Data> >(pyPinocchioObject);
- dyn_entity->setData(cppDataHandle.ptr());
- //dyn_entity->m_data = cppDataHandle.ptr();
+ boost::python::extract<se3::Data&> cppHandle(pyPinocchioObject);
+ pointer2 = (se3::Data*) &cppHandle();
+ dyn_entity->setData(pointer2);
}
catch (const std::exception& exc) {
// PyErr_SetString(dgpyError, exc.what());
@@ -144,9 +98,7 @@
// PyErr_SetString(dgpyError, "Unknown exception");
return NULL;
}
- // Return the pointer to the signal without destructor since the signal
- // is not owned by the calling object but by the Entity.
- //return boost::python::incref();
+
return Py_BuildValue("");
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment