From f1239d42a00cc7bca574d3b02578c7672a493f13 Mon Sep 17 00:00:00 2001 From: deadprogram Date: Tue, 12 Apr 2016 14:27:30 -0700 Subject: [PATCH] Change default value for PCMD flag to match the Bebop 2.0.57+ expectations Signed-off-by: deadprogram --- platforms/bebop/client/client.go | 12 ++++++++++-- platforms/bebop/client/examples/takeoff.go | 3 --- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/platforms/bebop/client/client.go b/platforms/bebop/client/client.go index 201fb940..fc92b9fa 100644 --- a/platforms/bebop/client/client.go +++ b/platforms/bebop/client/client.go @@ -179,7 +179,7 @@ func New() *Bebop { DiscoveryPort: 44444, networkFrameGenerator: networkFrameGenerator(), Pcmd: Pcmd{ - Flag: 1, + Flag: 0, Roll: 0, Pitch: 0, Yaw: 0, @@ -382,48 +382,56 @@ func (b *Bebop) Land() error { } func (b *Bebop) Up(val int) error { + b.Pcmd.Flag = 1 b.Pcmd.Gaz = validatePitch(val) return nil } func (b *Bebop) Down(val int) error { + b.Pcmd.Flag = 1 b.Pcmd.Gaz = validatePitch(val) * -1 return nil } func (b *Bebop) Forward(val int) error { + b.Pcmd.Flag = 1 b.Pcmd.Pitch = validatePitch(val) return nil } func (b *Bebop) Backward(val int) error { + b.Pcmd.Flag = 1 b.Pcmd.Pitch = validatePitch(val) * -1 return nil } func (b *Bebop) Right(val int) error { + b.Pcmd.Flag = 1 b.Pcmd.Roll = validatePitch(val) return nil } func (b *Bebop) Left(val int) error { + b.Pcmd.Flag = 1 b.Pcmd.Roll = validatePitch(val) * -1 return nil } func (b *Bebop) Clockwise(val int) error { + b.Pcmd.Flag = 1 b.Pcmd.Yaw = validatePitch(val) return nil } func (b *Bebop) CounterClockwise(val int) error { + b.Pcmd.Flag = 1 b.Pcmd.Yaw = validatePitch(val) * -1 return nil } func (b *Bebop) Stop() error { b.Pcmd = Pcmd{ - Flag: 1, + Flag: 0, Roll: 0, Pitch: 0, Yaw: 0, diff --git a/platforms/bebop/client/examples/takeoff.go b/platforms/bebop/client/examples/takeoff.go index 9ee9a723..0bc2b072 100644 --- a/platforms/bebop/client/examples/takeoff.go +++ b/platforms/bebop/client/examples/takeoff.go @@ -15,10 +15,7 @@ func main() { return } - fmt.Println("hull") bebop.HullProtection(true) - //fmt.Println("outdoor") - //bebop.Outdoor(false) fmt.Println("takeoff") if err := bebop.TakeOff(); err != nil {