Mission 2 works awesome
This commit is contained in:
@@ -34,17 +34,14 @@ namespace Tello_Drone
|
||||
|
||||
|
||||
|
||||
private void SendCommand(string message)
|
||||
private bool SendCommand(string message)
|
||||
{
|
||||
var returnValue = _udpClient.TrySend(message, 5_000, 3);
|
||||
if (returnValue == false)
|
||||
SendCommand("land");
|
||||
return _udpClient.TrySend(message, 5_000, 3);
|
||||
}
|
||||
|
||||
private bool TrySendCommand(string message)
|
||||
{
|
||||
return _udpClient.TrySend(message, 5_000, 3);
|
||||
|
||||
return _udpClient.TrySend(message, 20_000, 3);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,8 +33,9 @@ namespace Tello_Drone
|
||||
MissionSetup();
|
||||
_drone.BackFlip();
|
||||
_drone.FrontFlip();
|
||||
_drone.Forward(30);
|
||||
_drone.Land();
|
||||
_drone.Reverse(55);
|
||||
_drone.Forward(66);
|
||||
MissionTeardown();
|
||||
}
|
||||
|
||||
private void MissionSetup()
|
||||
|
||||
@@ -30,7 +30,7 @@ namespace Tello_Drone
|
||||
{
|
||||
_consoleLogger.Log($"Sending command to drone: {message}");
|
||||
bool successfullFlag = false;
|
||||
while(maxRetries >= 0 && successfullFlag == false)
|
||||
while(maxRetries > 0 && successfullFlag == false)
|
||||
{
|
||||
_client.Client.ReceiveTimeout = timeout;
|
||||
_client.Send(Encoding.ASCII.GetBytes(message), message.Length);
|
||||
@@ -43,9 +43,10 @@ namespace Tello_Drone
|
||||
if (returnMessage == "ok")
|
||||
successfullFlag = true;
|
||||
}
|
||||
catch
|
||||
catch(Exception x)
|
||||
{
|
||||
_consoleLogger.Log($"Did not get a response from the drone will attempt {maxRetries.ToString()} more times");
|
||||
_consoleLogger.Log(x.Message);
|
||||
_consoleLogger.Log($"Recieved {x.Message} from the drone, will attempt {maxRetries.ToString()} more times");
|
||||
}
|
||||
|
||||
maxRetries--;
|
||||
|
||||
Reference in New Issue
Block a user