func NewArdroneAdaptor(name string) *ArdroneAdaptor {
	return &ArdroneAdaptor{
		Adaptor: gobot.Adaptor{
			Name: name,
		},
		connect: func(a *ArdroneAdaptor) {
			d, err := client.Connect(client.DefaultConfig())
			if err != nil {
				panic(err)
			}
			a.drone = d
		},
	}
}
Exemple #2
0
// NewAdaptor returns a new ardrone.Adaptor and optionally accepts:
//
//  string: The ardrones IP Address
//
func NewAdaptor(v ...string) *Adaptor {
	a := &Adaptor{
		name: "ARDrone",
		connect: func(a *Adaptor) (drone, error) {
			return client.Connect(a.config)
		},
	}

	a.config = client.DefaultConfig()
	if len(v) > 0 {
		a.config.Ip = v[0]
	}

	return a
}