0

I have a behavior which purpose is to show an HTML page (hosted on the robot). I want that behavior to be loaded on boot and that HTML page to be shown on the Pepper's tablet when Pepper is booted.

I have added it to the robot default behaviors but that doesn't do the trick. It shows me that this behavior is running, that it is in the default behaviors but the HTML page is not shown. Just to make it clear when this behavior is not running and I trigger it, it works as it is intended - I mean the problem is not in the HTML code.

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

1 Answers1

2

It might be that your behavior is started before the AutonomousLife service or before ALTabletService is ready. This is possible with default behaviors. In your code you need to wait for those 2 to be ready otherwise:

  • if ALTabletService is not ready, your code will just do nothing
  • if ALAutonomousLife starts after your app, it will reset the tablet so your page will be hidden.

The best solution is probably to not add it as a default behavior, but edit the app properties and set this behavior as a "solitary" activity, and use a "launch trigger condition" that is always true, like "1".

In that case, as soon as Pepper doesn't have any interactive behavior to start, it will run yours (so it will display the webpage). Also with this solution you ensure that all other services are ready before your behavior is started.

More info in the documentation about how to create solitary activites and launch trigger conditions.

JLS
  • 968
  • 5
  • 12
  • Sorry for my late comment. It didn't worked like that. If I put it in a solitary activity with trigger condition (1 == 1) the main page is still not displayed on boot. Also when I install it, the main page shows immediately, but it is lost during interaction with people, and after the interaction it is displayed again. – stefan.stt Aug 30 '17 at 07:58
  • 1
    Yes this is because when the AutonomousLife switches from one activity to another the robot is "reset". In this reset process the web view is reset too, that is why you are loosing it during interaction. – Nerus Aug 30 '17 at 23:06
  • @Nerus How can I workaround this issue. I have the same problem that resets the tablet? – Hasan Hasanov Sep 12 '17 at 08:45
  • 1
    @HasanHasanov Resetting the tablet is part of the ALAutonomousLife's job, to bring back the robot to a "default" state when switching activities (by that I mean it is a good thing, because when starting an activity you are sure of the robot's state). What you can do is, in your interactive activity, make use of the ALTabletService::showWebview(const std::string& url) function to bring back up the webview + the web app that your solitary activity is displaying at boot. Your web view will have to reload, and you might see a blink on the tablet as the reset and showWebview are not instantaneous. – Nerus Sep 13 '17 at 18:59
  • @Nerus so the robot cannot answer questions from Basic Channel AND show a content in the tablet? Isn't there a way to do both sir? – Hasan Hasanov Sep 13 '17 at 19:02
  • 1
    @HasanHasanov sorry, was editing my previous comment when you answered, see above. – Nerus Sep 13 '17 at 19:04
  • @Nerus thank you very much. I have one last question though. How can I detect when Autonomus life is switched and my tablets is reset? – Hasan Hasanov Sep 13 '17 at 19:08
  • 1
    @HasanHasanov If you put the showWebview call at the beginning of your interactive activity you won't need to 'know' because if the activity is launched then the ALAutonomousLife has been switched and the function call will be done anyway. In more general terms if you want to monitor the change in activity just subscribe to the ALAutonomousLife::FocusedActivity signal. – Nerus Sep 13 '17 at 19:12