Documentation ¶
Overview ¶
Package ardrone provides the Gobot adaptor and driver for the Parrot Ardrone.
Installing:
go get -d -u github.com/hybridgroup/gobot/... && go install github.com/hybridgroup/gobot/platforms/ardrone
Example:
package main import ( "time" "github.com/hybridgroup/gobot" "github.com/hybridgroup/gobot/platforms/ardrone" ) func main() { gbot := gobot.NewGobot() ardroneAdaptor := ardrone.NewArdroneAdaptor("Drone") drone := ardrone.NewArdroneDriver(ardroneAdaptor, "Drone") work := func() { drone.TakeOff() gobot.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, ) gbot.AddRobot(robot) gbot.Start() }
For more information refer to the ardrone README: https://github.com/hybridgroup/gobot/tree/master/platforms/ardrone
Index ¶
- Constants
- type ArdroneAdaptor
- type ArdroneDriver
- func (a *ArdroneDriver) Backward(speed float64)
- func (a *ArdroneDriver) Clockwise(speed float64)
- func (a *ArdroneDriver) Connection() gobot.Connection
- func (a *ArdroneDriver) CounterClockwise(speed float64)
- func (a *ArdroneDriver) Down(speed float64)
- func (a *ArdroneDriver) Forward(speed float64)
- func (a *ArdroneDriver) Halt() (errs []error)
- func (a *ArdroneDriver) Hover()
- func (a *ArdroneDriver) Land()
- func (a *ArdroneDriver) Left(speed float64)
- func (a *ArdroneDriver) Name() string
- func (a *ArdroneDriver) Right(speed float64)
- func (a *ArdroneDriver) Start() (errs []error)
- func (a *ArdroneDriver) TakeOff()
- func (a *ArdroneDriver) Up(speed float64)
Constants ¶
const (
// Flying event
Flying = "flying"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ArdroneAdaptor ¶
type ArdroneAdaptor struct {
// contains filtered or unexported fields
}
ArdroneAdaptor is gobot.Adaptor representation for the Ardrone
func NewArdroneAdaptor ¶
func NewArdroneAdaptor(name string, v ...string) *ArdroneAdaptor
NewArdroneAdaptor returns a new ArdroneAdaptor and optionally accepts:
string: The ardrones IP Address
func (*ArdroneAdaptor) Connect ¶
func (a *ArdroneAdaptor) Connect() (errs []error)
Connect establishes a connection to the ardrone
func (*ArdroneAdaptor) Finalize ¶
func (a *ArdroneAdaptor) Finalize() (errs []error)
Finalize terminates the connection to the ardrone
func (*ArdroneAdaptor) Name ¶
func (a *ArdroneAdaptor) Name() string
Name returns the ArdroneAdaptors Name
type ArdroneDriver ¶
ArdroneDriver is gobot.Driver representation for the Ardrone
func NewArdroneDriver ¶
func NewArdroneDriver(connection *ArdroneAdaptor, name string) *ArdroneDriver
NewArdroneDriver creates an ArdroneDriver with specified name.
It add the following events:
'flying' - Sent when the device has taken off.
func (*ArdroneDriver) Backward ¶
func (a *ArdroneDriver) Backward(speed float64)
Backward causes the drone go backward, controls the pitch. speed can be a value from `0.0` to `1.0`.
func (*ArdroneDriver) Clockwise ¶
func (a *ArdroneDriver) Clockwise(speed float64)
Clockwise causes the drone to spin in clockwise direction speed can be a value from `0.0` to `1.0`.
func (*ArdroneDriver) Connection ¶
func (a *ArdroneDriver) Connection() gobot.Connection
Connection returns the ArdroneDrivers Connection
func (*ArdroneDriver) CounterClockwise ¶
func (a *ArdroneDriver) CounterClockwise(speed float64)
CounterClockwise the drone to spin in counter clockwise direction speed can be a value from `0.0` to `1.0`.
func (*ArdroneDriver) Down ¶
func (a *ArdroneDriver) Down(speed float64)
Down makes the drone reduce altitude. speed can be a value from `0.0` to `1.0`.
func (*ArdroneDriver) Forward ¶
func (a *ArdroneDriver) Forward(speed float64)
Forward causes the drone go forward, controls the pitch. speed can be a value from `0.0` to `1.0`.
func (*ArdroneDriver) Halt ¶
func (a *ArdroneDriver) Halt() (errs []error)
Halt halts the ArdroneDriver
func (*ArdroneDriver) Hover ¶
func (a *ArdroneDriver) Hover()
Hover makes the drone to hover in place.
func (*ArdroneDriver) Left ¶
func (a *ArdroneDriver) Left(speed float64)
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 (*ArdroneDriver) Name ¶
func (a *ArdroneDriver) Name() string
Name returns the ArdroneDrivers Name
func (*ArdroneDriver) Right ¶
func (a *ArdroneDriver) Right(speed float64)
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`.
func (*ArdroneDriver) Start ¶
func (a *ArdroneDriver) Start() (errs []error)
Start starts the ArdroneDriver
func (*ArdroneDriver) TakeOff ¶
func (a *ArdroneDriver) TakeOff()
TakeOff makes the drone start flying, and publishes `flying` event
func (*ArdroneDriver) Up ¶
func (a *ArdroneDriver) Up(speed float64)
Up makes the drone gain altitude. speed can be a value from `0.0` to `1.0`.