Last active
August 29, 2015 13:57
-
-
Save kcranley1/9408042 to your computer and use it in GitHub Desktop.
My version of robot_teleop.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/python | |
# robot_teleop.py | |
import pibot | |
import time | |
TURN_TIME = 0.2 | |
bot = pibot.PiBot() | |
while True: | |
# Read commands from the user | |
command = raw_input( ": " ) | |
command = command.strip().lower() | |
if len( command ) > 0: | |
commandLetter = command[ 0 ] | |
if commandLetter == "f": | |
bot.setMotorSpeeds( 128, 128 ) | |
elif commandLetter == "b": | |
bot.setMotorSpeeds( -128, -128 ) | |
elif commandLetter == "l": | |
bot.setMotorSpeeds( -128, 128 ) | |
time.sleep( TURN_TIME ) | |
bot.setMotorSpeeds( 0, 0 ) | |
elif commandLetter == "r": | |
bot.setMotorSpeeds( 128, -128 ) | |
time.sleep( TURN_TIME ) | |
bot.setMotorSpeeds( 0, 0 ) | |
elif commandLetter == "s": | |
bot.setMotorSpeeds( 0, 0 ) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment