PHP shell_exec与python naoqi:“qimessaging.socketcache:过滤后没有更多端点可用”

问题描述 投票:0回答:1

当我使用shell_exec在PHP中执行它时,我似乎无法使我的python脚本工作

我在choregraphe中使用虚拟机器人

这是我的代码:PHP

$command = escapeshellcmd("python test.py");
$output = shell_exec ($command);
echo $output;

蟒蛇:

from naoqi import ALProxy
import os,sys
import motion

#import qi.logging
#qi.logging.setLevel(qi.logging.FATAL)

pFractionMaxSpeed=0.4
mp = ALProxy("ALMotion", "127.0.0.1",51712)
JointName = JointNames = ["LShoulderRoll","LShoulderPitch","LElbowYaw","LElbowRoll","LHand"]
Arm1 = [90,0,-90,-85,90]
Arm1 = [ x * motion.TO_RAD for x in Arm1]
mp.post.angleInterpolationWithSpeed(JointNames, Arm1, pFractionMaxSpeed)

如果我只是通过cmd运行python,那么它工作正常并使机器人移动。

我认为这与它作为www-data用户运行有关,它会混淆naoqi模块(或类似的东西):link

我只是不确定如何在Windows中使用XAMPP或WAMP

php python robot nao-robot
1个回答
0
投票

可能是您的www-data用户无法访问端口51712(或者Choregraphe的虚拟nao正在使用的端口 - 它可能在会话之间发生变化,您检查过吗?)。也许您可以尝试从PHP代码运行telnet 127.0.0.1 51712 - 如果这不起作用,qimessaging也将无法连接到该端口。

© www.soinside.com 2019 - 2024. All rights reserved.