Esempio n. 1
0
def init():
    """
    Initialize sonar object.
    """
    global front, front_right, right, back_right, back, back_left, left, front_left, pinger, speed_timer

    front = MaxSonarEZPulseWidth(robotmap.sonar.front_channel, inch)
    front_right = MaxSonarEZPulseWidth(robotmap.sonar.front_right_channel, inch)
    right = MaxSonarEZPulseWidth(robotmap.sonar.right_channel, inch)
    back_right = MaxSonarEZPulseWidth(robotmap.sonar.back_right_channel, inch)
    back = HRLVMaxSonarEZPulseWidth(robotmap.sonar.back_channel, inch)
    back_left = MaxSonarEZPulseWidth(robotmap.sonar.back_left_channel, inch)
    left = MaxSonarEZPulseWidth(robotmap.sonar.left_channel, inch)
    front_left = MaxSonarEZPulseWidth(robotmap.sonar.front_left_channel, inch)

    pinger = DigitalOutput(robotmap.sonar.pinger_channel)
    speed_timer.start()
    ping_timer.start()