NAO robot supports infrared receiving/sending of information. Following blocks are available in choreographe:
Full specification can be found here:
NAO infra-red
# -*- encoding: UTF-8 -*-
"""
Send an element of each of the 3 supported data type to nao
"""
from naoqi import ALProxy
import time
lirc=ALProxy("ALInfrared","127.0.0.1",9559) # change IP with NAO IP
lirc.sendIpAddress("127.0.0.1") # Send IP address
time.sleep(0.5) # Delay necessary for a reliable transfer
lirc.send8(42) # Send the number 42
time.sleep(0.5)
lirc.send32(0x42, 0x2A, 0x13, 0x0D) # Send one 32 bits number
time.sleep(0.5)
lirc.send32("36757575") # Send one 32 bits number
As well as receiving data (in this example a callback is registered with an action to perform when NAO receives an IP address):
# -*- encoding: UTF-8 -*-
"""Receive an IP address"""
import naoqi
import time
# create python module
class myModule(naoqi.ALModule):
def pythondatachanged(self, strVarName, value, strMessage):
"""callback when data change"""
print "IP address = ", value, " ", strMessage
# call method
try:
pythonModule = myModule("pythonModule")
prox = naoqi.ALProxy("ALMemory")
prox.subscribeToEvent("InfraRedIpAdressReceived", "pythonModule", "pythondatachanged")
except Exception, e:
print "error"
print e
exit(1)
time.sleep(10)
exit(0)
Other robots in the lab support sending and receiving messages, for example like EV3:
A similar mechanism could be implemented having IR instead of bluetooth as connection media.