Skip to content

1. Installation & Setup

MohitShridhar edited this page Aug 26, 2014 · 31 revisions

Tested Platforms: OS X (Mavericks - 10.9), Ubuntu (Raring Ringtail - 13.04)

ROS Hydro

Guides: Ubuntu, OSX (Homebrew), OSX (Macports)
The 'bare-bones' bundle should suffice.

OculusSDK

Note: The following instructions are based on this tutorial.

Ubuntu

Clone & Install SDK:

$ sudo apt-get install libusb-dev libudev-dev libxinerama-dev

$ git clone https://github.com/MohitShridhar/oculussdk.git
$ cd oculussdk
$ mkdir build

$ cd build
$ cmake .. -DCMAKE_INSTALL_PREFIX=/usr
$ make
$ sudo make install

$ sudo cp ../LibOVR/90-oculus.rules /etc/udev/rules.d/
$ sudo udevadm control --reload-rules

OSX (Homebrew)

Clone & Install SDK:

$ brew install libusb --universal

$ git clone https://github.com/MohitShridhar/oculussdk.git
$ cd oculussdk
$ mkdir build

$ cd build
$ cmake .. -DCMAKE_INSTALL_PREFIX=/usr
$ make
$ sudo make install

Gazebo

Oculus-Rift Gazebo Navigator uses a customized version of the Gazebo 4.0.0 soruce code. So you must uninstall any existing Gazebo packages before proceeding.

Clone & Install SDFormat (if needed):

$ cd <src_dir>
$ hg clone https://bitbucket.org/osrf/sdformat

$ cd sdformat
$ hg up sdf_2.0

$ mkdir build
$ cd build

$ cmake .. -DCMAKE_INSTALL_PREFIX=/usr
$ make -j4
$ sudo make install

Note: <src_dir> is just a folder for storing source code.

Clone & Install Gazebo:

$ cd <src_dir>
$ hg clone https://TihomRis@bitbucket.org/TihomRis/gazebo

$ cd gazebo
$ mkdir build
$ cd build

$ cmake .. # or with whatever install prefix you prefer

Check that CMake generates this message:

-- checking for module 'OculusVR'
--   found OculusVR, version 0.2.5

Compile:

$ make -j4
$ sudo make install

See the official documentation for more details on compiling Gazebo from source.

Oculus Config

Fire-up a text editor and create ~/.gazebo/gui.ini with the following contents:

[geometry]
x=0
y=0

[oculus]
x=0
y=0
visual=camera::camera_link::visual
autolaunch=0

Use these settings if you want to mirror your display with the Oculus-Rift (for demostration purposes). If you prefer to use it as a secondary display, then change x in [oculus] to the horizontal resolution of your primary display.

Testing

Run Gazebo:

$ gazebo

Select Window->Oculus Rift in Gazebo's menu bar. You should be able to inspect the empty world from a fixed viewpoint on your HMD. If the orientation-response latency is too slow (so much that it's nauseating), then you might want to consider switching to a high perfomance system with a better GPU.

By default, windowed-mode will be enabled. You can toggle fullscreen-mode by pressing F11. But Qt4 on OSX 10.9 is known to have some issues with fullscreen applications. However from our experience, the windowed-mode doesn't seem to degrade the immersive experience, as long as the window is maximized.

PS3 Controller

OSX

Note: The following instructions are based on this README.

Resolve dependency & Install:

$ brew update
$ brew install glfw

$ cd <catkin_ws>/src
$ git clone https://github.com/walchko/osx_joystick.git
$ cd <catkin_ws>
$ catkin_make --pkg osx_joystick

Pair your PS3 controller with your Mac and start the joystick program:

$ rosrun osx_joystick joystick --num 0 --hz 25

Ensure that the output topic is named /joy0. If not, simply remap it:

$ rosrun osx_joystick joystick --num 0 --hz 25 <your_output_topic>:=/joy0

Check if it's working:

$ rostopic echo /joy0

You should be able to spot messages with 16 button-states and atleast 2 joystick axes.

Ubuntu

Coming soon

Navigator Settings

Factory Settings - oculus_config.yaml:

keyboard_teleop:
    camera:
        walking_speed: 5
        running_speed: 8
        rotating_speed: 1.57
    others:
        sampling_duration: 40000 # in microseconds. The interval during which the keyboard input is polled

ps3_teleop:
    camera:
        max_walking_speed_x: 2.0
        max_walking_speed_y: 1.5

        max_running_speed_x: 4.0 # Be careful with these. run_too_fast == true ? puke : vomit
        max_running_speed_y: 3.0

        max_vertical_speed: 1.0
        upper_position_limit: 41.0 # Because we don't want the camera to float away into heaven.
        lower_position_limit: 2.52 # Because we don't want the camera to sink down into hell. Anyway, you are the master of this->universe. You almighty.
        x_ray_mode_transparent_objects: "world, elevator_1" # A list of gz-models that will be rendered as transparent objects in 'X-ray Mode'

    robot:
        model_name: robot0 
        cmd_vel_topic: robot0/cmd_vel # can also be remapped later

        normal_linear_speed: 0.4
        normal_angular_speed: 0.785 # rad/s 

        fast_linear_speed: 1.1
        fast_angular_speed: 1.60

        mirror_mode_fixed_z_pos: 0.79
        map_frame: map
        base_link_frame: sesto_frame

You need to tailor the translation/rotation speeds according to your application. If your world contains a lot of CPU-exhaustive collision meshes, then the reduced real-time factor will drastically degrade the VR-experience.