pythonpepperchoregraphe

Pepper Robot: How to port Python landmark detection to Choregraphe?


I'm trying to write a small programm to have Pepper check for landmarks inside a room through Choregraphe. The regular Python code for landmark detection works just fine, but i can't port it to Choregraphe.http://doc.aldebaran.com/2-5/dev/python/examples/vision/landmark.html

I could already import the simple Python File in Choregraphe according to this video, but there's always an error when doing it with the landmark detection. https://www.youtube.com/watch?v=orDWxHQxw5s

This code

enter image description here

gives this error message :

[ERROR] behavior.box :createPythonModule:0
_Behavior__lastUploadedChoregrapheBehaviorbehavior_11118986952:/Landmark 
Detektor_1: Box creation failed with the error: <type 
'exceptions.RuntimeError'> Application was already initialized

How do I successfully port the Python landmark detection to Choregraphe code?


Solution

  • I wouldn't recommended doing too much custom Python directly in Choregraphe. It's possible, sure, but it's often difficult to debug and maintain.

    The reason the two work differently is that standalone Python scripts have to take care of the connection to the robot, session management, etc. all of which is already handled when the Python is being executed in Choregraphe.

    So some approaches:

    (edit to add) One advantage to this last approach is that you can run your standalone Python script on your work computer (passing --qi-url your-peppers-ip as a command-line parameter) while testing it (so you get all your logs directly in your favourite IDE, and only those logs), and once you're satisfied with the result, install it on the robot with Choregraphe).