example.py
Go to the documentation of this file.
00001 import sys
00002 import time
00003 import math
00004 from robot import RobotControlClient
00005 
00006 # Test Application
00007 HOST = 'localhost'
00008 #HOST = '127.0.0.1'
00009 PORT = 5512
00010 
00011 if(len(sys.argv) >= 2):
00012         HOST = sys.argv[1]
00013 if(len(sys.argv) >= 3):
00014         PORT = int(sys.argv[2])
00015 
00016 print "Using host: " + HOST + " on port: %d" % PORT
00017         
00018 robotControlClient = RobotControlClient(HOST, PORT)
00019 robotControlClient.connect()
00020 
00021 # Move forward at 0.3 meters / second
00022 robotControlClient.moveForward(0.3);
00023 time.sleep(5); # continue moving for 5 seconds
00024 
00025 # Start the robot turning CCW at 20 deg / sec
00026 robotControlClient.turnLeft(20.0 * math.pi / 180.0);
00027 time.sleep(5); # continue turning for 5 seconds
00028 
00029 # Start the robot turning CW at 20 deg / sec
00030 robotControlClient.turnRight(20.0 * math.pi / 180.0);
00031 time.sleep(5); # continue turning for 5 seconds
00032 
00033 # Stop the Robot
00034 robotControlClient.stop()
00035 time.sleep(5); # pause for 5 seconds
00036 
00037 # Move forward at 0.3 meters / second
00038 robotControlClient.moveForward(0.3);
00039 time.sleep(3); # continue moving for 3 seconds
00040 
00041 # Stop the Robot
00042 robotControlClient.stop()
00043 
00044 # Close the connection to the robot
00045 robotControlClient.disconnect()


tcp_command
Author(s): Hunter Allen
autogenerated on Mon Oct 6 2014 08:35:12