Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
qr0n opened this issue Mar 4, 2025 · 0 comments
Open

Comments

@qr0n
Copy link

qr0n commented 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

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

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()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant