liuxuan30 / TelloSwift

DJI Tello Swift Framework powered by SwiftNIO
Apache License 2.0
18 stars 7 forks source link

I got confuse just need to update swift-nio #10

Closed jorgeavila closed 1 year ago

jorgeavila commented 1 year ago

/Users/xxxx/Library/Developer/Xcode/DerivedData/TelloSwift-abixwqckxzxfmzarxoesypgigocg/SourcePackages/checkouts/swift-nio/Sources/NIO/MarkedCircularBuffer.swift:132:1 Type 'MarkedCircularBuffer' does not conform to protocol 'MutableCollection'

/Users/xxxx/Library/Developer/Xcode/DerivedData/TelloSwift-abixwqckxzxfmzarxoesypgigocg/SourcePackages/checkouts/swift-nio/Sources/NIO/MarkedCircularBuffer.swift:132:1 Unavailable subscript 'subscript(_:)' was used to satisfy a requirement of protocol 'MutableCollection'

liuxuan30 commented 1 year ago

have you manually updated swift nio? I remember I have specified the dependency version?

liuxuan30 commented 1 year ago
dependencies: [
    .package(url: "https://github.com/apple/swift-nio.git", from: "2.10.0"),
],

this is what it depends. what's your version?

jorgeavila commented 1 year ago

Hi! Not on my Mac right now. I just delete it and add it again using the latest. I have another question. Swift is new to me, how can get run the code? i'm able to compile the project but not sur where to write the code for tello, do you have and example or something? will be appreciated thanks!

El mar, 20 jun 2023 a las 20:31, Xuan @.***>) escribió:

dependencies: [ .package(url: "https://github.com/apple/swift-nio.git", from: "2.10.0"), ],

this is what it depends. what's your version?

— Reply to this email directly, view it on GitHub https://github.com/liuxuan30/TelloSwift/issues/10#issuecomment-1599980172, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABJA4AJSSDLSCEKDV3UTTZ3XMJMJPANCNFSM6AAAAAAZMPECUI . You are receiving this because you authored the thread.Message ID: @.***>

liuxuan30 commented 1 year ago

just launch Xcode, create a swift playground, and try import the framework and follow example code in README.

But, you may want to check out the original python SDK from Tello, if you are familiar with python.

I craeted this repo only because there is no Swift SDK and in case anyone wants to control their tello/EDU from their iOS/macOS apps.

jorgeavila commented 1 year ago

Thanks a lot! Do you a example using the sample code? Is where in lost not sure where I can to write the code. I need to create a class. ? If you can show me with a example will be great thanks !!

On Mon 26 Jun 2023 at 20:32 Xuan @.***> wrote:

just launch Xcode, create a swift playground, and try import the framework and follow example code in README.

But, you may want to check out the original python SDK from Tello, if you are familiar with python.

I craeted this repo only because there is no Swift SDK and in case anyone wants to control their tello/EDU from their iOS/macOS apps.

— Reply to this email directly, view it on GitHub https://github.com/liuxuan30/TelloSwift/issues/10#issuecomment-1608623923, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABJA4ANIULMPGZCRYDT6L7LXNJA2BANCNFSM6AAAAAAZMPECUI . You are receiving this because you authored the thread.Message ID: @.***>

liuxuan30 commented 1 year ago

I saw you are the man sending me email :) I tried replying, but gmail denied my email domain due to SPF not set. So you didn't get my email earilier.

The use is quite simple, if youo are familiar with OOP like swift, python, the Tello drone is an object: simply create Tello object

let tello = Tello()

print("connected:", tello.activate())

print("battery:", tello.battery)
if tello.battery < 20 {
    tello.shutdown()
    print("battery too low")
}
print(tello.speed)

when you see the tello printed connected, you are ready to fly:

tello.takeoff()
tello.hover()
tello.land()

or even chaining multiple commands:

tello.chain("takeoff).chain("forward 20", failover: .hover).chain("land")

the Swift SDK simply send the commands via TCP to Tello.

I just wrap all the commands in swift and add some convenient methods so you can control your tello much easier, like chaining multiple commands, and providing fail over features like if you want to go 500m ahead but if the commands failed, you can chose one command as fail over method like hover() or land() to make sure there no danger would accur or evening hurting people / drone.

again, if you are not faimiliar with swift, I suggest not to take any risk using this SDK. you should start with python SDK or just follow some guides from Tello website to get yourself familiar with how to use SDK first.

This framework is pure SDK, not an app or script.

liuxuan30 commented 1 year ago

also, if you didn't see connected, make sure you pass the right IP and port:

    // MARK: Commander protocol
    public var telloAddress = "192.168.10.1"

    // Tello IP: 192.168.10.1 UDP PORT:8889 <<- ->> PC/Mac/Mobile
    public var telloPort = 8889

    // Tello IP: 192.168.10.1 ->> PC/Mac/Mobile UDP Server: 0.0.0.0 UDP PORT:8890
    public var statePort = 8890

    public var localAddr: String
    public var localPort: Int

you will need manually specify them if not default values, like:

let tello = Tello(localAddr: your ip, localPort: your port number)

liuxuan30 commented 1 year ago

again. You need to walk through the public APIs this framework provides, so you have a clear picture what API to use. There are plenty of covenient methods there.

liuxuan30 commented 1 year ago

and btw...

I just found that I actually provided a demo app inside [TelloVideoDecoder(https://github.com/liuxuan30/TelloSwift/tree/master/TelloVideoDecoder) there is a mac app so you give a try, with camera support.

liuxuan30 commented 1 year ago

I have updated the project with latest Xcode and NIO versions. it builds on my side. So this issue is considered solved.

jorgeavila commented 1 year ago

hey! Thanks a lot!. was very helpful. Okay gotcha. Actually i'm using unity iOS. I just sending UDp messages but i think they are primitive, i need to do 2 circles of 1 min but having a hard time. I think would be better using the SDK I'am right?

Thanks again.

El lun, 26 jun 2023 a las 22:12, Xuan @.***>) escribió:

Closed #10 https://github.com/liuxuan30/TelloSwift/issues/10 as completed.

— Reply to this email directly, view it on GitHub https://github.com/liuxuan30/TelloSwift/issues/10#event-9646641379, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABJA4AOKJMVUSUCVQALJD73XNJMRRANCNFSM6AAAAAAZMPECUI . You are receiving this because you authored the thread.Message ID: @.***>

jorgeavila commented 1 year ago

Hi!

Hope you are doing well! I was able to implement the sdk inside unity3D iOS. But having hard time doing a circle, i'm using RC controllers .\ Any hints to achieve that?

Thanks bro.

El lun, 26 jun 2023 a las 22:42, J A A G @.***>) escribió:

hey! Thanks a lot!. was very helpful. Okay gotcha. Actually i'm using unity iOS. I just sending UDp messages but i think they are primitive, i need to do 2 circles of 1 min but having a hard time. I think would be better using the SDK I'am right?

Thanks again.

El lun, 26 jun 2023 a las 22:12, Xuan @.***>) escribió:

Closed #10 https://github.com/liuxuan30/TelloSwift/issues/10 as completed.

— Reply to this email directly, view it on GitHub https://github.com/liuxuan30/TelloSwift/issues/10#event-9646641379, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABJA4AOKJMVUSUCVQALJD73XNJMRRANCNFSM6AAAAAAZMPECUI . You are receiving this because you authored the thread.Message ID: @.***>

liuxuan30 commented 1 year ago

hmm not really my expert area, I would suggest checking R^2 = X^2 + Y^2 to do the math?