1

I am creating this application, where Pepper shows some clickable pictures on its tablet. By clicking on a picture the user would make Pepper do some gestures. This is my Choregraphe file created:enter image description here

And here are the corresponding JS and HTML file I am using:

// keeping a pointer to the session is very useful!
var session;

try {
  QiSession(function(s) {
    console.log('connected!');
    session = s;
  });
} catch (err) {
  console.log("Error when initializing QiSession: " + err.message);
  console.log("Make sure you load this page from the robots server.")
}


function addUser(data) {
  session.service('ALMemory').then(function(memory) {
    memory.raiseEvent('My_App/gesture', data)
  }, function(error) {
    console.log(error);
  })
}
<!DOCTYPE html>
<html>

<head>
  <meta charset="utf-8" />
  <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
  <link rel="stylesheet" href="lib/bootstrap-3.3.7-dist/css/bootstrap.min.css">
  <link rel="stylesheet" href="lib/bootstrap-3.3.7-dist/css/bootstrap-theme.min.css">
  <link rel="stylesheet" href="lib/font-awesome-4.7.0/css/font-awesome.min.css">
  <!-- application css -->

  <title> Gesture application </title>
  <style>
    div.gallery {
      margin-left: 40px;
      border: 1px none #ccc;
      float: left;
      padding-left: 5px;
    }
    
    div.gallery img {
      padding: 5px;
      padding-bottom: 20px;
      width: 260px;
      height: auto;
      align: center;
    }
    
    div.desc {
      padding-bottom: 20px;
      text-align: center;
      font-weight: bold;
      font-size: 150%;
    }
  </style>
</head>

<body>

  <div class="page-header">
    <div class="row">
      <div class="col-sm-6 text-left"><img src="logo.png" width="200"></div>
      <div class="col-sm-6 text-right"><img src="logo.png" width="200"></div>
      <h1 align="center"> Pepper-Animation </h1>

    </div>
  </div>

  <div class='gallery'>
    <img src="aufwachen.JPG" alt="Mountain View" onclick="addUser('aufwachen')">
    <div class="desc">Aufwachen </div>
  </div>
  <div class='gallery'>
    <img src="confused.JPG" alt="Mountain View2" onclick="addUser('confused')">
    <div class="desc">Verwirrt </div>
  </div>
  <div class='gallery'>
    <img src="elefant.JPG" alt="Mountain View4" onclick="addUser('elefant')">
    <div class="desc">Elefant </div>
  </div>
  <div class='gallery'>
    <img src="gorilla.JPG" alt="Mountain View5" onclick="addUser('gorilla')">
    <div class="desc">Gorilla </div>
  </div>
  <div class='gallery'>
    <img src="happy.JPG" alt="Mountain View6" onclick="addUser('happy')">
    <div class="desc">Happy</div>
  </div>
  <div class='gallery'>
    <img src="happybirthday.JPG" alt="Mountain View7" onclick="addUser('happybirthday')">
    <div class="desc">Happy Birthday</div>
  </div>
  <div class='gallery'>
    <img src="helikopter.JPG" alt="Mountain View8" onclick="addUser('helicopter')">
    <div class="desc">Hubschrauber</div>
  </div>
  <div class='gallery'>
    <img src="hey.JPG" alt="hey" onclick="addUser('hey1')">
    <div class="desc">Hey</div>
  </div>
  <div class='gallery'>
    <img src="hinternkratzen.JPG" alt="hinternkratzen.JPG" onclick="addUser('hintenkratzen')">
    <div class="desc">Hintern Kratzen</div>
  </div>
  <div class='gallery'>
    <img src="kungfu.JPG" alt="kungfu.JPG" onclick="addUser('kungfu')">
    <div class="desc">Kung Fu</div>
  </div>
  <div class='gallery'>
    <img src="late.JPG" alt="late.JPG" onclick="addUser('late')">
    <div class="desc">Zu spät</div>
  </div>
  <div class='gallery'>
    <img src="luftgitarre.JPG" alt="luftgitarre.JPG" onclick="addUser('luftgitarre')">
    <div class="desc">Luftgitarre</div>
  </div>
  <div class='gallery'>
    <img src="maus.JPG" alt="maus.JPG" onclick="addUser('maus')">
    <div class="desc">Maus</div>
  </div>
  <div class='gallery'>
    <img src="monster.JPG" alt="monster.JPG" onclick="addUser('monster')">
    <div class="desc">Monster</div>
  </div>
  <div class='gallery'>
    <img src="muskeln.JPG" alt="muskeln.JPG" onclick="addUser('muskeln')">
    <div class="desc">Muskeln</div>
  </div>
  <div class='gallery'>
    <img src="niesen.JPG" alt="niesen.JPG" onclick="addUser('niesen')">
    <div class="desc">Niesen</div>
  </div>
  <div class='gallery'>
    <img src="pfeifen.JPG" alt="pfeifen.JPG" onclick="addUser('pfeifen')">
    <div class="desc">Komm Pfeifen</div>
  </div>
  <div class='gallery'>
    <img src="sachsofon.JPG" alt="sachsofon.JPG" onclick="addUser('sachsofon')">
    <div class="desc">Saxophon</div>
  </div>
  <div class='gallery'>
    <img src="spaceshuttle.JPG" alt="spaceshuttle.JPG" onclick="addUser('spaceshuttle')">
    <div class="desc">Spaceshuttle</div>
  </div>
  <div class='gallery'>
    <img src="thaichi.JPG" alt="thaichi.JPG" onclick="addUser('thaichi')">
    <div class="desc">Thai Chi</div>
  </div>
  <div class='gallery'>
    <!--<img src="traurig.JPG" alt="traurig.JPG" onclick="addUser('traurig')"><div class="desc">Traurig</div></div><div class='gallery'>-->
    <img src="trinken.JPG" alt="trinken.JPG" onclick="addUser('trinken')">
    <div class="desc">Trinken</div>
  </div>
  <div class='gallery'>
    <img src="verbeugung.JPG" alt="verbeugung.JPG" onclick="addUser('verbeugung')">
    <div class="desc">Verbeugung</div>
  </div>
  <div class='gallery'>
    <img src="waswillstdu.JPG" alt="waswillstdu.JPG" onclick="addUser('waswillstdu')">
    <div class="desc">Was willst du?</div>
  </div>
  <div class='gallery'>
    <img src="winner.JPG" alt="winner.JPG" onclick="addUser('winner1')">
    <div class="desc">Gewinner</div>
  </div>
  <div class='gallery'>
  </div>

  <script src="/libs/qimessaging/2/qimessaging.js"></script>
  <script src="js1/jquery-3.1.0.min.js"></script>
  <script type="text/javascript" src="js1/script.js"></script>

