Mentions légales du service

Skip to content
Snippets Groups Projects
Commit d189b186 authored by nfoy's avatar nfoy
Browse files

Merge branch 'release-1.2.1-bugfixes' of...

Merge branch 'release-1.2.1-bugfixes' of git+ssh://scm.gforge.inria.fr/gitroot/openvibe/openvibe into release-1.2.1-bugfixes
parents 1b38283c 9d7470ff
Branches
Tags
No related merge requests found
...@@ -253,8 +253,9 @@ bool CImpactApplication::enemyDestroyed(CImpactEnemyShip* es) ...@@ -253,8 +253,9 @@ bool CImpactApplication::enemyDestroyed(CImpactEnemyShip* es)
void CImpactApplication::calculateFeedback(int iChannelCount, double *pChannel) void CImpactApplication::calculateFeedback(int iChannelCount, double *pChannel)
{ {
const int l_iNChannels = 3;
static int l_iSkipControl = 0; static int l_iSkipControl = 0;
static int l_vPreviousLevels[3] = {0, 0, 0}; static int l_vPreviousLevels[l_iNChannels] = { 0, 0, 0 };
if (l_iSkipControl < 2) if (l_iSkipControl < 2)
{ {
...@@ -266,29 +267,45 @@ void CImpactApplication::calculateFeedback(int iChannelCount, double *pChannel) ...@@ -266,29 +267,45 @@ void CImpactApplication::calculateFeedback(int iChannelCount, double *pChannel)
l_iSkipControl = 0; l_iSkipControl = 0;
} }
double l_vFeedback[l_iNChannels];
if (iChannelCount == 6)
{
// Assume input is layered like [prob1pos,prop1neg,prop2pos,prop2neg,prop3pos,prop3neg];
l_vFeedback[0] = pChannel[0];
l_vFeedback[1] = pChannel[2];
l_vFeedback[2] = pChannel[4];
}
else if (iChannelCount == 3)
{
// Assume input is layered like [prob1,prob2,prob3]
l_vFeedback[0] = pChannel[0];
l_vFeedback[1] = pChannel[1];
l_vFeedback[2] = pChannel[2];
}
else
{
this->getLogManager() << LogLevel_Error << "Incorrect analog VRPN input with " << iChannelCount << " channels. This will not work.\n";
l_vFeedback[0] = 0;
l_vFeedback[1] = 0;
l_vFeedback[2] = 0;
}
if (m_poAdvancedControl != NULL) if (m_poAdvancedControl != NULL)
{ {
m_poAdvancedControl->processFrame(pChannel[0], pChannel[1], pChannel[2]); m_poAdvancedControl->processFrame(l_vFeedback[0], l_vFeedback[1], l_vFeedback[2]);
} }
int l_vLevel[3]; int l_vLevel[l_iNChannels];
// @FIXME bad, modifying non-ref input parameter
if(iChannelCount!=3) {
getLogManager() << LogLevel_Warning << "Changing iChannelCount from " << iChannelCount << " to 3\n";
}
iChannelCount = 3;
//std::cout << "feedback: "; //std::cout << "feedback: ";
for (int i = 0; i < iChannelCount; i++) for (int i = 0; i < l_iNChannels; i++)
{ {
if (pChannel[i] > m_pMaxFeedbackLevel[i]) if (l_vFeedback[i] > m_pMaxFeedbackLevel[i])
{ {
m_pMaxFeedbackLevel[i] += 0.1; m_pMaxFeedbackLevel[i] += 0.1;
} }
float64 l_f64CLevel = pChannel[i] / m_pMaxFeedbackLevel[i]; float64 l_f64CLevel = l_vFeedback[i] / m_pMaxFeedbackLevel[i];
//std::cout << cLevel << ", "; //std::cout << cLevel << ", ";
l_vLevel[i] = 0; l_vLevel[i] = 0;
......
<OpenViBE-Classifier-Box XMLVersion="3"> <OpenViBE-Classifier-Box Creator="OpenViBE" CreatorVersion="1.2.1+git" FormatVersion="4">
<Strategy-Identifier class-id="(0xffffffff, 0xffffffff)">Native</Strategy-Identifier> <Strategy-Identifier class-id="(0xffffffff, 0xffffffff)">Native</Strategy-Identifier>
<Algorithm-Identifier class-id="(0x2ba17a3c, 0x1bd46d84)">Linear Discrimimant Analysis (LDA)</Algorithm-Identifier> <Algorithm-Identifier class-id="(0x2ba17a3c, 0x1bd46d84)">Linear Discrimimant Analysis (LDA)</Algorithm-Identifier>
<Stimulations> <Stimulations>
<Class-Stimulation class-id="1">OVTK_GDF_Left</Class-Stimulation> <Class-Stimulation class-id="0">OVTK_GDF_Left</Class-Stimulation>
<Class-Stimulation class-id="2">OVTK_GDF_Right</Class-Stimulation> <Class-Stimulation class-id="1">OVTK_GDF_Right</Class-Stimulation>
</Stimulations> </Stimulations>
<OpenViBE-Classifier> <OpenViBE-Classifier>
<LDA> <LDA version="1">
<Classes>1 2</Classes> <Classes>0 1 </Classes>
<Weights>4.852093e+00 -5.293004e+00</Weights> <Class-config-list>
<Bias-distance>1.228474e+00</Bias-distance> <Class-config>
<Coefficient-probability>1.228474e+00</Coefficient-probability> <Weights> 2.318337e+001 1.028989e+001</Weights>
<Bias>-26.1985</Bias>
</Class-config>
<Class-config>
<Weights> 2.036666e+001 1.336324e+001</Weights>
<Bias>-27.024</Bias>
</Class-config>
</Class-config-list>
</LDA> </LDA>
</OpenViBE-Classifier> </OpenViBE-Classifier>
</OpenViBE-Classifier-Box> </OpenViBE-Classifier-Box>
\ No newline at end of file
...@@ -157,8 +157,12 @@ bool CHandballBCI::process(double timeSinceLastProcess) ...@@ -157,8 +157,12 @@ bool CHandballBCI::process(double timeSinceLastProcess)
{ {
std::list < double >& l_rVrpnAnalogState=m_poVrpnPeripheral->m_vAnalog.front(); std::list < double >& l_rVrpnAnalogState=m_poVrpnPeripheral->m_vAnalog.front();
//we take the last value from the server //we take the last value from the server.
double l_dAnalog=*(l_rVrpnAnalogState.begin()); // The input is a probability [0,1] for the left class, map it to [-1,1] to indicate [left,right] range
double l_dAnalog = (*l_rVrpnAnalogState.begin());
l_dAnalog = 2.0*(-l_dAnalog) + 1.0;
// std::cout << "list size" << l_rVrpnAnalogState.size() << " head " << l_dAnalog << "\n";
//we updtae the max and min values //we updtae the max and min values
// A. VLG : we should compute the min/max only in the ACTIVE phase // A. VLG : we should compute the min/max only in the ACTIVE phase
...@@ -218,9 +222,9 @@ bool CHandballBCI::process(double timeSinceLastProcess) ...@@ -218,9 +222,9 @@ bool CHandballBCI::process(double timeSinceLastProcess)
{ {
case Phase_Rest: case Phase_Rest:
std::cout << "### PHASE REST ###" <<std::endl; std::cout << "### PHASE REST ###" <<std::endl;
if(m_iLastMark==Mark_Left && m_fBallPosition<0) { m_iLeftScore++;} if(m_iLastMark==Mark_Left && m_fBallPosition>0) { m_iLeftScore++;}
if(m_iLastMark==Mark_Right&& m_fBallPosition>0) { m_iRightScore++;} if(m_iLastMark==Mark_Right&& m_fBallPosition<0) { m_iRightScore++;}
std::cout << "- Current Score: " <<std::endl; std::cout << "- Current Score: " <<std::endl;
std::cout << "--- GOAL: " <<m_iGoalScore<<"/"<<(m_iTrialRightCount+m_iTrialLeftCount)<<std::endl; std::cout << "--- GOAL: " <<m_iGoalScore<<"/"<<(m_iTrialRightCount+m_iTrialLeftCount)<<std::endl;
std::cout << "--- LEFT: " <<m_iLeftScore<<"/"<<m_iTrialLeftCount<<std::endl; std::cout << "--- LEFT: " <<m_iLeftScore<<"/"<<m_iTrialLeftCount<<std::endl;
...@@ -254,6 +258,8 @@ bool CHandballBCI::process(double timeSinceLastProcess) ...@@ -254,6 +258,8 @@ bool CHandballBCI::process(double timeSinceLastProcess)
l_poPassiveBallPivot->setVisible(false); l_poPassiveBallPivot->setVisible(false);
l_poActiveBallPivot->setVisible(false); l_poActiveBallPivot->setVisible(false);
m_bGoalMarkedAtThisPhase = false;
break; break;
...@@ -293,8 +299,8 @@ bool CHandballBCI::process(double timeSinceLastProcess) ...@@ -293,8 +299,8 @@ bool CHandballBCI::process(double timeSinceLastProcess)
case Phase_Active: case Phase_Active:
m_fBallSpeed=-(float)(m_dFeedback * 0.1); m_fBallSpeed=-(float)(m_dFeedback * 0.1);
if(m_iMark==Mark_Left && m_fBallPosition==-GOAL_DISTANCE && !m_bGoalMarkedAtThisPhase) { m_iGoalScore++; m_bGoalMarkedAtThisPhase=true; } if(m_iMark==Mark_Left && m_fBallPosition>= GOAL_DISTANCE && !m_bGoalMarkedAtThisPhase) { m_iGoalScore++; m_bGoalMarkedAtThisPhase=true; }
if(m_iMark==Mark_Right&& m_fBallPosition== GOAL_DISTANCE && !m_bGoalMarkedAtThisPhase) { m_iGoalScore++; m_bGoalMarkedAtThisPhase=true; } if(m_iMark==Mark_Right&& m_fBallPosition<= -GOAL_DISTANCE && !m_bGoalMarkedAtThisPhase) { m_iGoalScore++; m_bGoalMarkedAtThisPhase=true; }
if(m_iMark==Mark_Left && m_dFeedback<0) { m_iClassificationScore++;} if(m_iMark==Mark_Left && m_dFeedback<0) { m_iClassificationScore++;}
if(m_iMark==Mark_Right&& m_dFeedback>0) { m_iClassificationScore++;} if(m_iMark==Mark_Right&& m_dFeedback>0) { m_iClassificationScore++;}
......
...@@ -60,7 +60,7 @@ namespace OpenViBEVRDemos { ...@@ -60,7 +60,7 @@ namespace OpenViBEVRDemos {
bool m_bGoalMarkedAtThisPhase; bool m_bGoalMarkedAtThisPhase;
float m_fBallSpeed; float m_fBallSpeed;
float m_fBallPosition; float m_fBallPosition; // n.b. The coordinate system of this seems to be inverted wrt the [-left,+right] convention
float m_fLastBallPosition; float m_fLastBallPosition;
float m_fBallOrientation; float m_fBallOrientation;
......
...@@ -24,18 +24,18 @@ ENDIF(WIN32) ...@@ -24,18 +24,18 @@ ENDIF(WIN32)
IF(UNIX) IF(UNIX)
INCLUDE("FindPkgConfig") INCLUDE("FindPkgConfig")
SET(CEGUI_FOUND "-NOTFOUND") SET(CEGUI_FOUND "-NOTFOUND")
pkg_check_modules(CEGUI CEGUI) pkg_check_modules(CEGUI QUIET CEGUI)
IF(NOT CEGUI_FOUND) IF(NOT CEGUI_FOUND)
# we have this mess as the cegui filenames & paths are different on Fedora 21 at least, # we have this mess as the cegui filenames & paths are different on Fedora 21 at least,
# and the include_dirs doesn't contain the CEGUI/ part ... I'd put that to the .h/.cpp IF the same path # and the include_dirs doesn't contain the CEGUI/ part ... I'd put that to the .h/.cpp IF the same path
# convention was the case on all platforms... but it is not # convention was the case on all platforms... but it is not
pkg_check_modules(CEGUI CEGUI-0) pkg_check_modules(CEGUI QUIET CEGUI-0)
SET(CEGUI_INCLUDE_DIRS "${CEGUI_INCLUDE_DIRS}/CEGUI") SET(CEGUI_INCLUDE_DIRS "${CEGUI_INCLUDE_DIRS}/CEGUI")
ENDIF(NOT CEGUI_FOUND) ENDIF(NOT CEGUI_FOUND)
SET(OgreCEGUIRenderer_FOUND "-NOTFOUND") SET(OgreCEGUIRenderer_FOUND "-NOTFOUND")
pkg_check_modules(OgreCEGUIRenderer CEGUI-OGRE) pkg_check_modules(OgreCEGUIRenderer QUIET CEGUI-OGRE)
IF(NOT OgreCEGUIRenderer_FOUND) IF(NOT OgreCEGUIRenderer_FOUND)
pkg_check_modules(OgreCEGUIRenderer CEGUI-0-OGRE) pkg_check_modules(OgreCEGUIRenderer QUIET CEGUI-0-OGRE)
ENDIF(NOT OgreCEGUIRenderer_FOUND) ENDIF(NOT OgreCEGUIRenderer_FOUND)
ENDIF(UNIX) ENDIF(UNIX)
......
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
#include <boost/thread.hpp> #include <boost/thread.hpp>
#include <boost/thread/condition.hpp> #include <boost/thread/condition.hpp>
#include <boost/version.hpp> #include <boost/version.hpp>
#include <boost/scoped_ptr.hpp>
#include <sys/timeb.h> #include <sys/timeb.h>
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
#include <boost/asio.hpp> #include <boost/asio.hpp>
#include <boost/thread.hpp> #include <boost/thread.hpp>
#include <boost/config.hpp> #include <boost/config.hpp>
#include <boost/scoped_ptr.hpp>
using namespace std; using namespace std;
......
...@@ -350,23 +350,68 @@ echo "" ...@@ -350,23 +350,68 @@ echo ""
## ## ## ##
#################################### ####################################
version_greater() {
expr "$1" = "`echo -e "$1\n$2" | sort -n | tail -n1`" 2>/dev/null
}
if [[ ! -e "$ov_target_folder_hit/no-native-packages.hit" ]]; then if [[ ! -e "$ov_target_folder_hit/no-native-packages.hit" ]]; then
echo "Checking native dependencies..." echo "Checking native dependencies..."
if [[ "`grep -E 'Ubuntu|LinuxMint' /etc/lsb-release 2> /dev/null`" != "" || "`grep -E 'Raspbian' /etc/os-release 2> /dev/null`" != "" || "`grep Debian /etc/issue 2> /dev/null`" != "" ]]; then [[ -z `grep -E 'Debian' /etc/issue 2> /dev/null` ]] ; is_debian=$?
[[ -z `grep -E 'Ubuntu' /etc/lsb-release 2> /dev/null` ]] ; is_ubuntu=$?
[[ -z `grep -E 'LinuxMint' /etc/lsb-release 2> /dev/null` ]] ; is_mint=$?
[[ -z `grep -E 'Raspbian' /etc/os-release 2> /dev/null` ]] ; is_raspbian=$?
if [[ $is_debian -eq 1 || $is_ubuntu -eq 1 || $is_raspbian -eq 1 || $is_mint -eq 1 ]]; then
echo " You are currently running a Debian/Ubuntu based distribution"
ov_native_package_installed=true ov_native_package_installed=true
ov_native_package_log_file="$ov_target_folder_log/native-packages.log" ov_native_package_log_file="$ov_target_folder_log/native-packages.log"
ov_ubuntu_version=`lsb_release -r -s 2>/dev/null` ov_distro_version=`lsb_release -r -s 2>/dev/null`
if [[ `expr $ov_ubuntu_version \>= 14.04` == 1 ]]; then echo " Found distro version $ov_distro_version ..."
# at the time of writing this, there was a conflict between libogre-dev and libboost-thread-dev dependencies in 13.10 and 14.04 # Different distros and versions might need slightly different packages
echo " Ubuntu $ov_ubuntu_version detected, suggesting specific set of packages..." if [[ $is_ubuntu -eq 1 ]]; then
ov_lib_ogre_dev=libogre-1.8-dev if [[ `version_greater $ov_distro_version 16.04` == 1 ]]; then
ov_lib_libboost_chrono_dev=libboost-chrono1.54-dev echo " Ubuntu >= v16.04 detected, guessing specific set of packages..."
else ov_lib_ogre_dev=libogre-1.9-dev
ov_lib_libboost_chrono_dev=libboost-chrono1.58-dev
elif [[ `version_greater $ov_distro_version 14.04` == 1 ]]; then
echo " Ubuntu >= v14.04 detected, guessing specific set of packages..."
ov_lib_ogre_dev=libogre-1.8-dev
ov_lib_libboost_chrono_dev=libboost-chrono1.54-dev
else
echo " Ubuntu seems older than v14.04 ..."
ov_lib_ogre_dev=libogre-dev
ov_lib_libboost_chrono_dev=
fi;
fi;
if [[ $is_debian -eq 1 ]]; then
if [[ `version_greater $ov_distro_version 8` == 1 ]]; then
echo " Debian >= v8 detected, guessing specific set of packages..."
# although 1.9 is available, it doesn't seem to play well together with cegui, so we use 1.8 ...
ov_lib_ogre_dev=libogre-1.8-dev
ov_lib_libboost_chrono_dev=libboost-chrono1.55-dev
else
echo " Debian seems older than v8 ..."
ov_lib_ogre_dev=libogre-dev
ov_lib_libboost_chrono_dev=
fi
fi;
if [[ $is_mint -eq 1 ]]; then
# hack the correct versions here...
echo " Mint detected, guessing specific set of packages..."
ov_lib_ogre_dev=libogre-dev ov_lib_ogre_dev=libogre-dev
ov_lib_libboost_chrono_dev= ov_lib_libboost_chrono_dev=
fi; fi
if [[ $is_raspbian -eq 1 ]]; then
# hack the correct versions here...
echo " Raspbian detected, guessing specific set of packages..."
ov_lib_ogre_dev=libogre-dev
ov_lib_libboost_chrono_dev=
fi
ov_ubuntu_packages="wget doxygen make automake autoconf cmake unzip gcc g++ libgtk2.0-dev libglade2-dev gfortran libgsl0-dev libexpat1-dev libreadline-dev libzzip-dev libtool libxaw7-dev libpcre3-dev libfreeimage-dev libglu1-mesa-dev libalut-dev libvorbis-dev libncurses5-dev python-dev python-numpy libeigen3-dev $ov_lib_ogre_dev libcegui-mk2-dev libois-dev libboost-dev libboost-thread-dev liblua5.1-0-dev libboost-regex-dev libboost-filesystem-dev $ov_lib_libboost_chrono_dev libitpp-dev sqlite libsqlite0-dev libfftw3-dev" ov_ubuntu_packages="wget doxygen make automake autoconf cmake unzip gcc g++ libgtk2.0-dev libglade2-dev gfortran libgsl0-dev libexpat1-dev libreadline-dev libzzip-dev libtool libxaw7-dev libpcre3-dev libfreeimage-dev libglu1-mesa-dev libalut-dev libvorbis-dev libncurses5-dev python-dev python-numpy libeigen3-dev $ov_lib_ogre_dev libcegui-mk2-dev libois-dev libboost-dev libboost-thread-dev liblua5.1-0-dev libboost-regex-dev libboost-filesystem-dev $ov_lib_libboost_chrono_dev libitpp-dev sqlite libsqlite0-dev libfftw3-dev"
for package in $ov_ubuntu_packages; do for package in $ov_ubuntu_packages; do
...@@ -382,7 +427,6 @@ if [[ ! -e "$ov_target_folder_hit/no-native-packages.hit" ]]; then ...@@ -382,7 +427,6 @@ if [[ ! -e "$ov_target_folder_hit/no-native-packages.hit" ]]; then
done; done;
if [[ $ov_native_package_installed == false ]]; then if [[ $ov_native_package_installed == false ]]; then
echo " You are currently running a Debian/Ubuntu based distribution"
echo "" echo ""
echo " Root access is required to install needed packages." echo " Root access is required to install needed packages."
echo "" echo ""
...@@ -521,7 +565,7 @@ ov_package_url_itpp=http://openvibe.inria.fr/dependencies/linux-x86/itpp-4.0.7.t ...@@ -521,7 +565,7 @@ ov_package_url_itpp=http://openvibe.inria.fr/dependencies/linux-x86/itpp-4.0.7.t
ov_package_url_vrpn=http://openvibe.inria.fr/dependencies/linux-x86/vrpn_07_31-ov.zip ov_package_url_vrpn=http://openvibe.inria.fr/dependencies/linux-x86/vrpn_07_31-ov.zip
# LabStreamingLayer # LabStreamingLayer
ov_package_url_liblsl=http://openvibe.inria.fr/dependencies/linux-x86/liblsl-1.04-src.tar.bz2 ov_package_url_liblsl=http://openvibe.inria.fr/dependencies/linux-x86/liblsl-1.04.ov1-src.tar.bz2
############################################## ##############################################
## ## ## ##
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment