Exemple #1
0
 // ToDo: FlyTo overload "mid"
 public static Task <bool> FlyTo(this ITelloClient tello, int x, int y, int z, int speed)
 {
     CommandConstraints.CheckDistance(x);
     CommandConstraints.CheckDistance(y);
     CommandConstraints.CheckDistance(z);
     CommandConstraints.CheckSpeed(speed);
     return(tello.SendAction($"go {x} {y} {z} {speed}"));
 }
 public static Task <bool> RC(this ITelloClient tello, int leftright, int forwardbackward, int updown, int yaw)
 {
     CommandConstraints.CheckRC(leftright);
     CommandConstraints.CheckRC(forwardbackward);
     CommandConstraints.CheckRC(updown);
     CommandConstraints.CheckRC(yaw);
     return(tello.SendAction($"rc {leftright} {forwardbackward} {updown} {yaw}"));
 }
Exemple #3
0
        // ToDo: Curve overload "mid"
        public static Task <bool> Curve(this ITelloClient tello, int x1, int y1, int z1, int x2, int y2, int z2, int speed)
        {
            CommandConstraints.CheckDistance(x1);
            CommandConstraints.CheckDistance(y1);
            CommandConstraints.CheckDistance(z1);
            CommandConstraints.CheckDistance(x2);
            CommandConstraints.CheckDistance(y2);
            CommandConstraints.CheckDistance(z2);
            CommandConstraints.CheckSpeed(speed);

            // ToDo: x/y/z can’t be between -20 20 at the same time.

            return(tello.SendAction($"curve {x1} {y1} {z1} {x2} {y2} {z2} {speed}"));
        }
 public ConnectionController(INetworkSetting setting,
                             ITelloClient telloClient,
                             IWiFiManager wifiManager,
                             ILoggerFactory loggerFactory,
                             TelloClientHandler handler)
 {
     this.setting       = setting ?? throw new ArgumentNullException(nameof(setting));
     Client             = telloClient ?? throw new ArgumentNullException(nameof(telloClient));
     WiFi               = wifiManager ?? throw new ArgumentNullException(nameof(wifiManager));
     this.handler       = handler ?? throw new ArgumentNullException(nameof(handler));
     logger             = loggerFactory?.CreateLogger <ConnectionController>() ?? throw new ArgumentNullException(nameof(logger));
     handler.Connected += Handler_Connected;
     Connected          = false;
     tokenSource        = new CancellationTokenSource();
 }
Exemple #5
0
 public static Task <string> GetWifi(this ITelloClient tello)
 {
     return(tello.SendCommand("wifi?"));
 }
Exemple #6
0
 public static Task <string> GetSpeed(this ITelloClient tello)
 {
     return(tello.SendCommand("speed?"));
 }
Exemple #7
0
 public static Task <string> GetBattery(this ITelloClient tello)
 {
     return(tello.SendCommand("battery?"));
 }
Exemple #8
0
 public static Task <string> GetTime(this ITelloClient tello)
 {
     return(tello.SendCommand("time?"));
 }
Exemple #9
0
 public static Task <bool> Land(this ITelloClient tello)
 {
     return(tello.SendAction("land"));
 }
Exemple #10
0
 public static Task <bool> Init(this ITelloClient tello)
 {
     return(tello.SendAction("command"));
 }
Exemple #11
0
 public static Task <bool> Flip(this ITelloClient tello, FlipDirection direction)
 {
     return(tello.SendAction($"flip {direction.ToString().ToLower()[0]}"));
 }
        // ToDo: set mon
        // ToDo: set moff
        // ToDo: set mdirection x

        public static Task <bool> Station(this ITelloClient tello, string ssid, string pass)
        {
            return(tello.SendAction($"ap {ssid} {pass}"));
        }
Exemple #13
0
 public static Task <bool> RotateDirection(this ITelloClient tello, bool clockwise, int degree)
 {
     CommandConstraints.CheckDegree(degree);
     return(tello.SendAction($"{(clockwise ? "cw" : "ccw")} {degree}"));
 }
Exemple #14
0
 public static Task <bool> FlyDirection(this ITelloClient tello, MoveDirection direction, int cm)
 {
     CommandConstraints.CheckDistance(cm);
     return(tello.SendAction($"{direction.ToString().ToLower()} {cm}"));
 }
Exemple #15
0
 public static Task <bool> Stop(this ITelloClient tello)
 {
     return(tello.SendAction("stop"));
 }
Exemple #16
0
 public static Task <bool> Emergency(this ITelloClient tello)
 {
     return(tello.SendAction("emergency"));
 }
Exemple #17
0
 public static Task <bool> StreamOff(this ITelloClient tello)
 {
     return(tello.SendAction("streamoff"));
 }
 public static Task <bool> Speed(this ITelloClient tello, int speed)
 {
     CommandConstraints.CheckSpeed(speed);
     return(tello.SendAction($"speed {speed}"));
 }
Exemple #19
0
 public static Task <bool> TakeOff(this ITelloClient tello)
 {
     return(tello.SendAction("takeoff"));
 }