Documentation ¶
Overview ¶
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
Index ¶
- Constants
- func ValidatePitch(data float64, offset float64) float64
- type Adaptor
- type Driver
- func (a *Driver) Backward(speed float64)
- func (a *Driver) Clockwise(speed float64)
- func (a *Driver) Connection() gobot.Connection
- func (a *Driver) CounterClockwise(speed float64)
- func (a *Driver) Down(speed float64)
- func (a *Driver) Forward(speed float64)
- func (a *Driver) Halt() (err error)
- func (a *Driver) Hover()
- func (a *Driver) Land()
- func (a *Driver) Left(speed float64)
- func (a *Driver) Name() string
- func (a *Driver) Right(speed float64)
- func (a *Driver) SetName(n string)
- func (a *Driver) Start() (err error)
- func (a *Driver) TakeOff()
- func (a *Driver) Up(speed float64)
Constants ¶
const (
// Flying event
Flying = "flying"
)
Variables ¶
This section is empty.
Functions ¶
func ValidatePitch ¶ added in v1.2.0
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
Types ¶
type Adaptor ¶
type Adaptor struct {
// contains filtered or unexported fields
}
Adaptor is gobot.Adaptor representation for the Ardrone
func NewAdaptor ¶
NewAdaptor returns a new ardrone.Adaptor and optionally accepts:
string: The ardrones IP Address
type Driver ¶
Driver is gobot.Driver representation for the Ardrone
func NewDriver ¶
NewDriver creates an Driver for the ARDrone.
It add the following events:
'flying' - Sent when the device has taken off.
func (*Driver) Backward ¶
Backward causes the drone go backward, controls the pitch. speed can be a value from `0.0` to `1.0`.
func (*Driver) Clockwise ¶
Clockwise causes the drone to spin in clockwise direction speed can be a value from `0.0` to `1.0`.
func (*Driver) Connection ¶
func (a *Driver) Connection() gobot.Connection
Connection returns the Driver Connection
func (*Driver) CounterClockwise ¶
CounterClockwise the drone to spin in counter clockwise direction speed can be a value from `0.0` to `1.0`.
func (*Driver) Down ¶
Down makes the drone reduce altitude. speed can be a value from `0.0` to `1.0`.
func (*Driver) Forward ¶
Forward causes the drone go forward, controls the pitch. speed can be a value from `0.0` to `1.0`.
func (*Driver) Left ¶
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`.
func (*Driver) Right ¶
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`.