ben winstone
/
ucam
As of Monday morning, so this is the code we showed at Uncraftivism.
Revision 1:5d20e168f467, committed 2009-12-14
- Comitter:
- voidnoise
- Date:
- Mon Dec 14 08:25:07 2009 +0000
- Parent:
- 0:da6a22da11a2
- Commit message:
Changed in this revision
Blinker.cpp | Show annotated file Show diff for this revision Revisions of this file |
MotionFinder.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r da6a22da11a2 -r 5d20e168f467 Blinker.cpp --- a/Blinker.cpp Fri Dec 11 21:59:44 2009 +0000 +++ b/Blinker.cpp Mon Dec 14 08:25:07 2009 +0000 @@ -49,7 +49,7 @@ float Blinker::openPosForSleepiness() { // for sleepiness 0->1, return EYE_OPEN ->( )/2 - return EYE_OPEN + ( (EYE_CLOSED-EYE_OPEN) * 0.5 * m_sleepiness); + return EYE_OPEN + ( (EYE_CLOSED-EYE_OPEN) * 0.8 * m_sleepiness); } void Blinker::close()
diff -r da6a22da11a2 -r 5d20e168f467 MotionFinder.cpp --- a/MotionFinder.cpp Fri Dec 11 21:59:44 2009 +0000 +++ b/MotionFinder.cpp Mon Dec 14 08:25:07 2009 +0000 @@ -154,20 +154,35 @@ if( percentage < 3 ) // no real target, no COG { pcSerial.printf("No COG\r\n"); + + m_xServoMinder->setSpeed( 0.02 ); + m_yServoMinder->setSpeed( 0.02 ); + blinker->setBoredom( 1 ); + m_attentionX = m_attentionX + (((0.5 - m_attentionX))/20); + m_attentionY = m_attentionY + (((0.7 - m_attentionY))/20); // could implement some looking-around in this state + + } else if( sumN > 0 ) { + m_xServoMinder->setSpeed( 0.25 ); + m_yServoMinder->setSpeed( 0.25 ); + cogX = sumX / sumN; cogY = sumY / sumN; m_attentionX = ((float)cogX / frame->m_width); m_attentionY = ((float)cogY / frame->m_width); // use the larger dimension so x & y get the same scaling - blinker->setBoredom( 0 ); + //blinker->setBoredom( 0 ); + float boredom = (2*percentage)/100.0; + if(boredom > 1) boredom = 1; + blinker->setBoredom( boredom ); + pcSerial.printf("COG is %d, %d\r\n", (int) cogX, (int) cogY);