1

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

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:

PathForChoregraphePMLFile

Then I let the packages be outside the app folder now.

PathForImpoartedPackages

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?

1 Answers1

1

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.

Emile
  • 2,946
  • 2
  • 19
  • 22
  • What a pity. I hope so. But the sympy package is about 50% bigger than numpy ... §_" – Frederik Best Aug 24 '18 at 15:11
  • Is there no any other approach I can do to solve this problem? By the way my this robot has since version 2.5.5.5 (considering incompatibly) not been updated. The other updated robot with NAOqi version 2.7 didn't seem to deal very much better with this issue. – Frederik Best Aug 24 '18 at 16:07
  • 1
    You can also use pip, I added that to my answer. – Emile Aug 25 '18 at 10:02
  • Thanks,I have tried. Could you tell me what the difference between pip installation and the installation through "install a package to the robot..." from Choregraphe is? – Frederik Best Aug 27 '18 at 12:09
  • And after the installation of sympy through SSH-pip , do I only need to delete the package sympy in the "scripts "folder and the importing part of the main.py or what else must I do? – Frederik Best Aug 27 '18 at 12:51
  • If you installed it with pip you don't need to include it in your package any more, and can still import it from main.py – Emile Aug 27 '18 at 13:35
  • Thank you. It works now just much faster with Choreraphe, but the app has still failed to be started. Because of the following errors: [INFO ] behavior.box :onLoad:10 _Behavior__lastUploadedChoregrapheBehavior899854312:/Localization_19: Warning: You will have conflicts if several packages have executables called 'main_localization' [INFO ] behavior.box :onLoad:11 _Behavior__lastUploadedChoregrapheBehavior899854312:/Localization_19: Use a newer version of NAOqi to have executables prefixed with the package ID, or prefix it yourself, in the form with . – Frederik Best Aug 28 '18 at 16:26
  • + [INFO ] behavior.box :onInput_onStart:34 _Behavior__lastUploadedChoregrapheBehavior899854312:/Localization_19: Failed to start App Executable ''.lastUploadedChoregrapheBehavior.localization'', stopping. Actually at the beginning I have generated in different paths of C-Disk the application folders of same name including same “main.py”, and then I change the module name of this program working on Choregraphe to the only “main_localization” in C-Disk. – Frederik Best Aug 28 '18 at 16:27
  • Plus: the "main" service does not seem to work when I click on the green triangle button on the right side of it in the "Robot applicaitons" window of Choregraphe... – Frederik Best Aug 28 '18 at 16:44
  • (this looks like another problem unrelated to this question) – Emile Aug 29 '18 at 08:46
  • [ Yep... I am trying to fix it. If not successful, I will ask another question :) ] – Frederik Best Aug 29 '18 at 08:50