Skip to content

Commit

Permalink
motorutil: add conditional stop command for zero relative position case
Browse files Browse the repository at this point in the history
  • Loading branch information
kortschak committed Sep 18, 2017
1 parent 9616c8c commit 8b65272
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions motorutil/steer.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,23 @@ func (s *Steering) SteerCounts(speed, turn, counts int) *Steering {
return s
}

s.err = s.Left.Command("run-to-rel-pos").Err()
// TODO(kortschak): Remove conditional stop when the

This comment has been minimized.

Copy link
@dlech

dlech Sep 18, 2017

Contributor

BTW, ev3dev-jessie is "done", so this will only be getting fixed in ev3dev-stretch.

This comment has been minimized.

Copy link
@kortschak

kortschak Sep 18, 2017

Author Member

Understood.

// driver handles zero relative position change as a no-op.
if leftCounts == 0 {
s.err = s.Left.Command("stop").Err()
} else {
s.err = s.Left.Command("run-to-rel-pos").Err()
}
if s.err != nil {
return s
}
s.err = s.Right.Command("run-to-rel-pos").Err()
// TODO(kortschak): Remove conditional stop when the
// driver handles zero relative position change as a no-op.
if rightCounts == 0 {
s.err = s.Right.Command("stop").Err()
} else {
s.err = s.Right.Command("run-to-rel-pos").Err()
}
if s.err != nil {
s.Left.Command("stop").Err()
}
Expand Down

0 comments on commit 8b65272

Please sign in to comment.