SHARE
TWEET

Untitled

a guest Oct 23rd, 2019 82 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. """My fourth robot."""
  2. from PiBot import PiBot
  3.  
  4. robot = PiBot()
  5.  
  6.  
  7. def go_straight():
  8.     """Go straight."""
  9.     robot.set_wheels_speed(14)
  10.     robot.sleep(0.05)
  11.  
  12.  
  13. def turn_around():
  14.     """Turn 360 degrees."""
  15.     r_rotations = robot.get_right_wheel_enconder()
  16.     while robot.get_right_wheel_enconder() - r_rotations < 360:
  17.         robot.set_left_wheel_speed(-13)
  18.         robot.set_right_wheel_speed(13)
  19.         print(robot.get_right_wheel_enconder())
  20.     robot.set_wheels_speed(0)
  21.    
  22.  
  23. # Robot peab seisma jääma kujuteldavas ringis, mis on ümber objekti raadiusega 10 cm.
  24. while True:
  25.     turn_around()
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top