Exemple #1
0
def main(macs,robot_ids):

	log('Connecting with the ePuck')
	try:
		# First, create an ePuck object.
		# If you want debug information:
		#~ robot = ePuck(mac, debug = True)
		# else:
		robotlist = []

		for mac in macs:
			robot = ePuck(mac,debug=False)
			# Second, connect to it
			robot.connect()
			# You can enable various sensors at the same time. Take a look to
			# to DIC_SENSORS for know the name of the sensors
			robot.enable('floor')
			robotlist.append(robot)

		log('Conection complete. CTRL+C to stop')
		log('Library version: ' + robot.version)

	except Exception, e:
		error(e)
		sys.exit(1)
Exemple #2
0
def main(mac):

    global_speed = 180
    fs_speed = 0.6
    threshold = 1000

    log('Conecting with ePuck')
    try:
        # First, create an ePuck object.
        # If you want debug information:
        #~ robot = ePuck(mac, debug = True)
        # else:
        robot = ePuck(mac)

        # Second, connect to it
        robot.connect()

        # You can enable various sensors at the same time. Take a look to
        # to DIC_SENSORS for know the name of the sensors
        robot.enable('floor', 'proximity')

        leds_on = [0] * 8
        log('Conection complete. CTRL+C to stop')
        log('Library version: ' + robot.version)

        times_got = []
    except Exception, e:
        error(e)
        sys.exit(1)
Exemple #3
0
def main(mac):
    global_speed = 180
    fs_speed = 0.6
    threshold = 1000

    window_name = 'image'
    cv2.namedWindow(window_name, 1)

    print('Connecting with the ePuck')
    try:
        # First, create an ePuck object.
        # If you want debug information:
        # ~ robot = ePuck(mac, debug = True)
        # ele:
        robot = ePuck(mac)

        # Second, connect to it
        robot.connect()

        # You can enable various sensors at the same time. Take a look to
        # to DIC_SENSORS for know the name of the sensors
        robot.enable('camera')

        # We have to set the camera parameters
        robot.set_camera_parameters('RGB_365', 40, 40, 8)

        log('Conection complete. CTRL+C to stop')
        log('Library version: ' + robot.version)

    except Exception, e:
        error(e)
        sys.exit(1)
Exemple #4
0
def main(mac):
	
	global_speed = 180
	fs_speed = 0.6
	threshold = 1000

	log('Conecting with ePuck')
	try:
		# First, create an ePuck object.
		# If you want debug information:
		#~ robot = ePuck(mac, debug = True)
		# else:
		robot = ePuck(mac)

		# Second, connect to it
		robot.connect()
		
		# You can enable various sensors at the same time. Take a look to
		# to DIC_SENSORS for know the name of the sensors
		robot.enable('floor', 'proximity')

		leds_on = [0] * 8
		log('Conection complete. CTRL+C to stop')
		log('Library version: ' + robot.version)
	
		times_got = []
	except Exception, e:
		error(e)
		sys.exit(1)
Exemple #5
0
def main(mac):
	
	global_speed = 180
	fs_speed = 0.6
	threshold = 1000

	print('Connecting with the ePuck')
	try:
		# First, create an ePuck object.
		# If you want debug information:
		#~ robot = ePuck(mac, debug = True)
		# ele:
		robot = ePuck(mac)

		# Second, connect to it
		robot.connect()

		# You can enable various sensors at the same time. Take a look to
		# to DIC_SENSORS for know the name of the sensors
		robot.enable('camera', 'motor_position')

		# We have to set the camera parameters
		robot.set_camera_parameters('RGB_365', 40, 40, 8)
		
		log('Conection complete. CTRL+C to stop')
		log('Library version: ' + robot.version)
	
	except Exception, e:
		error(e)
		sys.exit(1)
Exemple #6
0
def main(mac):
	
	log('Connecting with the ePuck')
	try:
		# First, create an ePuck object.
		# If you want debug information:
		#~ robot = ePuck(mac, debug = True)
		# else:
		robot = ePuck(mac)

		# Second, connect to it
		robot.connect()

		# You can enable various sensors at the same time. Take a look to
		# to DIC_SENSORS for know the name of the sensors
		robot.enable('proximity')
		
		log('Conection complete. CTRL+C to stop')
		log('Library version: ' + robot.version)
	
	except Exception, e:
		error(e)
		sys.exit(1)
Exemple #7
0
from ePuck import ePuck
from ePuckUtil import *
import sys
import re
import cv2
import time

