【发布时间】:2018-07-24 15:35:39
【问题描述】:
我的项目的目标是对 NAO 机器人进行编程,以使用神经网络检测和识别机器人。我在 MatLab 中使用神经网络对对象进行分类,我正在编写脚本以通过 Python 中的 NAO 机器人捕获图像。我有所有必要的导入(来自 naoqi 的 ALProxy、来自 PIL 的图像、随机、时间、os、sys、cv2 和 vision_definitions)并在 python 代码中为每个代理配置了 ip 和端口(postureProxy、motionProxy、speechProxy 、anspeechProxy、sprecogProxy、memoryProxy 和 photoCaptureProxy)。
try:
photoCaptureProxy = ALProxy("ALPhotoCapture", ip, port)
#this was done for each proxy listed above
except Exception, error:
print("Connection error: ", error)
如果我的连接有任何问题,我会打印出错误信息,而且我确实做到了。我收到如下错误通知:
RuntimeERror('\tALBroker::createBroker\n\tCannot connect to tcp://ip:port',))
我知道,由于涉及 TCP,计算机和 NAO 机器人之间的有线连接出现问题。有没有解决这个问题的方法?
下面是一段较大的代码:
ip = "192.168.208.254"
port = 9559
#ALProxy setups
try:
postureProxy = ALProxy("ALRobotPosture", ip, port)
motionProxy = ALProxy("ALMotion", ip, port)
speechProxy = ALProxy("ALTextToSpeech", ip, port)
anspeechProxy = ALProxy("ALAnimatedSpeech", ip, port)
sprecogProxy = ALProxy("ALSpeechRecognition", ip, port)
memoryProxy = ALProxy("ALMemory", ip, port)
photoCaptureProxy = ALProxy("ALPhotoCapture", ip, port)
except Exception, error:
print("Connection error: ", error)
resolution = vision_definitions.kVGA
colorSpace = vision_definitions.kYUVColorSpace
fps = 30
【问题讨论】: