'Make choregraphe app predefined Pepper naoqi 2.5

I have an application to host a webpage that will be the menu of the robot so I need it to be executing all the time unless my other apps are on use. I have tried with trigger condition = 1:

  • Nature = Interactive: The app block other interactive apps such as face recognition and will not execute if other apps are running.
  • Nature = Solitary: The app is stopped when other interactive apps start (for example when a face is recognized) The only important part of it is on the html part so maybe the approach is not correct.


Solution 1:[1]

I solved it by using:

  1. Interactive nature with trigger condition as "1": makes the app run under any circumstances. (Solved in this stack overflow thread)
  2. Setting my appplication's behavior as default: with this the app will start after every boot and it is important to mention that this is the only app (designed by me) running by default
  3. calling the other behaviors with switch focus instead of runBehavior: by switching the focus the next behavior will run and when it finishes, it comes back to the menu.

Here is the code that I used (it doesn't work here because you need to download some software before):

var session = new QiSession(function(session) {
  console.log("Connection esterblished!");
}, function() {
  console.log("Could not connect to the robot");
});

function open_app(behavior_name) {
  session.service("ALAutonomousLife").then(function(ALAutonomousLife) {
    ALAutonomousLife.switchFocus(behavior_name, 1)
  }).then(
    console.log('Application cannot be switched to')
  )
}
<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>Question Page</title>
  <script src="/libs/qimessaging/2/qimessaging.js"></script>
</head>

<body>
  <button class="app-button" onclick="open_app('mynewapp-5d8038/.')">Open app</button>
  <!-- "mynewapp-5d8038/." is the direction to the behavior you want to run, not the app-->
</body>

</html>

Hope that someone else finds this info useful.

Solution 2:[2]

In Choregraphe, you can set your installed behavior as "default".

The Default Behaviors are played automatically at robot startup.

Also note that trigger conditions express when an app can be run, not when it should or must.

Solution 3:[3]

You probably want to develop the application as a service outside of Choregraphe. General robot-jumpstarter toolkit may be useful for creating a template here. You may look at an example application creating a service and a webpage to display subtitles of what Pepper says at NLPPepperTools.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1
Solution 2 Victor Paléologue
Solution 3 Ales Horak