pepperchoregraphe

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:


Solution

  • 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.