</body>

</html>

The problem: When I run this application on Pepper, it works fine initially. I am able to select different gestures from the tablet one after another, and they run fine. But after selecting 7-8 times, the program hangs. The app on the tablet gets stuck, and any selection on the tablet does not produce any output. Usually, when this happens for other apps, I am able to get out of the app by touching the head tactile sensor for 3 seconds. But this application gets stuck so bad that I am not able to control it anyhow. I tried making it sleep from Choregraphe and restart it, but Autonomous Life does not come up. As a final approach, I have to shutdown Pepper from the emergency button. This happens every time I run this application. We thought it might be Pepper's problem, so we removed all existing applications on Pepper, made a factory reset and then uploaded just this application after reset. But still, the problem persists. It would be great if you could point out any mistake in any of my files or any give me a solution to this.

  • Do you know if it's always the same animation that produces the freeze? – Alexandre Mazel Jul 18 '18 at 08:52
  • It's not the same animation. But I found that after randomly selecting 5 or more gestures, this happens. – Prateek Gupta Jul 18 '18 at 18:51
  • Is it possible to spam the switch case? Maybe the program hangs because of locked ressources. You can try and build a flow control so it is impossible to select a new case before the previous animation is completely finished. – Anders_K Jul 20 '18 at 08:11
  • 1
    @Anders_K: nice remark. It's a good practice: ensure flow control is not spawning new flow. You could have a look at the ressource locking (right click on a box, then edit ressources). Try removing some or check that every boxes use the same kind. – Alexandre Mazel Jul 20 '18 at 08:25

1 Answers1

1

As Anders_K says, it could be a problem of locked resources; you may have:

  • one (bad) animation that takes some motor resources, and then never ends. No problem will be immediately apparent when it runs
  • one animation that requires the motor resources, and waits if it can't get them (in the case of the bad animation, that is forever)

... which may seem random to someone testing it, since it looks like it hangs on a different animation whereas in fact it only when the bad animation happened in the past.

If your animations are in external behavior, one way of checking what's going on is to ssh onto the robot and call qicli call ALBehaviorManager.getRunningBehaviors - you'll see if one of your animations that should have been finished is still running.

Emile
  • 2,946
  • 2
  • 19
  • 22