User Tools

Site Tools


vrkin

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
vrkin [2018/04/23 22:01] – [OpenVR Code] keitaronishimuravrkin [2018/04/24 11:26] (current) – [Importing Video Feed into HMD] keitaronishimura
Line 42: Line 42:
 {{ vive_tut:opencv:2-4.png?400 }} {{ vive_tut:opencv:2-4.png?400 }}
 </fc> </fc>
 +   *[[http://wiki.ros.org/web_video_server|Make sure to install the web video server package]]
 +\\
 +{{ vive_tut:opencv:2-6.png?400 }}
 +\\
    *[[https://docs.opencv.org/master/d7/d9f/tutorial_linux_install.html|Install OpenCV]]    *[[https://docs.opencv.org/master/d7/d9f/tutorial_linux_install.html|Install OpenCV]]
 \\   \\  
Line 399: Line 403:
 </code>    </code>   
 This code will take the data from the kinect and find the distance between the sensor and a yellow object. Then taking the FK data from Hubo's right hand will display the distance between the yellow object and Hubo's right hand above the detected object. How to run the code will be explained later on. This code will take the data from the kinect and find the distance between the sensor and a yellow object. Then taking the FK data from Hubo's right hand will display the distance between the yellow object and Hubo's right hand above the detected object. How to run the code will be explained later on.
- +\\ 
 +Then make a CMakeLists.txt file in the package and add the following code into it: 
 +<code txt> 
 +cmake_minimum_required(VERSION 2.8.3) 
 +project(kinect2hubo) 
 + 
 +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DBT_USE_DOUBLE_PRECISION -Wall"
 +# Unused warnings 
 +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wuninitialized -Winit-self -Wunused-function -Wunused-label -Wunused-variable -Wunused-but-set-variable -Wunused-but-set-parameter"
 +# Additional warnings 
 +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Warray-bounds -Wtype-limits -Wreturn-type -Wsequence-point -Wparentheses -Wmissing-braces -Wchar-subscripts -Wswitch -Wwrite-strings -Wenum-compare -Wempty-body -Wlogical-op"
 + 
 +# Check for c++11 support 
 +INCLUDE(CheckCXXCompilerFlag) 
 +CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11) 
 +CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X) 
 +IF(COMPILER_SUPPORTS_CXX11) 
 +SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11"
 +ELSEIF(COMPILER_SUPPORTS_CXX0X) 
 +SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x"
 +ELSE() 
 +  MESSAGE(ERROR "The compiler ${CMAKE_CXX_COMPILER} has no C++11 support. Please use a different C++ compiler."
 +ENDIF() 
 + 
 +find_package(catkin REQUIRED COMPONENTS 
 +  cv_bridge 
 +  geometry_msgs 
 +  message_runtime 
 +  roscpp 
 +  sensor_msgs 
 +  std_msgs 
 +  image_transport 
 +
 +find_package(freenect2 REQUIRED HINTS "$ENV{HOME}/freenect2") #for interfacing with kinect v2 
 +find_package(OpenCV REQUIRED) 
 + 
 +include_directories( 
 +  ${catkin_INCLUDE_DIRS} 
 +  ${OpenCV_INCLUDE_DIRS} 
 +  ${freenect2_INCLUDE_DIRS} 
 +
 + 
 +add_executable(${PROJECT_NAME}_node src/main.cpp) 
 + 
 + target_link_libraries(${PROJECT_NAME}_node 
 +   ${catkin_LIBRARIES} 
 +   ${OpenCV_LIBRARIES} 
 +   ${freenect2_LIBRARY} 
 + ) 
 +</code> 
 +Then make a package.xml file and add the following code: 
 +<code xml> 
 +<?xml version="1.0"?> 
 +<package format="2"> 
 +  <name>kinect2hubo</name> 
 +  <version>0.0.0</version> 
 +  <description>The kinect2hubo package</description> 
 + 
 +  <maintainer email="katnimura@gmail.com">Keitaro Nishimura</maintainer> 
 + 
 +  <license>TODO</license> 
 + 
 +  <buildtool_depend>catkin</buildtool_depend> 
 +  <build_depend>cv_bridge</build_depend> 
 +  <build_depend>geometry_msgs</build_depend> 
 +  <build_depend>roscpp</build_depend> 
 +  <build_depend>sensor_msgs</build_depend> 
 +  <build_depend>std_msgs</build_depend> 
 +  <build_depend>image_transport</build_depend> 
 +  <build_export_depend>cv_bridge</build_export_depend> 
 +  <build_export_depend>geometry_msgs</build_export_depend> 
 +  <build_export_depend>roscpp</build_export_depend> 
 +  <build_export_depend>sensor_msgs</build_export_depend> 
 +  <build_export_depend>std_msgs</build_export_depend> 
 +  <build_export_depend>image_transport</build_export_depend> 
 +  <exec_depend>cv_bridge</exec_depend> 
 +  <exec_depend>geometry_msgs</exec_depend> 
 +  <exec_depend>message_runtime</exec_depend> 
 +  <exec_depend>roscpp</exec_depend> 
 +  <exec_depend>sensor_msgs</exec_depend> 
 +  <exec_depend>std_msgs</exec_depend> 
 +  <exec_depend>image_transport</exec_depend> 
 +   
 +</package> 
 +</code> 
 +Then you should be ready to make the package using catkin_make. 
 ==== Importing Video Feed into HMD ==== ==== Importing Video Feed into HMD ====
 +\\
 +To insert the video feed into the HMD we will use the UniversalVROverlay package on the windows 10 computer running the HTC Vive. Please download the [[https://github.com/scudzey/UVROverlay|source code]] from github and build it to create the exe file.
 +\\
 +{{ vive_tut:opencv:2-7.png?400 }}
 +\\
 +The following steps depict how to stream the video feed from the OpenCV code into the the Vive HMD.
  
 +1. Connect all computers by router
  
-First introduce how this tutorial will show the reader how to get image and depth data into the openVR exe file using pre-existing package for ros, and opencv API. +2. Run the iai kinect code
  
-First go through the kinect computer and setting it upGoing through the instalation as well as the calibration of the camera.+3Run the Opencv code
  
-Then go into how to create the image wanted with opencv on the camera computer.+4. Run the web video server
  
-Then how to use the ros package to send the stream over the network with http+5. View the stream in the Vive pc through the web explorer
  
-Finally, talk about how to get the stream from the browser into the exe file using the openvr package+6. Use the UniversalVRoverlay to input the stream into the HMD
vrkin.1524546115.txt.gz · Last modified: by keitaronishimura