#1136·gobot

Holystone (HS200) Example provided is a good baseline but is incomplete

Author: qr0nCreated Mar 4, 2025Updated Mar 4, 2025

Hello, during my testing of this SDK or thingamajig on the Holystone 200 I have discovered that the example provided is not complete and is sort of misleading, the example provided is as follows

go
package main

import (
  "time"

  "gobot.io/x/gobot/v2"
  "gobot.io/x/gobot/v2/platforms/holystone/hs200"
)

func main() {
  drone := hs200.NewDriver("172.16.10.1:8888", "172.16.10.1:8080")

  work := func() {
    drone.TakeOff()

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

  robot := gobot.NewRobot("hs200",
    []gobot.Connection{},
    []gobot.Device{drone},
    work,
  )

  if err := robot.Start(); err != nil {
		panic(err)
	}
}

however theres 2 things that i had to figure out, firstly is adding a drone.Enable() before drone.Start() and then waiting for the drone to flash the strobe-y lights, then press control + C on your terminal to end the process, then run it again this has worked for me 100% of the time and i dont know why, heres the modified example i just tested to be working

go
package main

import (
	"time"

	"gobot.io/x/gobot"
	"gobot.io/x/gobot/platforms/holystone/hs200"
)

func main() {
	drone := hs200.NewDriver("172.16.10.1:8888", "172.16.10.1:8080")

	work := func() {
		drone.Enable()
		drone.TakeOff()
		gobot.After(5*time.Second, func() {
			drone.Land()
		})
	}

	robot := gobot.NewRobot("hs200",
		[]gobot.Connection{},
		[]gobot.Device{drone},
		work,
	)

	robot.Start()
}