IR 360 Locator

Gather the parts above. The hardware is all 6-32.
Attach standoffs from bottom
Attach sensor to the top.
Plug sensor into the I2C ports... make sure the black wire is on the black side.
IR Beacon

Reading the values

import Fusion

# Class definitions -----------------------------------------------------------
f = Fusion.driver()
l = Fusion.locator360(f)

# Program Start ---------------------------------------------------------------
while True:
    print ("Heading   = " + str(l.getHeading(1200)))
    print ("Intensity = " + str(l.getIntensity(1200)))
    print("") 
    f.delay(0.25)
import Fusion

# Object definitions -----------------------------------------------------------
f = Fusion.driver()
l = Fusion.locator360(f)

#while we are close to the beacon, straight away from it...
while (l.getIntensity(1200) > 50):
# the sensor will have a heading of 35 when it is 
## pointing 180 degrees away from the beacon
    if(l.getHeading(1200) < 34):
        #turn counterclockwise
        f.motorSpeed(f.M0, 30)
        f.motorSpeed(f.M1, -30)
    elif(l.getHeading(1200) > 36):
        #turn clockwise
        f.motorSpeed(f.M0, -30)
        f.motorSpeed(f.M1, 30)
    else:
        #straight
        f.motorSpeed(f.M0, 50)
        f.motorSpeed(f.M1, 50)
        
#stop the robot now that we are far enough away        
f.motorSpeed(f.M0, 0)
f.motorSpeed(f.M1, 0)
#shoot the ball!

Last updated

Was this helpful?