#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2012
    Posts
    1
    Rep 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:

    HapticAPI2.dll
    HapticAPI2.h
    HapticAPI2.lib
    HapticAPI2Def.h
    HapticMASTER.h
    Vector3d.h

    With GLUT32 library files including:

    Glut.def
    Glut.h
    Glut32.dll
    Glut32.lib

    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.
  2. #2
  3. Contributing User
    Devshed Demi-God (4500 - 4999 posts)

    Join Date
    Aug 2011
    Posts
    4,854
    Rep Power
    481
    I've answered a few questions about ctypes in this forum.

    http://forums.devshed.com/python-programming-11/reading-dlls-in-python-916431.html

    for example. Hope this helps, otherwise, I dare say, .filetypes litter your post.
    [code]Code tags[/code] are essential for python code and Makefiles!

IMN logo majestic logo threadwatch logo seochat tools logo