2014-05-24 14:29:44 -04:00
|
|
|
#include "Collector.h"
|
|
|
|
|
|
|
|
ZaphodCollector::ZaphodCollector()
|
|
|
|
{
|
|
|
|
collectorMotor = new Jaguar(COLLECTOR_SIDECAR, COLLECTOR_MOTOR);
|
|
|
|
}
|
|
|
|
|
2014-05-24 21:42:12 -04:00
|
|
|
void ZaphodCollector::updateCollector(bool shooting, float angle)
|
2014-05-24 14:29:44 -04:00
|
|
|
{
|
2014-05-24 21:42:12 -04:00
|
|
|
//Needed for the auto running of collector when shooting
|
|
|
|
if(shooting)
|
|
|
|
{
|
|
|
|
if(angle <= 40)
|
|
|
|
{
|
|
|
|
collectBall();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//
|
|
|
|
if(e_CollectorState == COLLECTING)
|
|
|
|
{
|
|
|
|
collectBall();
|
|
|
|
}
|
|
|
|
if(e_CollectorState == RELEASE)
|
|
|
|
{
|
|
|
|
releaseBall();
|
|
|
|
}
|
|
|
|
if(e_CollectorState == STOP)
|
|
|
|
{
|
|
|
|
collectorMotor->Set(0);
|
|
|
|
}
|
2014-05-24 14:29:44 -04:00
|
|
|
}
|
|
|
|
|
2014-05-24 21:42:12 -04:00
|
|
|
void ZaphodCollector::collectBall()
|
2014-05-24 14:29:44 -04:00
|
|
|
{
|
2014-05-24 21:42:12 -04:00
|
|
|
collectorMotor->Set(1);
|
2014-05-24 14:29:44 -04:00
|
|
|
}
|
|
|
|
|
2014-05-24 21:42:12 -04:00
|
|
|
void ZaphodCollector::releaseBall()
|
2014-05-24 14:29:44 -04:00
|
|
|
{
|
2014-05-24 21:42:12 -04:00
|
|
|
collectorMotor->Set(255);
|
2014-05-24 14:29:44 -04:00
|
|
|
}
|