Skip to content

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

@qr0n

Description

@qr0n

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()
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions