예제 #1
0
파일: ui.py 프로젝트: deweyjose/rover
def publish(command):
    rconn.publish('rover', command)
예제 #2
0
파일: execute.py 프로젝트: deweyjose/rover
import commands
from settings import rconn

if __name__ == '__main__':
    while True:
        message = raw_input('Enter a command to execute: ')
        
        if commands.can_dispatch(message):        
            rconn.publish('rover', message)
        elif commands.execute(message) == False:
            break;
예제 #3
0
파일: distance.py 프로젝트: deweyjose/rover
    distance = duration * speed
    distance = round(distance, 2)
    
    LOGGER.debug("Distance: {0}cm".format(distance))
    
    return distance

if __name__ == '__main__':
    delay = float(sys.argv[1])
    limit = float(sys.argv[2])
    count = int(sys.argv[3])
    
    startup()
    
    total = 0
    stop_count = 0
    while True:
        current_distance = read_distance()
        if current_distance < limit:
            stop_count += 1
            if stop_count > 3:
                LOGGER.warn("stopping rover. current distance is {0}cm".format(current_distance))
                rconn.publish('rover', 'stop')
                stop_count = 0
        else:
            stop_count=0
        time.sleep(delay)
        total += current_distance
        
    LOGGER.info("avg distance {0}".format(total/count))