Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
extras
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Merge Requests
4
Merge Requests
4
Packages
Packages
Container Registry
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
The Openvibe Group
extras
Commits
3d449abc
Commit
3d449abc
authored
Apr 15, 2014
by
Jussi Lindgren
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Applications: Added OpenViBE->VRPN tutorial example
parent
537c9efd
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
683 additions
and
0 deletions
+683
-0
applications/examples/openvibe-to-vrpn/CMakeLists.txt
applications/examples/openvibe-to-vrpn/CMakeLists.txt
+57
-0
applications/examples/openvibe-to-vrpn/box-tutorials/vrpn-example-openvibe-to-vrpn.xml
...e-to-vrpn/box-tutorials/vrpn-example-openvibe-to-vrpn.xml
+569
-0
applications/examples/openvibe-to-vrpn/src/vrpn-receiver.cpp
applications/examples/openvibe-to-vrpn/src/vrpn-receiver.cpp
+57
-0
No files found.
applications/examples/openvibe-to-vrpn/CMakeLists.txt
0 → 100755
View file @
3d449abc
PROJECT
(
openvibe-examples-openvibe-to-vrpn
)
SET
(
PROJECT_VERSION_MAJOR
${
OV_GLOBAL_VERSION_MAJOR
}
)
SET
(
PROJECT_VERSION_MINOR
${
OV_GLOBAL_VERSION_MINOR
}
)
SET
(
PROJECT_VERSION_PATCH
${
OV_GLOBAL_VERSION_PATCH
}
)
SET
(
PROJECT_VERSION
${
PROJECT_VERSION_MAJOR
}
.
${
PROJECT_VERSION_MINOR
}
.
${
PROJECT_VERSION_PATCH
}
)
INCLUDE
(
"FindThirdPartyVRPN_Check"
)
IF
(
NOT PATH_VRPN
)
MESSAGE
(
STATUS
" --> Not building
${
PROJECT_NAME
}
"
)
RETURN
()
ENDIF
(
NOT PATH_VRPN
)
FILE
(
GLOB_RECURSE source_files src/*.cpp src/*.h src/*.hpp src/*.inl include/*.h
)
INCLUDE_DIRECTORIES
(
include
)
ADD_EXECUTABLE
(
${
PROJECT_NAME
}
${
source_files
}
)
INCLUDE
(
"FindThirdPartyVRPN"
)
# ---------------------------------
# Target macros
# Defines target operating system
# Defines target architecture
# Defines target compiler
# ---------------------------------
IF
(
WIN32
)
ADD_DEFINITIONS
(
-D_CRT_SECURE_NO_DEPRECATE
)
ADD_DEFINITIONS
(
-DTARGET_OS_Windows
)
ADD_DEFINITIONS
(
-DTARGET_ARCHITECTURE_i386
)
ADD_DEFINITIONS
(
-DTARGET_COMPILER_VisualStudio
)
ENDIF
(
WIN32
)
IF
(
UNIX
)
# ADD_DEFINITIONS(-fvisibility=hidden) # This flag should be present... man gcc
ADD_DEFINITIONS
(
-g
)
ADD_DEFINITIONS
(
-fnon-call-exceptions
)
ADD_DEFINITIONS
(
-DTARGET_OS_Linux
)
ADD_DEFINITIONS
(
-DTARGET_ARCHITECTURE_i386
)
ADD_DEFINITIONS
(
-DTARGET_COMPILER_GCC
)
ENDIF
(
UNIX
)
# ----------------------
# Generate launch script
# ----------------------
OV_INSTALL_LAUNCH_SCRIPT
(
"openvibe-examples-openvibe-to-vrpn"
)
# -----------------------------
# Install files
# -----------------------------
INSTALL
(
TARGETS
${
PROJECT_NAME
}
RUNTIME DESTINATION
${
CMAKE_INSTALL_FULL_BINDIR
}
LIBRARY DESTINATION
${
CMAKE_INSTALL_FULL_LIBDIR
}
ARCHIVE DESTINATION
${
CMAKE_INSTALL_FULL_LIBDIR
}
)
INSTALL
(
DIRECTORY box-tutorials/ DESTINATION
${
CMAKE_INSTALL_FULL_DATADIR
}
/openvibe/scenarios/box-tutorials PATTERN
".svn"
EXCLUDE
)
#INSTALL(DIRECTORY include/ DESTINATION ${CMAKE_INSTALL_FULL_INCLUDEDIR}/ FILES_MATCHING PATTERN "*.h" PATTERN ".svn" EXCLUDE)
applications/examples/openvibe-to-vrpn/box-tutorials/vrpn-example-openvibe-to-vrpn.xml
0 → 100755
View file @
3d449abc
This diff is collapsed.
Click to expand it.
applications/examples/openvibe-to-vrpn/src/vrpn-receiver.cpp
0 → 100755
View file @
3d449abc
/*
* Receives data from OpenViBE's VRPN boxes
*
* See here: http://openvibe.inria.fr/vrpn-tutorial-sending-data-from-openvibe-to-an-external-application/
*
*/
#include <iostream>
#include <vrpn_Button.h>
#include <vrpn_Analog.h>
void
VRPN_CALLBACK
vrpn_button_callback
(
void
*
user_data
,
vrpn_BUTTONCB
button
)
{
std
::
cout
<<
"Button ID : "
<<
button
.
button
<<
" / Button State : "
<<
button
.
state
<<
std
::
endl
;
if
(
button
.
button
==
1
)
{
*
(
bool
*
)
user_data
=
false
;
}
}
void
VRPN_CALLBACK
vrpn_analog_callback
(
void
*
user_data
,
vrpn_ANALOGCB
analog
)
{
for
(
int
i
=
0
;
i
<
analog
.
num_channel
;
i
++
)
{
std
::
cout
<<
"Analog Channel : "
<<
i
<<
" / Analog Value : "
<<
analog
.
channel
[
i
]
<<
std
::
endl
;
}
}
int
main
(
int
argc
,
char
**
argv
)
{
/* flag used to stop the program execution */
bool
running
=
true
;
/* VRPN Button object */
vrpn_Button_Remote
*
VRPNButton
;
/* Binding of the VRPN Button to a callback */
VRPNButton
=
new
vrpn_Button_Remote
(
"openvibe_vrpn_button@localhost"
);
VRPNButton
->
register_change_handler
(
&
running
,
vrpn_button_callback
);
/* VRPN Analog object */
vrpn_Analog_Remote
*
VRPNAnalog
;
/* Binding of the VRPN Analog to a callback */
VRPNAnalog
=
new
vrpn_Analog_Remote
(
"openvibe_vrpn_analog@localhost"
);
VRPNAnalog
->
register_change_handler
(
NULL
,
vrpn_analog_callback
);
/* The main loop of the program, each VRPN object must be called in order to process data */
while
(
running
)
{
VRPNButton
->
mainloop
();
}
return
0
;
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment