import "gobot.io/x/gobot/platforms/parrot/ardrone"
Package ardrone provides the Gobot adaptor and driver for the Parrot Ardrone.
Installing:
go get -d -u gobot.io/x/gobot/... && go install gobot.io/x/gobot/platforms/parrot/ardrone
Example:
package main import ( "time" "gobot.io/x/gobot" "gobot.io/x/gobot/platforms/parrot/ardrone" ) func main() { ardroneAdaptor := ardrone.NewAdaptor() drone := ardrone.NewDriver(ardroneAdaptor) work := func() { drone.TakeOff() drone.On(drone.Event("flying"), func(data interface{}) { gobot.After(3*time.Second, func() { drone.Land() }) }) } robot := gobot.NewRobot("drone", []gobot.Connection{ardroneAdaptor}, []gobot.Device{drone}, work, ) robot.Start() }
For more information refer to the ardrone README: https://github.com/hybridgroup/gobot/tree/master/platforms/parrot/ardrone/README.md
ardrone_adaptor.go ardrone_driver.go doc.go pitch.go test_helper.go
const ( // Flying event Flying = "flying" )
ValidatePitch helps validate pitch values such as those created by a joystick to values between 0-1.0 that are required as params to Parrot ARDrone PCMDs
type Adaptor struct {
// contains filtered or unexported fields
}
Adaptor is gobot.Adaptor representation for the Ardrone
NewAdaptor returns a new ardrone.Adaptor and optionally accepts:
string: The ardrones IP Address
Connect establishes a connection to the ardrone
Finalize terminates the connection to the ardrone
Name returns the Adaptor Name
SetName sets the Adaptor Name
Driver is gobot.Driver representation for the Ardrone
NewDriver creates an Driver for the ARDrone.
It add the following events:
'flying' - Sent when the device has taken off.
Backward causes the drone go backward, controls the pitch. speed can be a value from `0.0` to `1.0`.
Clockwise causes the drone to spin in clockwise direction speed can be a value from `0.0` to `1.0`.
func (a *Driver) Connection() gobot.Connection
Connection returns the Driver Connection
CounterClockwise the drone to spin in counter clockwise direction speed can be a value from `0.0` to `1.0`.
Down makes the drone reduce altitude. speed can be a value from `0.0` to `1.0`.
Forward causes the drone go forward, controls the pitch. speed can be a value from `0.0` to `1.0`.
Halt halts the Driver
Hover makes the drone to hover in place.
Land causes the drone to land
Left causes the drone to bank to the left, controls the roll, which is a horizontal movement using the camera as a reference point. speed can be a value from `0.0` to `1.0`.
Name returns the Driver Name
Right causes the drone to bank to the right, controls the roll, which is a horizontal movement using the camera as a reference point. speed can be a value from `0.0` to `1.0`.
SetName sets the Driver Name
Start starts the Driver
TakeOff makes the drone start flying, and publishes `flying` event
Up makes the drone gain altitude. speed can be a value from `0.0` to `1.0`.
Package ardrone imports 3 packages (graph) and is imported by 1 packages. Updated 2020-05-26. Refresh now. Tools for package owners.