今天是周末,打算回顾这一周的学习任务,进行总结。早上看的代码是nao机器人动作关节值的记录的方法。涉及到python语法读文件写文件的基本使用。自己写了一遍,还是有收获的。
""" recoding some seesors values and write them into a file
"""
#ALMEMORY_KEY_VALUES is the list of ALMemory values names you want to save
ALMEMORY_KEY_VALUES=[
"Device/SubDeviceList/HeadYaw/Position/Sensor/Value",
"Device/SubDeviceList/HeadYaw/Position/Actutor/Value",
]
NAO_IP="nao.local"
import sys
import time
import os
from naoqi import ALProxy
def recordData(NAO_IP):
"""record the data from almemory
return the matrix of values
"""
print "record data is..."
memory=ALProxy("ALMemory",NAO_IP,9559)
data=list()
for i in range(1,100):
line=list()