Hello Tello Pilot!
Join our DJI Tello community & remove this banner.
Sign up

Gobot Question

SMerrony

Well-known member
Joined
May 1, 2018
Messages
65
Reaction score
63
Location
France
I've got each of the example Gobot programs from the recent article running, so now I want to combine two of them so I can have vision and control simultaneously.

I couldn't find an example, so I tried the following approach - which seg faults...

Code:
package main

import (
    "fmt"
    "os/exec"
    "time"

    "gobot.io/x/gobot"
    "gobot.io/x/gobot/platforms/dji/tello"
)

func main() {
    droneCam := tello.NewDriver("8890")
    droneCmd := tello.NewDriver("8888")

    work := func() {
        mplayer := exec.Command("mplayer", "-vo", "x11", "-fps", "30", "-")
        mplayerIn, _ := mplayer.StdinPipe()
        if err := mplayer.Start(); err != nil {
            fmt.Println(err)
            return
        }
        droneCam.On(tello.ConnectedEvent, func(data interface{}) {
            fmt.Println("Connected")
            droneCam.StartVideo()
            droneCam.SetVideoEncoderRate(2)
            gobot.Every(2000*time.Millisecond, func() {
                droneCam.StartVideo()
            })
        })

        droneCam.On(tello.VideoFrameEvent, func(data interface{}) {
            pkt := data.([]byte)
            if _, err := mplayerIn.Write(pkt); err != nil {
                fmt.Println(err)
            }
        })

        // droneCmd.TakeOff()

        // gobot.After(5*time.Second, func() {
        //     droneCmd.Land()
        // })
    }

    robot := gobot.NewRobot("tello",
        []gobot.Connection{},
        []gobot.Device{droneCam, droneCmd},
        work,
    )

    robot.Start()
}

Can anyone point me in the right direction?
 
I'm kind of new at GO but what actually happened when you ran that code? Did it throw an error?
And what I'm really getting at is....can you control two drones with one program by calling two drivers???
 
I'm kind of new at GO but what actually happened when you ran that code? Did it throw an error?
And what I'm really getting at is....can you control two drones with one program by calling two drivers???
My code worked as soon as I used a single driver as suggested by javaguy, I got a video stream and control of the drone simultaneously.

I think you need to look at the "swarm" concept in Gobot to control two or more drones - can't help there as I'm monodromous at the moment.:D
 
  • Like
Reactions: Inakigarm
PLEASE HELP.

I am using a UBUNTU 16 virtual machine. I have Gobot installed and I can run the sample scripts. I connect the Wifi network of my PC to TELLO, but I get nothing from the drone. I attach a screenshot.

Help much appreciated. The problem can be becasuse I am using a virtual machine and does not access Wifi directly?
 

Attachments

  • GO.jpg
    GO.jpg
    431.8 KB · Views: 8
Last edited:
I have done some research, and I think that the problem is that my laptop is not connecting TELLO´s Wifi propperly. I see a symbol over the connection. Can someone help?
 

Attachments

  • Wifi.jpg
    Wifi.jpg
    66.8 KB · Views: 4
Hi again,

I can run the GO code and TELLO starts to work, but like after 2 seconds, it disconnects every time. Any idea on how to avoid getting dissconnected?
 

Attachments

  • Disconnect TELLO.jpg
    Disconnect TELLO.jpg
    273.7 KB · Views: 2
I also get an error with Streamingvideo GO example.
 

Attachments

  • Streamingvideo.jpg
    Streamingvideo.jpg
    334 KB · Views: 3
Hello iarakis,

Same problem here on windows 10 - the cmd prompt just hangs at "Starting work"

I believe the wifi symbol simply means "no internet" due to a direct connection to tello not router.

How did you get past "Starting work?
 
... cont

As for your disconection after 2 seconds... running tello SDK in a Java environment I could only get that far - which is why I'm atempting the "Go" learning curve.
 

New Posts

Members online

No members online now.

Forum statistics

Threads
5,690
Messages
39,934
Members
17,023
Latest member
Repiv

New Posts