Commit e1ebc554 authored by Jussi Lindgren's avatar Jussi Lindgren

Demos: Fixed issues with the Handball VR demo

- Updated the default classifier
- Changed the demo to use the classifier probability outputs
- Updated the goal counting
parent b7c524ba
<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>
<Algorithm-Identifier class-id="(0x2ba17a3c, 0x1bd46d84)">Linear Discrimimant Analysis (LDA)</Algorithm-Identifier>
<Stimulations>
<Class-Stimulation class-id="1">OVTK_GDF_Left</Class-Stimulation>
<Class-Stimulation class-id="2">OVTK_GDF_Right</Class-Stimulation>
<Class-Stimulation class-id="0">OVTK_GDF_Left</Class-Stimulation>
<Class-Stimulation class-id="1">OVTK_GDF_Right</Class-Stimulation>
</Stimulations>
<OpenViBE-Classifier>
<LDA>
<Classes>1 2</Classes>
<Weights>4.852093e+00 -5.293004e+00</Weights>
<Bias-distance>1.228474e+00</Bias-distance>
<Coefficient-probability>1.228474e+00</Coefficient-probability>
<LDA version="1">
<Classes>0 1 </Classes>
<Class-config-list>
<Class-config>
<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>
</OpenViBE-Classifier>
</OpenViBE-Classifier-Box>
\ No newline at end of file
......@@ -157,8 +157,12 @@ bool CHandballBCI::process(double timeSinceLastProcess)
{
std::list < double >& l_rVrpnAnalogState=m_poVrpnPeripheral->m_vAnalog.front();
//we take the last value from the server
double l_dAnalog=*(l_rVrpnAnalogState.begin());
//we take the last value from the server.
// 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
// A. VLG : we should compute the min/max only in the ACTIVE phase
......@@ -218,9 +222,9 @@ bool CHandballBCI::process(double timeSinceLastProcess)
{
case Phase_Rest:
std::cout << "### PHASE REST ###" <<std::endl;
if(m_iLastMark==Mark_Left && m_fBallPosition<0) { m_iLeftScore++;}
if(m_iLastMark==Mark_Right&& m_fBallPosition>0) { m_iRightScore++;}
if(m_iLastMark==Mark_Left && m_fBallPosition>0) { m_iLeftScore++;}
if(m_iLastMark==Mark_Right&& m_fBallPosition<0) { m_iRightScore++;}
std::cout << "- Current Score: " <<std::endl;
std::cout << "--- GOAL: " <<m_iGoalScore<<"/"<<(m_iTrialRightCount+m_iTrialLeftCount)<<std::endl;
std::cout << "--- LEFT: " <<m_iLeftScore<<"/"<<m_iTrialLeftCount<<std::endl;
......@@ -254,6 +258,8 @@ bool CHandballBCI::process(double timeSinceLastProcess)
l_poPassiveBallPivot->setVisible(false);
l_poActiveBallPivot->setVisible(false);
m_bGoalMarkedAtThisPhase = false;
break;
......@@ -293,8 +299,8 @@ bool CHandballBCI::process(double timeSinceLastProcess)
case Phase_Active:
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_Right&& 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_Left && m_dFeedback<0) { m_iClassificationScore++;}
if(m_iMark==Mark_Right&& m_dFeedback>0) { m_iClassificationScore++;}
......
......@@ -60,7 +60,7 @@ namespace OpenViBEVRDemos {
bool m_bGoalMarkedAtThisPhase;
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_fBallOrientation;
......
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