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++?

Hello Everyone,
                      I want to use depth penetration functionality
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) {
    return list;

    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]