Пример #1
0
Файл: pilot.C Проект: zear/sabre
void Pilot::init()
{
	functioning = 1;
	new_damage = 0.0;
	time_to_target = 0.0;
	if (params->log)
		OpenLog(NULL);
	Init();
	pitchPid = flight->specs->pitchPid;
	rollPid = flight->specs->rollPid;
	yawPid = flight->specs->yawPid;
	gPid = flight->specs->gPid;
	airSpeedPid = flight->specs->airSpeedPid;
	targetClosurePid = flight->specs->targetClosurePid;
	SetTask(NOTHING);
	SetManeuver(sManeuver::STRAIGHT_AND_LEVEL,IMNVR_LOOPBIT);
	grndColSecs = 5.0;
	posGLimit = params->posG;
	negGLimit = params->negG;
	immelmanGs = posGLimit;
	splitSGs = posGLimit;
	tactics.altThreshold = 2000.0;
	formationWingLen = flight->specs->formationWingLen;
	formationOffset = flight->specs->formationOffset;
}
void StateControllerNew::JuryGetReady(tInt maneuverId)
{
    logger.Log(cString::Format("GETREADY received. ManeuverId: %d", maneuverId).GetPtr());

    if (sectionListIndex < 0 && maneuverListIndex < 0)
    {
        logger.Log("Maneuverlist missing");
        SetState(tCarState::Error);
        return;
    }

    SetState(tCarState::GetReady);
    SetManeuver(maneuverId);
    SendResets();
}
void StateControllerNew::JuryStart(tInt maneuverId)
{
    logger.Log(cString::Format("START received. ManeuverId: %d", maneuverId).GetPtr());

    if (tCarState::Running == carState)
    {
        logger.Log("Car is already running");
        return;
    }

    if (tCarState::Ready != carState)
    {
        logger.Log("Car is not ready yet");
        return;
    }

    SetState(tCarState::Running);
    SetManeuver(maneuverId);
}