1
0
mirror of https://github.com/hybridgroup/gobot.git synced 2025-05-11 19:29:20 +08:00

tello: send Land() command to drone on Halt() to avoid floating mid-air

Signed-off-by: Ron Evans <ron@hybridgroup.com>
This commit is contained in:
Ron Evans 2018-08-24 09:06:29 +02:00
parent d306c342c9
commit a0b92d8407

View File

@ -285,6 +285,11 @@ func (d *Driver) Start() error {
// Halt stops the driver.
func (d *Driver) Halt() (err error) {
// send a landing command when we disconnect, and give it 500ms to be received before we shutdown
d.Land()
time.Sleep(500 * time.Millisecond)
// TODO: cleanly shutdown the goroutines that are handling the UDP connections before closing
d.cmdConn.Close()
d.videoConn.Close()
return