Commit f3e8026e authored by nfoy's avatar nfoy

Merge branch 'integration-1.2' of...

Merge branch 'integration-1.2' of git+ssh://scm.gforge.inria.fr/gitroot/openvibe/openvibe into integration-1.2
parents 901ca9a0 e2fbd6e5
......@@ -541,7 +541,7 @@ void CConfigurationBuilder::buttonChangeChannelNamesCB(void)
::GtkWidget* l_pWidgetDialogOpen=gtk_file_chooser_dialog_new(
"Select file to save to...",
NULL,
GTK_FILE_CHOOSER_ACTION_OPEN,
GTK_FILE_CHOOSER_ACTION_SAVE,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT,
NULL);
......
......@@ -9,6 +9,7 @@
#include <cmath> // std::abs
#include <sstream>
#include <iomanip>
#include <algorithm> // std::min, std::max
#define boolean OpenViBE::boolean
......
......@@ -461,6 +461,30 @@ CInterfacedScenario::CInterfacedScenario(const IKernelContext& rKernelContext, C
m_pTooltip=GTK_WIDGET(gtk_builder_get_object(m_pBuilderTooltip, "tooltip"));
gtk_widget_set_name(m_pTooltip, "gtk-tooltips");
// Output a log message if any box of the scenario is in some special state
CIdentifier l_oBoxIdentifier = OV_UndefinedIdentifier;
boolean l_bWarningUpdate = false, l_bWarningDeprecated = false, l_bNoteUnstable = false;
while ((l_oBoxIdentifier = m_rScenario.getNextBoxIdentifier(l_oBoxIdentifier)) != OV_UndefinedIdentifier)
{
const IBox *l_pBox = m_rScenario.getBoxDetails(l_oBoxIdentifier);
const CBoxProxy l_oBoxProxy(m_rKernelContext, *l_pBox);
if (!l_bWarningUpdate && !l_oBoxProxy.isUpToDate())
{
m_rKernelContext.getLogManager() << LogLevel_Warning << "Scenario requires 'update' of some box(es). You need to replace these boxes or the scenario may not work correctly.\n";
l_bWarningUpdate = true;
}
if (!l_bWarningDeprecated && l_oBoxProxy.isDeprecated())
{
m_rKernelContext.getLogManager() << LogLevel_Warning << "Scenario has deprecated box(es). Please consider using other boxes instead.\n";
l_bWarningDeprecated = true;
}
if (!l_bNoteUnstable && l_oBoxProxy.isUnstable())
{
m_rKernelContext.getLogManager() << LogLevel_Debug << "Scenario has unstable box(es).\n";
l_bNoteUnstable = true;
}
}
}
CInterfacedScenario::~CInterfacedScenario(void)
......
......@@ -437,7 +437,7 @@ OpenViBE::boolean parse_arguments(int argc, char** argv, SConfiguration& rConfig
int go(int argc, char ** argv)
{
OpenViBE::boolean errorWhileLoadingScenario = false;
OpenViBE::boolean l_bErrorWhileLoadingScenario = false;
/*
{ 0, 0, 0, 0 },
{ 0, 16383, 16383, 16383 },
......@@ -636,6 +636,9 @@ int go(int argc, char ** argv)
}
}
}
OpenViBE::boolean l_bPlayRequested = false;
std::map < ECommandLineFlag, std::string >::iterator it;
for(it=l_oConfiguration.m_oFlag.begin(); it!=l_oConfiguration.m_oFlag.end(); it++)
{
......@@ -644,27 +647,29 @@ int go(int argc, char ** argv)
{
case CommandLineFlag_Open:
l_rLogManager << LogLevel_Info << "Opening scenario [" << CString(it->second.c_str()) << "]\n";
app.openScenario(it->second.c_str());
if (!app.openScenario(it->second.c_str()))
{
l_rLogManager << LogLevel_Error << "Scenario open error.\n";
l_bErrorWhileLoadingScenario = true;
}
break;
case CommandLineFlag_Play:
l_rLogManager << LogLevel_Info << "Opening and playing scenario [" << CString(it->second.c_str()) << "]\n";
if(app.openScenario(it->second.c_str()))
if(!app.openScenario(it->second.c_str()) || !app.playScenarioCB()) // lazy eval
{
if(!app.playScenarioCB())
{
errorWhileLoadingScenario = true;
}
l_rLogManager << LogLevel_Error << "Scenario open or load error with --play.\n";
l_bErrorWhileLoadingScenario = true;
}
l_bPlayRequested = true;
break;
case CommandLineFlag_PlayFast:
l_rLogManager << LogLevel_Info << "Opening and fast playing scenario [" << CString(it->second.c_str()) << "]\n";
if(app.openScenario(it->second.c_str()))
if(!app.openScenario(it->second.c_str()) || !app.forwardScenarioCB()) // lazy eval
{
if(!app.forwardScenarioCB())
{
errorWhileLoadingScenario = true;
}
l_rLogManager << LogLevel_Error << "Scenario open or load error with --play-fast.\n";
l_bErrorWhileLoadingScenario = true;
}
l_bPlayRequested = true;
break;
// case CommandLineFlag_Define:
// break;
......@@ -672,6 +677,12 @@ int go(int argc, char ** argv)
break;
}
}
if(!l_bPlayRequested && l_oConfiguration.m_eNoGui == CommandLineFlag_NoGui)
{
l_rLogManager << LogLevel_Info << "Switch --no-gui is enabled but no play operation was requested. Designer will exit automatically.\n";
}
if(app.m_vInterfacedScenario.empty())
{
app.newScenarioCB();
......@@ -697,6 +708,7 @@ int go(int argc, char ** argv)
{
l_pKernelContext->getLogManager() << LogLevel_Fatal << "Catched top level exception\n";
}
}
}
......@@ -710,7 +722,7 @@ int go(int argc, char ** argv)
l_oKernelLoader.uninitialize();
l_oKernelLoader.unload();
}
if(errorWhileLoadingScenario && l_oConfiguration.m_eNoGui == CommandLineFlag_NoGui)
if(l_bErrorWhileLoadingScenario && l_oConfiguration.m_eNoGui == CommandLineFlag_NoGui)
{
return -1;
}
......
......@@ -3,34 +3,47 @@
# Adds a def that its present
# ---------------------------------
FIND_PATH(PATH_BOOST_CHRONO "include/boost/chrono.hpp" PATHS ${OV_CUSTOM_DEPENDENCIES_PATH}/boost ${OV_CUSTOM_DEPENDENCIES_PATH} NO_DEFAULT_PATH)
FIND_PATH(PATH_BOOST_CHRONO "include/boost/chrono.hpp" PATHS ${OV_CUSTOM_DEPENDENCIES_PATH}/boost)
IF(PATH_BOOST_CHRONO)
MESSAGE(STATUS " Found boost chrono includes...")
ADD_DEFINITIONS(-DTARGET_HAS_Boost_Chrono)
FIND_LIBRARY(LIB_Boost_Chrono NAMES "boost_chrono" PATHS ${OV_CUSTOM_DEPENDENCIES_PATH}/lib NO_DEFAULT_PATH)
FIND_LIBRARY(LIB_Boost_Chrono NAMES "boost_chrono" PATHS ${OV_CUSTOM_DEPENDENCIES_PATH}/lib)
IF(LIB_Boost_Chrono)
MESSAGE(STATUS " [ OK ] lib ${LIB_Boost_Chrono}")
TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${LIB_Boost_Chrono})
ELSE(LIB_Boost_Chrono)
MESSAGE(STATUS " [FAILED] lib boost_chrono")
ENDIF(LIB_Boost_Chrono)
TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${LIB_Boost_Chrono})
# Fedora / Ubuntu
FIND_LIBRARY(LIB_STANDARD_MODULE_RT rt)
IF(LIB_STANDARD_MODULE_RT)
MESSAGE(STATUS " Found rt...")
TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${LIB_STANDARD_MODULE_RT})
ELSE(LIB_STANDARD_MODULE_RT)
MESSAGE(STATUS " FAILED to find rt...")
ENDIF(LIB_STANDARD_MODULE_RT)
ELSE(PATH_BOOST_CHRONO)
MESSAGE(STATUS " FAILED to find boost chrono includes...")
ENDIF(PATH_BOOST_CHRONO)
IF(WIN32)
FIND_PATH(PATH_BOOST_CHRONO "include/boost/chrono.hpp" PATHS ${OV_CUSTOM_DEPENDENCIES_PATH}/boost ${OV_CUSTOM_DEPENDENCIES_PATH} NO_DEFAULT_PATH)
IF(PATH_BOOST_CHRONO)
MESSAGE(STATUS " Found boost chrono includes...")
OV_LINK_BOOST_LIB("chrono" ${OV_WIN32_BOOST_VERSION} )
IF(LIB_BOOST_PATH AND LIB_BOOST_DEBUG_PATH)
ADD_DEFINITIONS(-DTARGET_HAS_Boost_Chrono)
ENDIF(LIB_BOOST_PATH AND LIB_BOOST_DEBUG_PATH)
ENDIF(PATH_BOOST_CHRONO)
ENDIF(WIN32)
IF(UNIX)
FIND_PATH(PATH_BOOST_CHRONO "include/boost/chrono.hpp" PATHS ${OV_CUSTOM_DEPENDENCIES_PATH}/boost ${OV_CUSTOM_DEPENDENCIES_PATH} NO_DEFAULT_PATH)
FIND_PATH(PATH_BOOST_CHRONO "include/boost/chrono.hpp" PATHS ${OV_CUSTOM_DEPENDENCIES_PATH}/boost)
IF(PATH_BOOST_CHRONO)
MESSAGE(STATUS " Found boost chrono includes...")
FIND_LIBRARY(LIB_Boost_Chrono NAMES "boost_chrono" PATHS ${OV_CUSTOM_DEPENDENCIES_PATH}/lib NO_DEFAULT_PATH)
FIND_LIBRARY(LIB_Boost_Chrono NAMES "boost_chrono" PATHS ${OV_CUSTOM_DEPENDENCIES_PATH}/lib)
IF(LIB_Boost_Chrono)
MESSAGE(STATUS " [ OK ] lib ${LIB_Boost_Chrono}")
ADD_DEFINITIONS(-DTARGET_HAS_Boost_Chrono)
TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${LIB_Boost_Chrono})
ELSE(LIB_Boost_Chrono)
MESSAGE(STATUS " [FAILED] lib boost_chrono")
ENDIF(LIB_Boost_Chrono)
# Fedora / Ubuntu
FIND_LIBRARY(LIB_STANDARD_MODULE_RT rt)
IF(LIB_STANDARD_MODULE_RT)
MESSAGE(STATUS " Found rt...")
TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${LIB_STANDARD_MODULE_RT})
ELSE(LIB_STANDARD_MODULE_RT)
MESSAGE(STATUS " FAILED to find rt...")
ENDIF(LIB_STANDARD_MODULE_RT)
ELSE(PATH_BOOST_CHRONO)
MESSAGE(STATUS " FAILED to find boost chrono includes...")
ENDIF(PATH_BOOST_CHRONO)
ENDIF(UNIX)
......@@ -99,7 +99,7 @@ void CConfigurationGTecGUSBampLinux::UpdateFilters(void)
gt_size l_ui32SampleRate = (gt_size)strtol(gtk_combo_box_get_active_text(l_pComboBoxSamplingFrequency),NULL,10);
// This takes a while so we'll keep the user informed via the console - might have to put this in a thread at some point though
m_rDriverContext.getLogManager() << LogLevel_Info << "Opening device...\n";
m_rDriverContext.getLogManager() << LogLevel_Info << "Opening device [" << l_pDeviceName << "] to query filters ...\n";
// Try opening the device
if(GT_OpenDevice(l_pDeviceName))
......@@ -404,7 +404,7 @@ void CConfigurationGTecGUSBampLinux::OnButtonCheckImpedanceClicked()
char* l_pDeviceName = gtk_combo_box_get_active_text(l_pComboBoxDevice);
// This takes a while so we'll keep the user informed via the console - might have to put this in a thread at some point though
m_rDriverContext.getLogManager() << LogLevel_Info << "Opening device...\n";
m_rDriverContext.getLogManager() << LogLevel_Info << "Opening device [" << l_pDeviceName << "] for impedance check ...\n";
// Try opening the device
if(GT_OpenDevice(l_pDeviceName))
......@@ -595,7 +595,6 @@ boolean CConfigurationGTecGUSBampLinux::postConfigure(void)
m_pConfig->bandpass[i] = l_ui32Value;
}
}
if(!CConfigurationBuilder::postConfigure()) // normal header is filled (Subject ID, Age, Gender, channels, sampling frequency), ressources are realesed
return false;
......
......@@ -24,6 +24,7 @@ CDriverGTecGUSBampLinux::CDriverGTecGUSBampLinux(IDriverContext& rDriverContext)
m_ui32CurrentSample(0),
m_ui32CurrentChannel(0)
{
// Default values
m_oHeader.setSamplingFrequency(512);
m_oHeader.setChannelCount(16);
......@@ -37,9 +38,6 @@ CDriverGTecGUSBampLinux::CDriverGTecGUSBampLinux(IDriverContext& rDriverContext)
m_oAnalogOutConfig.amplitude = 0;
m_oAnalogOutConfig.offset = 0;
// Set the sampling rate
m_oConfig.sample_rate = 512;
// This pretty much has to be GT_NOS_AUTOSET, don't know why, so says the documentation
m_oConfig.number_of_scans = GT_NOS_AUTOSET;
// Disable the trigger line, digital io scan, slave mode and the shortcut
......@@ -48,9 +46,6 @@ CDriverGTecGUSBampLinux::CDriverGTecGUSBampLinux(IDriverContext& rDriverContext)
// Set the mode to just take readings
m_oConfig.mode = GT_MODE_NORMAL;
// Number of channels to read from
m_oConfig.num_analog_in = m_oHeader.getChannelCount();
// Set all the blocks A-D to use the common ground and reference voltages
for (unsigned int i = 0; i < GT_USBAMP_NUM_GROUND; i++)
{
......@@ -59,7 +54,7 @@ CDriverGTecGUSBampLinux::CDriverGTecGUSBampLinux(IDriverContext& rDriverContext)
}
// Configure each input
for (unsigned char i = 0; i < m_oConfig.num_analog_in; i++)
for (unsigned char i = 0; i < GT_USBAMP_NUM_ANALOG_IN; i++)
{
// Should be from 1 - 16, specifies which channel to observe as input i
m_oConfig.analog_in_channel[i] = i + 1;
......@@ -89,6 +84,7 @@ CDriverGTecGUSBampLinux::CDriverGTecGUSBampLinux(IDriverContext& rDriverContext)
GT_FreeDeviceList(l_pDeviceList,l_ui32ListSize);
// Now retrieve all those configs from the settings file if they are there to be found (don't need to worry about sample rate or channel number though since they're already in the header)
m_oSettings.add("Header", &m_oHeader);
m_oSettings.add("DeviceName", (string*)&m_oDeviceName);
m_oSettings.add("Mode", (int*)&m_oConfig.mode);
m_oSettings.add("EnableTrigger", (bool*)&m_oConfig.enable_trigger_line);
......@@ -111,7 +107,7 @@ CDriverGTecGUSBampLinux::CDriverGTecGUSBampLinux(IDriverContext& rDriverContext)
}
// Configure each input
for (unsigned int i = 0; i < m_oConfig.num_analog_in; i++)
for (unsigned int i = 0; i < GT_USBAMP_NUM_ANALOG_IN; i++)
{
stringstream l_oBandpassConfigName, l_oNotchConfigName, l_oBipolarConfigName;
l_oBandpassConfigName << "Bandpass" << i;
......@@ -122,7 +118,15 @@ CDriverGTecGUSBampLinux::CDriverGTecGUSBampLinux(IDriverContext& rDriverContext)
m_oSettings.add(l_oBipolarConfigName.str().c_str(), (int*)&m_oConfig.bipolar[i]);
}
m_oSettings.load();
// This restores saved settings if any, such as sampling rate
m_oSettings.load();
// Set the sampling rate that may have been changed by load
m_oConfig.sample_rate = m_oHeader.getSamplingFrequency();
// Number of channels that may have been changed by load
m_oConfig.num_analog_in = m_oHeader.getChannelCount();
}
CDriverGTecGUSBampLinux::~CDriverGTecGUSBampLinux(void)
......@@ -145,7 +149,8 @@ boolean CDriverGTecGUSBampLinux::initialize(const uint32 ui32SampleCountPerSentB
// If the scan digital inputs flag is set, the API will return one extra channel outside of the analog data requested, so we need to match that on the header
if(m_oConfig.scan_dio == GT_TRUE)
{
m_oHeader.setChannelCount(m_oHeader.getChannelCount() + 1);
m_oHeader.setChannelCount(m_oConfig.num_analog_in + 1);
m_oHeader.setChannelName(m_oConfig.num_analog_in, "Digital");
}
// Allocate buffers for...
......@@ -320,7 +325,10 @@ boolean CDriverGTecGUSBampLinux::configure(void)
return false;
}
m_oSettings.save();
m_oHeader.setChannelCount(m_oConfig.num_analog_in);
m_oHeader.setSamplingFrequency(m_oConfig.sample_rate);
m_oSettings.save();
return true;
}
......
......@@ -157,6 +157,7 @@ boolean CBox::setAlgorithmClassIdentifier(
CBoxListenerContext l_oContext(this->getKernelContext(), *this, 0xffffffff);
m_pBoxListener->uninitialize(l_oContext);
m_pBoxAlgorithmDescriptor->releaseBoxListener(m_pBoxListener);
m_pBoxListener = NULL;
}
const IPluginObjectDesc* l_pPluginObjectDescriptor=getKernelContext().getPluginManager().getPluginObjectDescCreating(rAlgorithmClassIdentifier);
......@@ -1020,6 +1021,7 @@ void CBox::clear(void)
CBoxListenerContext l_oContext(this->getKernelContext(), *this, 0xffffffff);
m_pBoxListener->uninitialize(l_oContext);
m_pBoxAlgorithmDescriptor->releaseBoxListener(m_pBoxListener);
m_pBoxListener = NULL;
}
m_pBoxAlgorithmDescriptor=NULL;
......
......@@ -89,7 +89,7 @@ boolean CAlgorithmClassifierOneVsAll::train(const IFeatureVectorSet& rFeatureVec
}
//And then we just change adapt the label for each feature vector but we don't copy them anymore
for(size_t l_iClassifierCounter = 0 ; l_iClassifierCounter < m_oSubClassifierList.size() ; ++l_iClassifierCounter )
for(uint32 l_iClassifierCounter = 0 ; l_iClassifierCounter < static_cast<uint32>(m_oSubClassifierList.size()) ; ++l_iClassifierCounter )
{
TParameterHandler < IMatrix* > ip_pFeatureVectorSet(m_oSubClassifierList[l_iClassifierCounter]->getInputParameter(OVTK_Algorithm_Classifier_InputParameterId_FeatureVectorSet));
ip_pFeatureVectorSet = (IMatrix*)ip_pFeatureVectorSetReference;
......@@ -121,7 +121,7 @@ boolean CAlgorithmClassifierOneVsAll::classify(const IFeatureVector& rFeatureVec
const uint32 l_ui32FeatureVectorSize=rFeatureVector.getSize();
for(uint64 l_iClassifierCounter = 0 ; l_iClassifierCounter < m_oSubClassifierList.size() ; ++l_iClassifierCounter )
for(uint32 l_iClassifierCounter = 0 ; l_iClassifierCounter < static_cast<uint32>(m_oSubClassifierList.size()) ; ++l_iClassifierCounter )
{
IAlgorithmProxy* l_pSubClassifier = this->m_oSubClassifierList[l_iClassifierCounter];
TParameterHandler < IMatrix* > ip_pFeatureVector(l_pSubClassifier->getInputParameter(OVTK_Algorithm_Classifier_InputParameterId_FeatureVector));
......
......@@ -24,8 +24,8 @@ INCLUDE("FindThirdPartyEigen")
INCLUDE("FindThirdPartyFFTW3") # used by the wavelet library
INCLUDE("FindThirdPartyITPP") # note that itpp gives the fftw3 on Win
#for additionnal coadapt plugins, the following
INCLUDE("FindThirdPartyBoost_Math")
INCLUDE("FindOpenViBEModuleXML")
# INCLUDE("FindThirdPartyBoost_Math")
# INCLUDE("FindOpenViBEModuleXML")
# ---------------------------------
# Target macros
......
#!/bin/bash
#
# This script tries to locate boxes in scenarios which need to be updated
#
# Assumes openvibe is compiled and installed to dist/, and that we are in test/
#
SYSTEM=`uname -o`
if [ $SYSTEM == "Cygwin" ]; then
EXT="cmd"
else
EXT="sh"
fi
pushd .. >/dev/null
echo Scenarios requiring update:
find -iname "*xml" | grep "box-tutorials/\|test/\|bci-examples/" | grep -v dist | while read FN; do
dist/openvibe-designer.$EXT --no-session-management --no-pause --no-gui --open "$FN" | grep -q -E ".*WARNING.*Scenario requires.*update.*box"
if [ $? == 0 ]; then
echo $FN
fi
done
popd >/dev/null
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment