mjvive.cpp with mujoco 1.50 and OpenVR 1.0.7

Discussion in 'Visualization' started by Alex Ray, Jun 13, 2017.

  1. Figured I'd share this with the crowd in case other folks are looking for similar.

    This is a gist with mjvive.cpp updated to MuJoCo 1.50 and OpenVR SDK 1.0.7. The edits were very minor.

    mjvive.cpp is the whole updated mjvive, and minivive.cpp is a much simpler version without controllers. The makefile is a replacement for the makefile in mjpro150/samples which builds them.

    Note you have to copy the proper libraries (glew/openvr_api) and binaries into mjpro150/bin, and copy their respective headers into mjpro150/include. This is reasonably straightforward if you follow the compile errors.

    Links:
    Gist https://gist.github.com/openai-vr/1e78eb568c2f4dbfc3395ff8143fd709
    GLEW (download the windows binaries, copy headers, lib and bin) http://glew.sourceforge.net/
    OpenVR (download the 1.0.7 ZIP, copy headers, lib and bin) https://github.com/ValveSoftware/openvr/tree/v1.0.7

    Happy to answer questions if folks have any, and if you email me at aray@openai.com I'll probably be more responsive than on this forum.
     
  2. Emo Todorov

    Emo Todorov Administrator Staff Member

    Thanks Alex, I inserted a link to your Forum post in the online documentation where mjvive.cpp is documented (Programming chapter).

    On a related note, there is a new feature in MuJoCo 1.50 that is very useful in VR: ray selection. You can use it to emulate a hand-held laser pointer and select the object it is pointing to (instead of relying on the controller buttons as in the present code sample). I will add this to the official code sample when I get around to updating it. If anyone wants to implement this on their own in the meantime, look at the latest simulate.cpp - it illustrates how to use ray selection. In VR, the origin/direction of the selection ray should correspond to the controller and not the camera.