try:
    mac = epucks['3674']
    robot = ePuck(mac, debug=True)
    robot.connect()
    msg = robot.send_and_receive('V\n')
    print msg
    msg = robot.send_and_receive('V\n')
    print msg
    msg = robot.send_and_receive('V\n')
    print msg
    msg = robot.send_and_receive('V\n')
    print msg

    cv2.namedWindow('test', 1)
    robot.enable('camera')
    robot.set_camera_parameters('RGB_365', 40, 40, 1)
    while (1):
        robot.step()
        image = robot.get_image()
        print 'image: ', image
        robot.show_image('test')

except KeyboardInterrupt:
    print '\n'
Exemple #8
0
 def __init__(self, ttydev="/dev/ttyO0", epuck_name="epuck"):
     self._driver = ePuck(ttydev, False)
     self._name = epuck_name
Exemple #9
0
	def __init__(self, ttydev="/dev/ttyO0", epuck_name="epuck"):
		self._driver = ePuck(ttydev, False)
		self._name = epuck_name
#note we also have to specify the type to retrieve other wise we only get a
# FileNode object back instead of a matrix

mtx = cv_file.getNode("camera_matrix").mat()
dist = cv_file.getNode("dist_coeff").mat()

markerLength = 0.08

print('Connecting with the ePuck')

try:
    # First, create an ePuck object.
    # If you want debug information:
    # ~ robot = ePuck(mac, debug = True)
    # ele:
    robot1 = ePuck(epucks['3281'])
    robot2 = ePuck(epucks['3276'])
    robot3 = ePuck(epucks['3214'])
    # Second, connect to it
    robot1.connect()
    robot2.connect()
    robot3.connect()

    # You can enable various sensors at the same time. Take a look to
    # to DIC_SENSORS for know the name of the sensors

    for i in range(1, 8):
        robot1.set_led(i, 1)
        robot2.set_led(i, 1)
        robot3.set_led(i, 1)
Exemple #11
0
    while current_state != goal_state:

        action = int(np.argmax(Q[current_state]))
        time.sleep(0.2)
        Act(action, current_orientation)
        time.sleep(1)
        current_orientation = action
        current_state = read_state()
        print "State Reading: State%d" % current_state


# ---------------------------------------------
# Main body
print " Program started "
epuck = ePuck.ePuck("10:00:E8:D3:AA:03", False)

epuck.connect()
#robot.enable('floor', 'proximity')
epuck.enable('floor')

reward = np.array([
    [0, 0, -1, 0],  #0
    [0, 10, -10, -1],
    [-1, -1, 0, -1],
    [10, -1, 0, -1],
    [-1, 0, -10, -1],
    [0, -1, -1, -1],  #5
    [-1, -1, 10, 0],
    [-1, 0, -1, -1],
    [0, -1, -1, -1],
Exemple #12
0
markerLength = 0.08  # SET MARKER LENGTH IN (M)

print('Connecting with the ePuck')

# CONNECT WITH E-PUCKS - ALL LEDS LIGHT WHEN CONNECTED
try:
    # First, create an ePuck object.
    # If you want debug information:
    # ~ robot = ePuck(mac, debug = True)
    # else:
    # robot1 = ePuck(epucks['3109'])
    # robot2 = ePuck(epucks['3276'])
    # robot3 = ePuck(epucks['3214'])

    robot1 = ePuck(epucks['3279'])
    robot2 = ePuck(epucks['3276'])
    robot3 = ePuck(epucks['3305'])

    # Second, connect to it
    robot1.connect()
    robot2.connect()
    robot3.connect()

    robot1.enable('proximity')
    robot2.enable('proximity')
    robot3.enable('proximity')

    # You can enable various sensors at the same time. Take a look to DIC_SENSORS for know the name of the sensors
    for i in range(1, 8):  # turn on all lights
        robot1.set_led(i, 1)
markerLength = 0.08   # SET MARKER LENGTH IN (M)

print('Connecting with the ePuck')

# CONNECT WITH E-PUCKS - ALL LEDS LIGHT WHEN CONNECTED
try:
	# First, create an ePuck object.
    # If you want debug information:
    # ~ robot = ePuck(mac, debug = True)
    # else:
    # robot1 = ePuck(epucks['3109'])
    # robot2 = ePuck(epucks['3276'])
    # robot3 = ePuck(epucks['3214'])
	
	robot1 = ePuck(epucks['3279'])
	robot2 = ePuck(epucks['3302'])
	robot3 = ePuck(epucks['3305'])
	robot4 = ePuck(epucks['3111'])
	# Second, connect to it
	robot1.connect()
	robot2.connect()
	robot3.connect()
	robot4.connect()
	
	# You can enable various sensors at the same time. Take a look to DIC_SENSORS for know the name of the sensors
	for i in range(1, 8):  # turn on all lights
		robot1.set_led(i, 1)
		robot2.set_led(i, 1)
		robot3.set_led(i, 1)
		robot4.set_led(i, 1)