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
59
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?
 

SMerrony

Well-known member
Joined
May 1, 2018
Messages
65
Reaction score
59
Location
France
D'oh! Thanks - I had assumed the video needed its own port...

Working now.
 

redruff

Active member
Joined
Apr 26, 2018
Messages
37
Reaction score
13
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???
 

SMerrony

Well-known member
Joined
May 1, 2018
Messages
65
Reaction score
59
Location
France
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

iarakis

Member
Joined
Jul 26, 2018
Messages
10
Reaction score
0
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

Last edited:

iarakis

Member
Joined
Jul 26, 2018
Messages
10
Reaction score
0
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

iarakis

Member
Joined
Jul 26, 2018
Messages
10
Reaction score
0
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

zantarob

Member
Joined
Feb 28, 2019
Messages
9
Reaction score
1
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?
 

zantarob

Member
Joined
Feb 28, 2019
Messages
9
Reaction score
1
... 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 Threads

Members online

Forum statistics

Threads
2,779
Messages
21,841
Members
6,699
Latest member
dringram1