我正在为Aldebaran的Pepper机器人编写应用程序。我正在使用Choregraphe,我制作了一个用于在机器人平板电脑中显示的HTML。我已经制作了用于显示网页的框,我需要将一个变量从Python传递到网络Javascript。
有什么办法吗?
Python代码与Raise Event框的默认值相同,它接收一个字符串" IMAGE"在他的onStart
输入:
class MyClass(GeneratedClass):
def __init__(self):
GeneratedClass.__init__(self)
pass
def onLoad(self):
self.memory = ALProxy("ALMemory")
def onUnload(self):
self.memory = None
def onInput_onStart(self, p):
self.memory.raiseEvent(self.getParameter("key"), p)
self.onStopped(p)
def onInput_onStop(self):
self.onUnload() #~ it is recommended to call onUnload of this box in a onStop method, as the code written in onUnload is used to stop the box as well
pass
Javascript代码是这样的:
$('document').ready(function(){
var session = new QiSession();
session.service("ALMemory").done(function (ALMemory) {
ALMemory.subscriber("PepperQiMessaging/totablet").done(function(subscriber) {
$("#log").text("AAA");
subscriber.signal.connect(toTabletHandler);
});
});
function toTabletHandler(value) {
$("#log").text("-> ");
}
});
它进入第一个#log
但不是第二个JS。