Expected to work, but doesn't

Discussion in 'HAPTIX' started by Michael Wolfson, Feb 24, 2015.

    • Support for Octave (right now, it fails to load the MEX file).
      Note: not a high priority unless users request this capability
     
    Last edited: Feb 24, 2015
  1. Emo Todorov

    Emo Todorov Administrator Staff Member

    There is no one here using Octave, but we could look into it if it becomes a priority... are MEX files supposed to be binary compatible between MATLAB and Octave? My understanding is that Octave tries to mimic MATLAB but does not always succeed. Our MEX file is unusually elaborate, because it needs to maintain the socket connection to the simulator between calls. This is done via MATLAB's mex-locking mechanism.
     
  2. Is there a way to use Gazebo HAPTIX Matlab/Octave API to communicate with MuJoCo-haptix ? At Gazebo website it says:

    "The HAPTIX Matlab/Octave API is composed of five mex functions: hx_connect(), hx_robot_info(), hx_update, hx_read_sensors and hx_close(). hx_connect() and hx_close() are optional for the Gazebo simulator, but are included for compatibility with MuJoCo."

    So I suppose there is an intended compatibility, but I don't have any clue of what I have to change to make it work.
     
  3. On a second thought, I guess this is just the interface, and internally MuJoCo and Gazebo works differently, right ?

    Could I ask for a Linux (.so) version of mjhaptix_user{.lib,.dll} library ? I could provide a MEX file for octave with it.
     
  4. Emo Todorov

    Emo Todorov Administrator Staff Member

    Correct, the hx_XXX API is the same but the implementation is different (including socket connection, internal message format etc) so you cannot use one communication library with the other simulator.

    Supporting Linux is not a high priority given that you need a Windows machine to run the simulator itself - in which case you might as well work in Windows and avoid dual machines or virtualization. Once the new API is finalized following feedback from the DARPA performer teams, I can port it to Linux and also open-source the C++ wrapper producing the MEX so you don't have to replicate all the work (it is over 1000 lines of C++ code). However I don't have the time to port/test every intermediate version, and I suspect there will be a few such versions.

    Can you use Octave on Windows? If that is an option, I can open-source the C++ MEX wrapper now so you can start working on an Octave analog...
     
  5. I was able to run the simulator on Linux with Wine flawlessly. Even connected to it from another machine running Windows for a test. So I was hoping even for a Linux precompiled shared library (.so file) to write an Octave MEX just for wrapping the hx_* C/C++ calls (the haptix-comm project repository has a source for this that I modified to support a proper hx_connect call).

    Despite this, it would be great if your wrapper could be open sourced, even just for Windows. However, if I'm not mistaken, your mjhaptix_user library is 64 bits and there is only a 32 bits Windows installer for Octave.
     

    Attached Files:

    • hxgz.c
      File size:
      12.6 KB
      Views:
      117
  6. Emo Todorov

    Emo Todorov Administrator Staff Member

    Impressive! Did you have to do anything nontrivial or did it just run?

    The file mjhx.cpp is attached.
     

    Attached Files:

    • mjhx.cpp
      File size:
      29.7 KB
      Views:
      138
  7. For the simulator ? No, just used a clean Wine Prefix and it runned out of the box.

    Thanks for the file.