1

When I try to get data from ALMemory with the following code:

session.service("ALMemory").done(function (ALMemory) {
    var value = ALMemory.getData("ALTextToSpeech/TextDone");
});

This value is of type AL::ALValue. How can I cast it to int, because in this case it is expected to be 0 for currently speaking and 1 for currently not speaking. I have tried to cast it to int or to number or to string with different methods, but with no success.

When I am using this functionality with python SDK:

def onLoad(self):
    self.memory = ALProxy("ALMemory")

def onUnload(self):
    self.memory = None

def onInput_checkIfSpeaking(self, p):
    value = self.memory.getData("ALTextToSpeech/TextDone")

this value is of type int, not AL::ALValue. Is that possible to be achieved with JavaScript?

stefan.stt
  • 2,357
  • 5
  • 24
  • 47

2 Answers2

4

Set your value in a callback (all functions return promises, on which you can attach callbacks: promise.then(onFulfilled, onRejected)):

session.service("ALMemory").then( function (ALMemory) {
    ALMemory.getData("ALTextToSpeech/TextDone").then( function (TextDone) {
         var value = TextDone;
    });
});

For the record, the documentation is here: http://doc.aldebaran.com/2-5/dev/js/index.html

JLS
  • 968
  • 5
  • 12
0

Did you try a standard java:

value = (int)(self.memory.getData("ALTextToSpeech/TextDone")) 

?

Alexandre Mazel
  • 2,462
  • 20
  • 26