Using lego nxt with color sensor and ultrasonic sensor. Trying to create a soccer control loop which controls the lego nxt to behave like it is playing football in a rectangular wooden built football field with 4 side walls and two goals.I have the following three methods: 1. turn_to ball 2. move_to ball 3. kick_ball
and i am passing the coordinates in a loop:
screenw = 0
screenh = 0
while 1:
client_socket.send("loc\n")
data = client_socket.recv(8192)
valueList = data.split()
if (not(valueList[-1] == "eom" and valueList[0] == "start")):
#print "continuing.."
continue
if(screenw != int(valueList[2])):
screenw = int(valueList[2])
screenh = int(valueList[3])
How do i create a soccer control loop that runs these three methods turn_to ball, move to ball and kick ball in a loop given that it will avoid collision with walls?