How to send EnvironmentBasePtr from python program to c++?

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

How to send EnvironmentBasePtr from python program to c++?

saurabdixit
Hello Everyone,
                      I want to use depth penetration functionality
available
<http://openrave.org/docs/latest_stable/coreapihtml/classOpenRAVE_1_1CollisionReport_1_1CONTACT.html>  
in c++. I wrote a function in c++ to return a vector after calling it from
python. I am using BOOST_PYTHON_MODULE. I want to send EnvironmentBasePtr
from python to c++ as input to the function. So far, I am not able to do it.
Does anyone know a method for sending the pointer from python to c++? I am
not much familiar in c++.


#include "openrave-core.h"
#include "ros/ros.h"
#include "std_msgs/String.h"
#include "valid_grasp_generator/GraspSnapshot.h"
#include <iostream>
#include <vector>
#include <boost/python.hpp>
#include <sstream>
using namespace OpenRAVE;
using namespace std;

boost::python::list get_penetration_depth(string env)
{
    vector<double> vec(9,0);
    stringstream ss(env);
    long long unsigned int i;
    ss >> hex >> i;
    EnvironmentBasePtr penv = reinterpret_cast<int *>(i);


    //code for getting penetration value from the openrave

    typename std::vector<double>::iterator iter;
    boost::python::list list;
    for (iter = vec.begin(); iter != vec.end(); ++iter) {
    list.append(*iter);
    }
    return list;
}

BOOST_PYTHON_MODULE(libdepth_penetration){
    using namespace boost::python;
    def("get_penetration", get_penetration_depth);
}





--
View this message in context: http://openrave-users-list.185357.n3.nabble.com/How-to-send-EnvironmentBasePtr-from-python-program-to-c-tp4027716.html
Sent from the OpenRAVE Users List mailing list archive at Nabble.com.

------------------------------------------------------------------------------
_______________________________________________
Openrave-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/openrave-users
Loading...