public static bool mergiParalelPeDreapta(QueueEntry qe, EventArgs e) { int pd; switch (state3) { case 0: RealFuncs.goFront(30, 230); state3 = 1; break; case 1: pd = (int)isRightParalel(); if (pd == 0) { if (funcs.getSensorValue(Sensor.SideRight) < 12) { RealFuncs.goFrontLeft(30, 200); } break; } if (pd == 1) { RealFuncs.goFrontRight(30, 220); state3 = 2; } else { RealFuncs.goFrontLeft(30, 220); state3 = 2; } break; case 2: pd = (int)isRightParalel(); if (pd == 0) { RealFuncs.goFront(30, 230); state3 = 1; } break; } return(false); }
public static bool paralelParking(QueueEntry qe, EventArgs e) { double frontLeft = RealFuncs.getSensorValue(Sensor.FrontLeft); double frontRight = RealFuncs.getSensorValue(Sensor.FrontRight); double sideLeft = RealFuncs.getSensorValue(Sensor.SideLeft); double sideRight = RealFuncs.getSensorValue(Sensor.SideRight); funcs.Log("stare :" + stare.ToString()); switch (stare) { case -1: RealFuncs.goFront(60, 250); stare = 0; break; case 0: if (sideRight < 100) { stare = 1; } break; case 1: if (sideRight > 200) { RealFuncs.goFrontRight(60, 250); stare = 2; } break; case 2: if (frontRight < 175) { RealFuncs.goFront(60, 175); stare = 3; } break; case 3: if (sideRight < 220) { RealFuncs.rotirePeLoc(10, 175, Engines.RightEngines); stare = 4; } break; case 4: if (sideRight < 80) { stare = 5; } break; case 5: if (doRightParalel()) { stare = 6; RealFuncs.goBackRight(10, 150); distantaParcursa(true); } break; case 6: if (distantaParcursa() > 75) { stare = 7; distantaParcursa(true); RealFuncs.goBackLeft(10, 150); } break; case 7: if (distantaParcursa() > 75) { stare = 8; distantaParcursa(true); RealFuncs.goFrontRight(10, 150); } break; case 8: if (distantaParcursa() > 75) { stare = 9; distantaParcursa(true); RealFuncs.goFrontLeft(10, 150); } break; case 9: if (distantaParcursa() > 75) { stare = 10; distantaParcursa(true); RealFuncs.goFront(10, 50); } break; case 10: if (distantaParcursa() > 15) { stare = 11; RealFuncs.StopEngines(); return(true); } break; } return(false); }
public static bool parcareLaterala(QueueEntry qe, EventArgs e) { funcs.Log("st=" + state2.ToString()); switch (state2) { case 0: RealFuncs.goFront(30, 200); state2 = 1; break; case 1: tmp2 = funcs.getSensorValue(Sensor.SideRight); if (tmp2 < 50) { state2 = 2; } break; case 2: tmp2 = funcs.getSensorValue(Sensor.SideRight); if (tmp2 > 50) { state2 = 3; RealFuncs.goFrontRight(30, 200); } break; case 3: tmp2 = funcs.getSensorValue(Sensor.FrontRight); if (tmp2 < 55) { state2 = 4; RealFuncs.goFrontLeft(30, 250); } break; case 4: if (isRightParalel(3) == 0) { RealFuncs.goFront(30, 175); state2 = 5; return(false); } break; case 5: if (Math.Abs(funcs.getSensorValue(Sensor.FrontLeft) - funcs.getSensorValue(Sensor.FrontRight)) < 10) { RealFuncs.StopEngines(); RealFuncs.goBack(1, 150); return(true); } break; case 6: break; default: break; } return(false); }