Example #1
0
gps.enable(TIME_STEP)
#for manually controlling the car
CONTROL_MODE = 1
#Enabling keyboard to control different funcitons
keyboard = Keyboard()
keyboard.enable(TIME_STEP)

#initialize camera
cam1 = robot.getCamera("camera1")
cam1.enable(TIME_STEP)
cam1.recognitionEnable(TIME_STEP)
cam1m = robot.getMotor("camera_motor")

cam1m.setPosition(float("inf"))
cam1m.setVelocity(0.0)
connector = robot.getConnector('DUMMY_BACK_LATCH')
connector.enablePresence(TIME_STEP)

################################################ for sequence global variable
start_find = 0  # set to 1 when rrt is finished and is starting to find latch
start_rrt = 0  # set to 1 when hook car received command from server and find path to a nearby location of dummy car

################################################ global variable for move_to_latch()
goal_x = -1  #dummy car location in term of x axis
goal_y = -1  #dummy car location in term of y axis
dum_loc = []  # the 4 location around the dummy car
dum_angle = -361  # the orientation of dum car
dum_loc.append((-100, -100))  #top
dum_loc.append((-100, -100))  #right
dum_loc.append((-100, -100))  #bot
dum_loc.append((-100, -100))  #left