Newer
Older
#include "zoneConstruction.h"
#include "strategieV2.h"
#include "mediumLevelAction.h"
#include "command.h"
#include "position.h"
Guillaume Buret
committed
#include "krabi2016.h"
#ifndef ROBOTHW
#include <QDebug>
#endif
ZoneConstruction::ZoneConstruction(){}
Guillaume Buret
committed
ZoneConstruction::ZoneConstruction(Position goalPosition, Benne* benne):MediumLevelAction(goalPosition)
Guillaume Buret
committed
goalPosition = this->goalPosition;
benne_locale = benne;
}
ZoneConstruction::~ZoneConstruction(){}
Etape::EtapeType ZoneConstruction::getType()
{
return Etape::ZONE_CONSTRUCTION;
}
int ZoneConstruction::update()
{
if (status == 0)
qDebug() << "Zone Construction";
StrategieV2::setCurrentGoal(this->getGoalPosition(), false, VITESSE_LINEAIRE_MAX, -100.0, 200.f);
else if (status == 1)
{
StrategieV2::setCurrentGoal(this->getGoalPosition(), false, VITESSE_LINEAIRE_MAX, -100.0, 200.f);
status++;
}
else if (status == 2) {
if (Command::isNear(this->getGoalPosition(), 100.0f)) // le second paramètre est la distance a l'objectif
{
StrategieV2::stop();
StrategieV2::lookAt(this->getGoalPosition());
status++;
}
}
else if (status == 3) {
#ifndef ROBOTHW
qDebug() << "Etape zone de construction finie";
Guillaume Buret
committed
#endif
Guillaume Buret
committed
benne_locale->setBenneEmpty();
status = -1;
}