August 1st, 2012, 10:37 AM
Join Date: Aug 2012
Time spent in forums: 11 m 27 sec
Reputation Power: 0
Question about C++ wrapper for Python
Hi everyone, I have a question which I think I have a rough idea how to implement but wouldn’t mind a second opinion.
I have two systems I need to establish a 2 way connection with. Vizard 4.0 by Worldviz (Coding in Python and the SDK low level stuff in C++) which we are using to create virtual worlds. The other system is an API for the Moog HapticMaster robot (basically a big robot arm, API in C++) used to interact with Vizard to touch objects and manipulate the virtual world.
We have already written a .dle file using the Vizard SDK to get position data from the HapticMaster and that works fine, we can move a virtual object with 6DOF using the HapticMaster + Gimbal. The .dle file is static in that although position data is sent (via packets over IP to the actual robot) into Vizard, Vizard would need to call methods in the HapticMaster API (Mainly .h files but also to .dll/.cpp/.lib files too) in order to add haptic effects into the environment. The example code from Moog draws (in C++) spheres and other shapes (using GLUT) so that interaction can be achieved. We would need to draw these GLUT shapes in Vizard too.
It should be mentioned that the way high level commands are sent/received to and from (position data/force etc) are sent via network packets. The data retrieved from these packets are then manipulated via the HapticMaster API.
The HapticMaster API files are:
With GLUT32 library files including:
And of course the Vizard files are .py files
Looking around I know there are several options for fusing C++ and Python together.
.h files – ctpyes or boost python
.dll files - ctypes
.cpp files – ctypes or boost python
.lib files - ? Dunno about this one some solutions refer to even writing a DLL file.
.def files - ?
GLUT32 – PyOpenGL 3.x
Any networking stuff – Python socket code
Would this be a good way of doing this or does anyone know of any better modules/libraries? Or can all these files be access using one API such as boost as opposed to boost and ctypes?
Many thanks for any help, if you have any questions please don’t hesitate to ask me.