Esempio n. 1
0
    ROBOT_ROOT = '/home/robot/'

    ##Adafruit_BBIO:
    import Adafruit_BBIO.GPIO as GPIO

elif path.isfile(path.expanduser('~/.robotConf')):
    #If we're not on an actual robot, check if we have
    #a working environment set for robot debugging:
    CONFIG_FILE = open(path.expanduser('~/.robotConf'), 'r')
    ROBOT_ROOT = CONFIG_FILE.read().strip()
    CONFIG_FILE.close()

    import Adafruit_BBIO_SIM.GPIO as GPIO

    #Simulator setup
    GPIO.pin_association(LEDS_GPIO["STATUS"][1], 'STATUS led')
    GPIO.setup_behavior('print')
else:
    ROBOT_ROOT = ''
    print('It seems like you are NOT working on an actual robot. \
You should set up a debugging environment before running any code (see documentation)')

#Logging Initialization :
LOGGER = robotLogger("FL > led", ROBOT_ROOT+'logs/fl/')

###########################################################################
#                           I/O Initialization :                          #
###########################################################################

GPIO.setup(LEDS_GPIO["STATUS"][1], GPIO.OUT)
GPIO.output(LEDS_GPIO["STATUS"][1], GPIO.LOW)
Esempio n. 2
0
    import Adafruit_BBIO.GPIO as GPIO
    import Adafruit_BBIO.PWM as PWM
elif path.isfile(path.expanduser('~/.robotConf')):
    #If we're not on an actual robot, check if we have
    #a working environment set for robot debugging:
    CONFIG_FILE = open(path.expanduser('~/.robotConf'), 'r')
    ROBOT_ROOT = CONFIG_FILE.read().strip()
    CONFIG_FILE.close()

    import Adafruit_BBIO_SIM.GPIO as GPIO
    import Adafruit_BBIO.PWM as PWM

    #Simulator setup
    PWM.pin_association(GPIODEF.ENGINES["left"]["PWM"], 'left motor\'s PWM')
    PWM.pin_association(GPIODEF.ENGINES["right"]["PWM"], 'right motor\'s PWM')
    GPIO.pin_association(GPIODEF.ENGINES["left"]["forward"], 'left motor\'s forward pin')
    GPIO.pin_association(GPIODEF.ENGINES["right"]["forward"], 'right motor\'s forward pin')
    GPIO.pin_association(GPIODEF.ENGINES["left"]["backward"], 'left motor\'s backward pin')
    GPIO.pin_association(GPIODEF.ENGINES["right"]["backward"], 'right motor\'s backward pin')
    GPIO.setup_behavior('print')
    PWM.setup_behavior('print')
else:
    ROBOT_ROOT = ''
    print('It seems like you are NOT working on an actual robot. \
You should set up a debugging environment before running any code (see documentation)')

#Logging Initialization :
LOGGER = robotLogger("FL > mot", ROBOT_ROOT+'logs/fl/')

###########################################################################
#                           I/O Initialization :                          #
Esempio n. 3
0
    ##Adafruit_BBIO:
    import Adafruit_BBIO.GPIO as GPIO

elif path.isfile(path.expanduser('~/.robotConf')):
    #If we're not on an actual robot, check if we have
    #a working environment set for robot debugging:
    CONFIG_FILE = open(path.expanduser('~/.robotConf'), 'r')
    ROBOT_ROOT = CONFIG_FILE.read().strip()
    CONFIG_FILE.close()

    import Adafruit_BBIO_SIM.GPIO as GPIO

    #Simulator setup
    for name, detail in LEDS_GPIO.items():
        GPIO.pin_association(detail[1], name+' blinker')
    GPIO.setup_behavior('print')
else:
    ROBOT_ROOT = ''
    print('It seems like you are NOT working on an actual robot. \
You should set up a debugging environment before running any code (see documentation)')

#Logging Initialization :
LOGGER = robotLogger("FL > led", ROBOT_ROOT+'logs/fl/')

###########################################################################
#                           I/O Initialization :                          #
###########################################################################

for LED in LEDS_PINS:
    #Declare motor enabling pins as outputs
Esempio n. 4
0
LOOKFOR = 0 #0 = RED, 1 = GREEN


#If we are on an actual robot :
if path.isdir("/home/robot"):
    ROBOT_ROOT = '/home/robot/'
elif path.isfile(path.expanduser('~/.robotConf')):
    #If we're not on an actual robot, check if we have
    #a working environment set for robot debugging:
    CONFIG_FILE = open(path.expanduser('~/.robotConf'), 'r')
    ROBOT_ROOT = CONFIG_FILE.read().strip()
    CONFIG_FILE.close()

    #Simulator setup
    GPIO.pin_association(RESET_GPIO, 'pushbutton\'s state')
    GPIO.setup_behavior('print')
else:
    ROBOT_ROOT = ''
    print('It seems like you are NOT working on an actual robot. \
You should set up a debugging environment before running any code (see documentation)')

#Logging Initialization :
LOGGER = robotLogger("FL > pb", ROBOT_ROOT+'logs/fl/')


#######################################################################
#                    CONSTANTS FOR IMAGE PROCESSING                   #
#######################################################################
BOUNDARIES = [[[255, 150, 237], [161, 87, 159]], [[70, 141, 255], [23, 44, 138]]]
ERODE = 1
Esempio n. 5
0

#!/usr/bin/python3.5
#-*- coding: utf-8 -*-

#Standard imports :
import time


#Specific imports :
from robotBasics.constants import gpiodef as GPIODEF
import Adafruit_BBIO.GPIO as GPIO
import Adafruit_BBIO.PWM as PWM


"""
####################################################
#               Simulator setup                    #
####################################################

GPIO.pin_association(GPIODEF.ENGINES["left"]["PWM"], 'left motor\'s PWM')
GPIO.pin_association(GPIODEF.ENGINES["right"]["PWM"], 'right motor\'s PWM')
PWM.pin_association(GPIODEF.ENGINES["left"]["forward"], 'left motor\'s forward pin')
PWM.pin_association(GPIODEF.ENGINES["right"]["forward"], 'right motor\'s forward pin')
PWM.pin_association(GPIODEF.ENGINES["left"]["backward"], 'left motor\'s backward pin')
PWM.pin_association(GPIODEF.ENGINES["right"]["backward"], 'right motor\'s backward pin')
GPIO.setup_behavior('print')
PWM.setup_behavior('print')
"""

####################################################
Esempio n. 6
0
    ##Adafruit_BBIO:
    import Adafruit_BBIO.GPIO as GPIO

elif path.isfile(path.expanduser('~/.robotConf')):
    #If we're not on an actual robot, check if we have
    #a working environment set for robot debugging:
    CONFIG_FILE = open(path.expanduser('~/.robotConf'), 'r')
    ROBOT_ROOT = CONFIG_FILE.read().strip()
    CONFIG_FILE.close()

    import Adafruit_BBIO_SIM.GPIO as GPIO

    #Simulator setup
    for name, pin in LEDS_GPIO.items():
        GPIO.pin_association(pin, name+' blinker')
    GPIO.setup_behavior('print')
else:
    ROBOT_ROOT = ''
    print('It seems like you are NOT working on an actual robot. \
You should set up a debugging environment before running any code (see documentation)')

#Logging Initialization :
LOGGER = robotLogger("FL > led", ROBOT_ROOT+'logs/fl/')

###########################################################################
#                           I/O Initialization :                          #
###########################################################################

for LED in LEDS_PINS:
    #Declare motor enabling pins as outputs