def test_clip_min(): expect(clip(-1)).to(equal(0))
def test_clip_max(): expect(clip(101)).to(equal(100))
def test_unclipped(): expect(clip(1)).to(equal(1))
def forward_increase(self, turning=True): self.speed = clip(ForwardMotorCommands.increase_speed(self.speed, turning), -100)
def reverse_decrease(self, turning=True): self.speed = clip(ReverseMotorCommands.decrease_speed(self.speed, turning), -100)
def _set_speed(self, speed): speed = clip(abs(speed)) self._speed_control.ChangeDutyCycle(speed) return speed