These days I am struggling with the application which I generated with the help of Github project: Pepper Project robot-jumpstarter
It did work very well at the beginning, but after I added some module in the folder called “scripts” (like in picture1) not any more. My basic idea is to import class from the “IntersectionPointOfTwoCircles.py” to “main_localization.py” to make the main work fine.
And because the packages “sympy” and “numpy” are needed in “IntersectionPointOfTwoCircles.py”, firstly I tried to put these two packages in the folder “scripts” but it led to the situation where the Choregraphe very often only reacted after like about 5 to10 minutes or sometimes didn’t react. This is how the path of the Choregraphe pml-file “localization“ looks:
Then I let the packages be outside the app folder now.
The code for “Main_localization” is:
class MyClass(GeneratedClass):
executable_id = "localization"
def onLoad(self):
self.listener_id = None
self.executable_manager = self.session().service("ALServiceManager")
executable_name = self.getParameter("Executable Name")
if ALProxy("ALSystem").systemVersion() < "2.3":
self.executable_id = executable_name
if "." not in executable_name:
self.logger.info("Warning: You will have conflicts if several packages have executables called '%s'" % executable_name)
self.logger.info("Use a newer version of NAOqi to have executables prefixed with the package ID, or prefix it yourself, in the form with <package>.<executable ID>")
else:
self.executable_id = self.packageUid() + "." + executable_name
def disconnect(self):
try:
self.executable_manager.serviceStopped.disconnect(self.listener_id)
except Exception as e:
pass
def onUnload(self):
self.executable_manager.stopService(self.executable_id)
self.disconnect()
def onInput_onStart(self):
self.listener_id = self.executable_manager.serviceStopped.connect(self.onExecutableStopped)
if not self.executable_manager.startService(self.executable_id):
self.logger.info("Failed to start App Executable '%s', stopping." % repr(self.executable_id))
self.onStopped()
self.disconnect()
def onExecutableStopped(self, stopped_executable, reason):
if stopped_executable == self.executable_id:
self.logger.info("App Executable Stopped: " + self.executable_id)
self.onStopped()
self.disconnect()
def onInput_onStop(self):
self.onUnload()
self.onStopped()
And the error message:
[INFO ] .box :onInput_onStart:29 _Behavior__lastUploadedChoregrapheBehavior1081224720:/Localization_19: Failed to start App Executable ''.lastUploadedChoregrapheBehavior.output.localization'', stopping.
[INFO ] behavior.box :onInput_onStart:29 _Behavior__lastUploadedChoregrapheBehavior1069884112:/Localization_19: Failed to start App Executable ''.lastUploadedChoregrapheBehavior.output.localization'', stopping.
[INFO ] behavior.box :onInput_onStart:29 _Behavior__lastUploadedChoregrapheBehavior1149770056:/Localization_19: Failed to start App Executable ''.lastUploadedChoregrapheBehavior.output.localization'', stopping.
Has anyone idea what I can do now?
Your python libraries should indeed be inside your package, ideally inside your "scripts" folder with your other python modules so you can import them.
If the libraries are big, this may indeed make your project pretty big, and hence installing with Choregraphe pretty slow, but this is bound to happen if you want to include those libraries. When you put those libraries outside the "app" folder they won't be included in the package copied to the robot, so there's no way it can work once installed on the robot.
HOWEVER - numpy should already be installed on your robot, no need to include it in your package! That may be enough to make your package smaller (numpy is pretty big).
(edit) You can also install libraries with PIP, as explained in an answer here: Install things on Pepper
pip install --user --upgrade pip
/home/nao/.local/bin/pip install --user whatever-package-you-need
You'll need to do the same thin on each robot on which you want to use your package though.