- The added line is THIS COLOR.
- The deleted line is THIS COLOR.
[[Tutorial]]
#contents
The aim of this tutorial is to show how virtual reality can be integrated using SIGVerse via Oculus Rift Sensor, virtual reality head-mounted display.
System Requirements:
- Oculus Rift Sensor
- SIGViewer 2.3.0 (please download it from here)
- SIGViewer later than 2.3.0
-- You can use Oculus DK2 From v2.3.2
- Oculus SDK (and Runtime) for Windows (please download it from [[here>https://developer.oculus.com/downloads/]])
-- We had used version 0.4.3 in this development.
- HDMI port in your PC.
- Visual C++ Express 2010
NOTE: There are two development kits available DK1 and DK2 (as of Dec 22,2014). Please use OculusRift DK1 for the following tutorial.
------
If you questions after reading this page: Please feel free to email at::
{jain@nii.ac.jp, inamura@nii.ac.jp}
If you have any questions after reading this page: Please feel free to email at:
sigverse-users@googlegroups.com
-------
*Introduction [#x48b2622]
This tutorial describes how to use the sensor implemented on Oculus
Rift in SIGVerse. It consists of two modules: a SIGService module
which can receive signals from Oculus Rift and an agent controller to
get messages from SIGViewer.
|#ref(front.jpg,,20%); |#ref(back.jpg,,20%) ;|#ref(developer.jpg,,20%);|
Figure1: The Oculus Rift Sensor. Front View, Back View and the Control Board. Source: Wikipedia.
Figure1: The Oculus Rift Sensor. From L-R (a)Front View, (b) Back View and ( c) the Control Board. Source: Wikipedia.
Please make the suitable cable connections with your PC (e.g. connections with HDMI port) and with the power outlet.
** Building SIGService module for OculusRiftSensor on Windows. [#j93b096d]
The steps are explained as follows:
1. First of all, you will need to setup SIGService_v2-2-0_vc2010.zip service libraries, downloadable from [[here>http://www.sigverse.org/wiki/en/index.php?service%20libraries#fefa72a8]].
Also, to build the required SIG file for sending the signals from sensor to the SIGViewer, please read the [[tutorial>http://www.sigverse.org/wiki/en/index.php?Tutorial]] for "Interprocess Communication", if you have not done it so far.
2. On Windows, obtain the code for SIGService model by cloning from the GitHub and moving to the Plugin/OculusRiftSensor directory.
$ git clone https://github.com/SIGVerse/Client.git
$ cd Plugin/OculusRiftSensor
$ cd Plugin/OculusRiftSensor/ViewerService
3. Open the project's property pages -> C/C++ -> General and make sure that the include path of your Boost Library is specified in "Additional Include Directories" field, e.g. C:\boost_1_55_0.
4. Open the project's property pages -> Linker -> General and make sure that the library path of your Boost Library is specified in "Additional Library Directories" field, e.g. C:\boost_1_55_0\lib.
5. Click Build -> Build Solution to build the SIG file.
** Creating the workspace on Linux [#y0bc31db]
Please create a directory and place the Controller code, Makefile and World XML file given below.
$ sigcreate.sh OculusRift
** Controller for entity [#k3be7ece]
The controller code for obtaining the data from SIGService is shown below.
To remind the reader, a controller is one of the main programs which should be written by SIGVerse users. This controller determines the behavior of agents, robots and objects in the virtual world. These 'objects' are called as entities in the SIGVerse.
Let's see the controller sample.
$ cd MyWorld
$ cd OculusRift
$ emacs OculusRiftCtrl.cpp
#gist(raghavendrajain/af0d69887e3a2accc719);
The agent controller creates a class named "RobotController" by inheriting Controller class.
In this case, onAction function is called every 1.0 seconds, which is specified as the return value of the onAction.
But, as you can see, this controller does nothing.
** Compiling the controller [#q60191ea]
A shell script for the compilation has been automatically prepared in your working space. You can compile the controller by
$ ./sigmake.sh OculusRiftCtrl.cpp
If the compilation succeeded, you can see OculusRiftCtrl.so.
** World file [#x8e5ecc7]
World file describes the configuration of the virtual world. In the SIGVerse system, world file is described in XML format.
The following world file is already prepared in your working space.
$ emacs OculusRiftCtrl.xml
OculusRiftCtrl.xml
#gist(raghavendrajain/2ce83f08a19001c87c28)
The world file reads the file Man-nii.xml as an agent. This agent belongs to the human avataor inside SIGVerse.
** Starting the simulation [#zafcd00a]
The script sigserver.sh is used to run the simulation and it placed in sigverse-<version>/bin directory. But you can run the simulation from anywhere because the PATH for the simulation is already set.
Type the following command in your working directory.
$ sigserver.sh -w ./OculusRiftCtrl.xml
:
:
[SYS] waiting for connection...
[SYS] Controller attached to "Toy_D"
[SYS] 127.0.0.1 connected
[SYS] Toy_D : dataport
[SYS] 127.0.0.1 connected
[SYS] waiting for connection...
[SYS] Controller attached to "kinect_man"
[SYS] 0.0.0.0 connected
[SYS] kinect_man : dataport
[SYS] 127.0.0.1 connected
Please specify a world file with -w option.
Start the SIGViewer and enter the host name and port number to connect to the SIGServer . Please use the button "Connect to SIGServer" by single click.
|#ref(main.png,,40%); |#ref(entry.png,,40%) ;|#ref(human.png,,40%);|
Figure2: From L-R (a)SIGViewer 2.3.0 (b) After login inside SIGViewer (and black boundary on to-left is clicked) and (c) the NII-Man Avatar.
*** Registration of user interface plug-in [#i3bdc209]
Click the [Service]-->[Add] menu on the top-left of the SIGViewer window bar.
#ref(SIGNi_1.PNG)
You then can see the following window.
Click the Add button to registrate OculusRift.sig
#ref(./SIGNi_2.PNG,80%)
After the registration of OculusRift.sig to the Service list, click the OK button to close the window.
Next, click the [Service]-->[Start] menu; then select the OculusRift.sig
After adding and starting the SIGService for OculusRift, it starts to receive signals from the sensors and the agent controller starts to get messages from SIGViewer.
Now, according to the orientation of sensor, you can notice the change in head orientation of nii-man avatar.
|#ref(IMG_1687.JPG,,35%); |#ref(IMG_1681.JPG,,40%)|
To see the view from avatar's eyes:
-- please click the || || of the small rectangular view window
-- please wear the OculusRift and get agent's view.