Commit 9955d979 authored by Jozef Legeny's avatar Jozef Legeny

added files for the next gen SSVEP demo

applications/ssvep-ng:
+ added all files for the new ssvep demo

cmake-modules:
+ added a find script for OGRE with Terrain module on
parent e132ef2b
PROJECT(openvibe-ssvep-ng)
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/*.inl)
ADD_EXECUTABLE(${PROJECT_NAME} ${source_files})
INCLUDE("FindOpenViBE")
INCLUDE("FindOpenViBECommon")
INCLUDE("FindOpenViBEToolkit")
INCLUDE("FindOpenViBEModuleSystem")
INCLUDE("FindOpenViBEModuleEBML")
INCLUDE("FindOpenViBEModuleFS")
INCLUDE("FindThirdPartyCEGUI") # CEGUI + CEGUIOgreRender included
INCLUDE("FindThirdPartyVRPN")
INCLUDE("FindThirdPartyOgre3DTerrain") # OGRE + OIS included, pulls boost thread
INCLUDE("FindThirdPartyBoost") # Using Ogre headers on Win32 causes dependency to Boost thread library
INCLUDE("FindThirdPartyBoost_Thread") # Note that this is a potential issue on Windows, as the dependencies/ogre/boost and dependencies/boost are not the same at the time of writing this.
# ---------------------------------
# Finds standard library pthread
# Adds library to target
# Adds include path
# ---------------------------------
IF(UNIX)
FIND_LIBRARY(LIB_STANDARD_MODULE_PTHREAD pthread)
IF(LIB_STANDARD_MODULE_PTHREAD)
MESSAGE(STATUS " Found pthread...")
TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${LIB_STANDARD_MODULE_PTHREAD})
ELSE(LIB_STANDARD_MODULE_PTHREAD)
MESSAGE(STATUS " FAILED to find pthread...")
ENDIF(LIB_STANDARD_MODULE_PTHREAD)
ENDIF(UNIX)
# ---------------------------------
# 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("ov-ssvep-demo-impact-trainer" "impact-trainer")
OV_INSTALL_LAUNCH_SCRIPT("ov-ssvep-demo-impact-shooter" "impact-shooter")
OV_INSTALL_LAUNCH_SCRIPT("ov-ssvep-demo-generic" "generic")
# -----------------------------
# Install files
# -----------------------------
INSTALL(TARGETS ${PROJECT_NAME}
RUNTIME DESTINATION ${CMAKE_INSTALL_FULL_BINDIR}
LIBRARY DESTINATION DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR}
ARCHIVE DESTINATION DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR})
INSTALL(DIRECTORY share/ DESTINATION ${CMAKE_INSTALL_FULL_DATADIR}/openvibe/applications/ssvep-ng PATTERN ".svn" EXCLUDE)
INSTALL(DIRECTORY bci DESTINATION ${CMAKE_INSTALL_FULL_DATADIR}/openvibe/scenarios/ PATTERN ".svn" EXCLUDE)
#INSTALL(DIRECTORY src/ DESTINATION include FILES_MATCHING PATTERN "*.h" PATTERN ".svn" EXCLUDE PATTERN "doc" EXCLUDE)
This diff is collapsed.
# This file was automatically generated!
# If you want to change the SSVEP configuration
# please use the provided ssvep-configuration scenario.
SSVEP_ScreenRefreshRate = 60
SSVEP_VRPNServerPort = 1337
SSVEP_VRPNHost = localhost
SSVEP_Ogre_LogToConsole = False
SSVEP_Ogre_ScreenWidth = 800
SSVEP_Ogre_ScreenHeight = 600
SSVEP_Ogre_FullScreen = true
SSVEP_Frequency_1 = 5.45455
SSVEP_Frequency_2 = 6.6666
SSVEP_Frequency_3 = 7.5
SSVEP_TargetLightColourRed = 1.000000
SSVEP_TargetLightColourGreen = 0.000000
SSVEP_TargetLightColourBlue = 0.000000
SSVEP_TargetDarkColourRed = 0.100000
SSVEP_TargetDarkColourGreen = 0.000000
SSVEP_TargetDarkColourBlue = 0.000000
SSVEP_UserDataFolder = /opt/openvibe/externals/ssvep-ng/bci/ssvep-ng/signals/userdata-[2013.09.17-09.14.58]
SSVEP_FocusPoint = false
# This file was automatically generated!
# If you want to change the SSVEP trainer configuration
# please use the box settings in the training scenario.
SSVEP_TargetCount = 4
SSVEP_TargetWidth = 0.3
SSVEP_TargetHeight = 0.3
SSVEP_Target_X_0 = 0
SSVEP_Target_Y_0 = 0.5
SSVEP_Target_Material_0 = default
SSVEP_Target_X_1 = -0.6
SSVEP_Target_Y_1 = 0
SSVEP_Target_Material_1 = filled-red
SSVEP_Target_X_2 = 0
SSVEP_Target_Y_2 = 0
SSVEP_Target_Material_2 = filled-green
SSVEP_Target_X_3 = 0.6
SSVEP_Target_Y_3 = 0
SSVEP_Target_Material_3 = filled-blue
# This file was automatically generated!
# If you want to change the SSVEP trainer configuration
# please use the box settings in the training scenario.
SSVEP_TargetCount = 4
SSVEP_TargetWidth = 0.3
SSVEP_TargetHeight = 0.3
SSVEP_Target_X_0 = 0
SSVEP_Target_Y_0 = -0.5
SSVEP_Target_Material_0 = default
SSVEP_Target_X_1 = -0.6
SSVEP_Target_Y_1 = 0
SSVEP_Target_Material_1 = checkers-red
SSVEP_Target_X_2 = 0
SSVEP_Target_Y_2 = 0
SSVEP_Target_Material_2 = checkers-red
SSVEP_Target_X_3 = 0.6
SSVEP_Target_Y_3 = 0
SSVEP_Target_Material_3 = checkers-red
SSVEP_EnemyOrder = 4 5 6 4 5 6 4 5 6 4 5 6
SSVEP_TargetLockdown = true
SSVEP_PilotAssist = true
SSVEP_Feedback =
material target_bright
{
technique
{
pass
{
ambient 0 0 0 0
diffuse 0 0 0 0
specular 0 0 0 0
emissive 1 0 0
}
}
}
material target_dark
{
technique
{
pass
{
ambient 0 0 0 0
diffuse 0 0 0 0
specular 0 0 0 0
emissive 0.1 0 0
}
}
}
<OpenViBE-SettingsOverride>
<SettingValue>${Path_Samples}/bci/${SSVEP_ROOT}/scripts/configuration-experiment-settings.lua</SettingValue>
<SettingValue>0,0,100</SettingValue>
<SettingValue>0,0,0</SettingValue>
<SettingValue>20;15;12</SettingValue>
<SettingValue>0.5</SettingValue>
<SettingValue>0.1</SettingValue>
<SettingValue>0.250</SettingValue>
</OpenViBE-SettingsOverride>
\ No newline at end of file
<OpenViBE-SettingsOverride>
<SettingValue>99</SettingValue>
<SettingValue>Reject</SettingValue>
<SettingValue>Smart</SettingValue>
</OpenViBE-SettingsOverride>
<OpenViBE-SettingsOverride>
<SettingValue>OVTK_StimulationId_ExperimentStop</SettingValue>
<SettingValue>/opt/openvibe/dist/share/openvibe/scenarios/bci//classifiers/csp-1b</SettingValue>
<SettingValue>6</SettingValue>
</OpenViBE-SettingsOverride>
<OpenViBE-SettingsOverride>
<SettingValue>OVTK_StimulationId_ExperimentStop</SettingValue>
<SettingValue>/opt/openvibe/dist/share/openvibe/scenarios/bci//classifiers/csp-1h1</SettingValue>
<SettingValue>6</SettingValue>
</OpenViBE-SettingsOverride>
<OpenViBE-SettingsOverride>
<SettingValue>OVTK_StimulationId_ExperimentStop</SettingValue>
<SettingValue>/opt/openvibe/dist/share/openvibe/scenarios/bci//classifiers/csp-2b</SettingValue>
<SettingValue>6</SettingValue>
</OpenViBE-SettingsOverride>
<OpenViBE-SettingsOverride>
<SettingValue>OVTK_StimulationId_ExperimentStop</SettingValue>
<SettingValue>/opt/openvibe/dist/share/openvibe/scenarios/bci//classifiers/csp-2h1</SettingValue>
<SettingValue>6</SettingValue>
</OpenViBE-SettingsOverride>
<OpenViBE-SettingsOverride>
<SettingValue>OVTK_StimulationId_ExperimentStop</SettingValue>
<SettingValue>/opt/openvibe/dist/share/openvibe/scenarios/bci//classifiers/csp-3b</SettingValue>
<SettingValue>6</SettingValue>
</OpenViBE-SettingsOverride>
<OpenViBE-SettingsOverride>
<SettingValue>OVTK_StimulationId_ExperimentStop</SettingValue>
<SettingValue>/opt/openvibe/dist/share/openvibe/scenarios/bci//classifiers/csp-3h1</SettingValue>
<SettingValue>6</SettingValue>
</OpenViBE-SettingsOverride>
<OpenViBE-SettingsOverride>
<SettingValue>/opt/openvibe/openvibe-externals/ssvep-demo/trunc/share/openvibe-scenarios/bci/ssvep-demo/signals/ssvep-record-current.ov</SettingValue>
</OpenViBE-SettingsOverride>
<OpenViBE-SettingsOverride>
<SettingValue>/opt/openvibe/externals/ssvep-ng/bci/ssvep-ng/signals/ssvep-record-current.ov</SettingValue>
</OpenViBE-SettingsOverride>
<OpenViBE-SettingsOverride>
<SettingValue>/opt/openvibe/externals/ssvep-ng/bci/ssvep-ng/signals/ssvep-record-current.ov</SettingValue>
</OpenViBE-SettingsOverride>
<OpenViBE-SettingsOverride>
<SettingValue>/opt/openvibe/openvibe-externals/ssvep-demo/trunc/share/openvibe-scenarios/bci/ssvep-demo/signals/ssvep-record-current.ov</SettingValue>
</OpenViBE-SettingsOverride>
<OpenViBE-SettingsOverride>
<SettingValue>/opt/openvibe/externals/ssvep-ng/bci/ssvep-ng/signals/userdata-[2013.09.17-09.14.58]/eeg-data-[$core{date}-$core{time}].ov</SettingValue>
<SettingValue>false</SettingValue>
</OpenViBE-SettingsOverride>
KP_8 0x00008100 0x000081ff
KP_4 0x00008101 0x000081ff
KP_6 0x00008102 0x000081ff
s 0x00008001 0x00008001
d 0x00008002 0x00008002
f 0x0000800b 0x0000800b
g 0x0000800c 0x0000800c
<OpenViBE-SettingsOverride>
<SettingValue>7</SettingValue>
<SettingValue>1</SettingValue>
<SettingValue>OVTK_StimulationId_Target</SettingValue>
</OpenViBE-SettingsOverride>
<OpenViBE-SettingsOverride>
<SettingValue>Butterworth</SettingValue>
<SettingValue>Band pass</SettingValue>
<SettingValue>4</SettingValue>
<SettingValue>5.20455</SettingValue>
<SettingValue>5.70455</SettingValue>
<SettingValue>0.500000</SettingValue>
</OpenViBE-SettingsOverride>
<OpenViBE-SettingsOverride>
<SettingValue>Butterworth</SettingValue>
<SettingValue>Band pass</SettingValue>
<SettingValue>4</SettingValue>
<SettingValue>10.6591</SettingValue>
<SettingValue>11.1591</SettingValue>
<SettingValue>0.500000</SettingValue>
</OpenViBE-SettingsOverride>
<OpenViBE-SettingsOverride>
<SettingValue>Butterworth</SettingValue>
<SettingValue>Band pass</SettingValue>
<SettingValue>4</SettingValue>
<SettingValue>6.4166</SettingValue>
<SettingValue>6.9166</SettingValue>
<SettingValue>0.500000</SettingValue>
</OpenViBE-SettingsOverride>
<OpenViBE-SettingsOverride>
<SettingValue>Butterworth</SettingValue>
<SettingValue>Band pass</SettingValue>
<SettingValue>4</SettingValue>
<SettingValue>13.0832</SettingValue>
<SettingValue>13.5832</SettingValue>
<SettingValue>0.500000</SettingValue>
</OpenViBE-SettingsOverride>
<OpenViBE-SettingsOverride>
<SettingValue>Butterworth</SettingValue>
<SettingValue>Band pass</SettingValue>
<SettingValue>4</SettingValue>
<SettingValue>7.25</SettingValue>
<SettingValue>7.75</SettingValue>
<SettingValue>0.500000</SettingValue>
</OpenViBE-SettingsOverride>
<OpenViBE-SettingsOverride>
<SettingValue>Butterworth</SettingValue>
<SettingValue>Band pass</SettingValue>
<SettingValue>4</SettingValue>
<SettingValue>14.75</SettingValue>
<SettingValue>15.25</SettingValue>
<SettingValue>0.500000</SettingValue>
</OpenViBE-SettingsOverride>
<OpenViBE-SettingsOverride>
<SettingValue>1</SettingValue>
<SettingValue>0.1</SettingValue>
</OpenViBE-SettingsOverride>
<OpenViBE-SettingsOverride>
<SettingValue>${Path_Samples}/bci/${SSVEP_ROOT}/scripts/configuration-experiment-settings.lua</SettingValue>
<SettingValue>0,0,50</SettingValue>
<SettingValue>0,0,0</SettingValue>
<SettingValue>20;15;12</SettingValue>
<SettingValue>0.5</SettingValue>
<SettingValue>0.1</SettingValue>
<SettingValue>0.250</SettingValue>
</OpenViBE-SettingsOverride>
\ No newline at end of file
<OpenViBE-SettingsOverride>
<SettingValue>${Path_Samples}/bci/${SSVEP_ROOT}/scripts/configuration-experiment-settings.lua</SettingValue>
<SettingValue>50,0,0</SettingValue>
<SettingValue>0,0,0</SettingValue>
<SettingValue>20;15;12</SettingValue>
<SettingValue>0.5</SettingValue>
<SettingValue>0.1</SettingValue>
<SettingValue>0.250</SettingValue>
</OpenViBE-SettingsOverride>
\ No newline at end of file
<OpenViBE-SettingsOverride>
<SettingValue>${Path_Samples}/bci/${SSVEP_ROOT}/scripts/configuration-experiment-settings.lua</SettingValue>
<SettingValue>100,0,0</SettingValue>
<SettingValue>0,0,0</SettingValue>
<SettingValue>20;15;12</SettingValue>
<SettingValue>0.5</SettingValue>
<SettingValue>0.1</SettingValue>
<SettingValue>0.250</SettingValue>
</OpenViBE-SettingsOverride>
\ No newline at end of file
flip_count = 0
switched_flip_count = 0
flips = {}
function initialize(box)
dofile(box:get_config("${Path_Data}") .. "/plugins/stimulation/lua-stimulator-stim-codes.lua")
flip_count = box:get_input_count()
for i = 1, flip_count do
flips[i] = false
end
end
function uninitialize(box)
end
function process(box)
while switched_flip_count < flip_count do
for i = 1, flip_count do
if box:get_stimulation_count(i) > 0 then
box:remove_stimulation(i, 1)
if not flips[i] then
switched_flip_count = switched_flip_count + 1
flips[i] = true
io.write("Flip ", i, " of ", flip_count, " switched\n")
end
end
end
box:sleep()
end
box:send_stimulation(1, OVTK_StimulationId_Label_00, box:get_current_time())
end
targets = {}
non_targets = {}
sent_stimulation = 0
function initialize(box)
dofile(box:get_config("${Path_Data}") .. "/plugins/stimulation/lua-stimulator-stim-codes.lua")
-- read the parameters of the box
s_targets = box:get_setting(2)
for t in s_targets:gmatch("%d+") do
targets[t + 0] = true
end
s_non_targets = box:get_setting(3)
for t in s_non_targets:gmatch("%d+") do
non_targets[t + 0] = true
end
sent_stimulation = _G[box:get_setting(4)]
end
function uninitialize(box)
end
function process(box)
finished = false
while not finished do
time = box:get_current_time()
while box:get_stimulation_count(1) > 0 do
s_code, s_date, s_duration = box:get_stimulation(1, 1)
box:remove_stimulation(1, 1)
if s_code >= OVTK_StimulationId_Label_00 and s_code <= OVTK_StimulationId_Label_1F then
received_stimulation = s_code - OVTK_StimulationId_Label_00
if targets[received_stimulation] ~= nil then
box:send_stimulation(1, sent_stimulation, time)
elseif non_targets[received_stimulation] ~= nil then
box:send_stimulation(2, sent_stimulation, time)
end
elseif s_code == OVTK_StimulationId_ExperimentStop then
finished = true
end
end
box:sleep()
end
end
channels = nil
selection_method = nil
match_method = nil
training_datafile = nil
testing_datafile = nil
function initialize(box)
dofile(box:get_config("${Path_Data}") .. "/plugins/stimulation/lua-stimulator-stim-codes.lua")
channels = box:get_setting(2)
selection_method = box:get_setting(3)
match_method = box:get_setting(4)
training_datafile = box:get_setting(5)
testing_datafile = box:get_setting(6)
end
function uninitialize(box)
end
function process(box)
while box:get_stimulation_count(1) == 0 do
box:sleep()
end
-- create material
box:log("Info", box:get_config("Writing file '${__volatile_ScenarioDir}/configuration/channel-selector.cfg'"))
cfg_file = io.open(box:get_config("${__volatile_ScenarioDir}/configuration/channel-selector.cfg"), "w")
if cfg_file == nil then
box:log("Error", "Could not open config file for writing")
end
cfg_file:write("<OpenViBE-SettingsOverride>\n")
cfg_file:write(string.format("<SettingValue>%s</SettingValue>\n", channels))
cfg_file:write(string.format("<SettingValue>%s</SettingValue>\n", selection_method))
cfg_file:write(string.format("<SettingValue>%s</SettingValue>\n", match_method))
cfg_file:write("</OpenViBE-SettingsOverride>\n")
cfg_file:close()
box:log("Info", box:get_config("Writing file '${__volatile_ScenarioDir}/configuration/file-reader-training.cfg'"))
cfg_file = io.open(box:get_config("${__volatile_ScenarioDir}/configuration/file-reader-training.cfg"), "w")
cfg_file:write("<OpenViBE-SettingsOverride>\n")
cfg_file:write(string.format("<SettingValue>%s</SettingValue>\n", training_datafile))
-- cfg_file:write(string.format("<SettingValue>32</SettingValue>\n"))
cfg_file:write("</OpenViBE-SettingsOverride>\n")
cfg_file:close()
box:log("Info", box:get_config("Writing file '${__volatile_ScenarioDir}/configuration/file-reader-testing.cfg'"))
cfg_file = io.open(box:get_config("${__volatile_ScenarioDir}/configuration/file-reader-testing.cfg"), "w")
cfg_file:write("<OpenViBE-SettingsOverride>\n")
cfg_file:write(string.format("<SettingValue>%s</SettingValue>\n", testing_datafile))
-- cfg_file:write(string.format("<SettingValue>32</SettingValue>\n"))
cfg_file:write("</OpenViBE-SettingsOverride>\n")
cfg_file:close()
-- notify the scenario that the configuration process is complete
box:send_stimulation(1, OVTK_StimulationId_TrainCompleted, box:get_current_time() + 0.2, 0)
end
stimulation_frequencies = {}
frequency_count = 0
target_light_color = {}
target