如何以编程方式在NAO上下载和上传文件

时间:2016-12-11 17:53:10

标签: nao-robot

我想从Robot nao下载文件/recordings/cameras到我的电脑。 我怎样才能做到这一点 ?请给我一个例子(脚本)。

1 个答案:

答案 0 :(得分:1)

你可以使用Paramiko包。

import paramiko


NAO_IP = "put_nao_ip_here"
NAO_USERNAME = "put_nao_username_here"
NAO_PASSWORD = "put_nao_password_here"

ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh.connect(NAO_IP, username=NAO_USERNAME, password=NAO_PASSWORD)
sftp = ssh.open_sftp()
localpath = 'path to save the file locally with filename'
remotepath = '/recordings/cameras/<filename>'
sftp.get(remotepath, localpath)
sftp.close()
ssh.close()