Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed to start App Executable in Choregraphe #3

Open
Frederik201314 opened this issue Aug 30, 2018 · 8 comments
Open

Failed to start App Executable in Choregraphe #3

Frederik201314 opened this issue Aug 30, 2018 · 8 comments

Comments

@Frederik201314
Copy link

Frederik201314 commented Aug 30, 2018

Hi There,
These days I have been confused by the error related to “” and "Failed to start App Executable in Choregraphe" in Choregraphe. And I am also not 100% clear about what we should put in as the execute_id & name. The app does not work anymore --- the robot does not move as expected.

The whole debugging message is:
[INFO ] .box :onLoad:10 _Behavior__lastUploadedChoregrapheBehavior136558984:/Localization_19: Warning: You will have conflicts if several packages have executables called 'main_localization' [INFO ] behavior.box :onLoad:11 _Behavior__lastUploadedChoregrapheBehavior136558984:/Localization_19: 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> [INFO ] behavior.box :onInput_onStart:27 _Behavior__lastUploadedChoregrapheBehavior136558984:/Localization_19: self.packageUid()=.lastUploadedChoregrapheBehavior [INFO ] behavior.box :onInput_onStart:28 _Behavior__lastUploadedChoregrapheBehavior136558984:/Localization_19: self.executable_id=localization [INFO ] behavior.box :onInput_onStart:30 _Behavior__lastUploadedChoregrapheBehavior136558984:/Localization_19: The behavior path is=/home/nao/.local/share/PackageManager/apps/.lastUploadedChoregrapheBehavior/. [INFO ] behavior.box :onInput_onStart:31 _Behavior__lastUploadedChoregrapheBehavior136558984:/Localization_19: self.onExecutableStopped =<bound method _44f299e2177739acf609cdbdc86d599c.onExecutableStopped of <__main__._44f299e2177739acf609cdbdc86d599c; proxy of <Swig Object of type 'AL::behavior *' at 0x4b07d098> >> [INFO ] behavior.box :onInput_onStart:33 _Behavior__lastUploadedChoregrapheBehavior136558984:/Localization_19: self.executable_manager.startService =<Boost.Python.function object at 0x3b3becb8> [INFO ] behavior.box :onInput_onStart:34 _Behavior__lastUploadedChoregrapheBehavior136558984:/Localization_19: Failed to start App Executable ''localization'', stopping.

And here is the Code in Choregraphe “Localization” which was generated from this project:

class MyClass(GeneratedClass):
  executable_id = "localization"
 def onLoad(self):
      self.listener_id = self.session().service("ALMemory")
      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)
      self.logger.info("self.packageUid()=" + str(self.packageUid()))
      self.logger.info("self.executable_id=" + str(self.executable_id))
      self.behaviorPath = ALFrameManager.getBehaviorPath(self.behaviorId)
      self.logger.info("The behavior path is=" + str(self.behaviorPath))
      self.logger.info("self.onExecutableStopped =" + str(self.onExecutableStopped))
      if not self.executable_manager.startService(self.executable_id):
          self.logger.info("self.executable_manager.startService =" + str(self.executable_manager.startService))
          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()

I am looking forward to hearing from you.@EmileKroeger @Halftasoeur @claire-rivoire

Cheers,
Frederik

@EmileKroeger
Copy link
Contributor

Hi Frederik, you probably want to check out your project's manifest.xml. There should be some tags in there, you need to make sure that:

  • the service's name is the same as the parameter to your "run executable" choregraphe box
  • the path given to the executable corresponds to the path of your python script inside your project

you can also try ssh'ing onto your robot and running the script manually with python path/to/your/script.py, see if that works fine or crashes.

@Frederik201314
Copy link
Author

Hi Emile, ^_^

Before about 1.5 months, as I used the name of the folder name in output folder "localizaiton" as "executable_id" and "main" as "Executable Name" parameter, the app worked fine in Choregraphe.
To avoid the name conflicts like it said now in the error message I have changed the "main.py" to "main_localization.py" which I hope it's fine. I have also tried with "scripts.localization" in Choregrpahe for the parameter "Executable Name". Then there was the same error.

By the way, with the purpose of debugging and improving the code more conviniently, I have changed the IP address of line 61 of runner.py (The first line of folloing code ) from "None "directly to the IP address of my robot "10.0.0.xx". And it worked standalone very well running through PyCharm in the last couple of weeks.

def init(qi_url= None):
    "Returns a QiApplication object, possibly with interactive input."
    if qi_url:
        sys.argv.extend(["--qi-url", qi_url])
    else:
        args = check_commandline_args('Run the app.')
        if bool(args.qi_url):
            qi_url = args.qi_url
        elif not is_on_robot():
            print "no --qi-url parameter given; interactively getting debug robot."
            debug_robot = get_debug_robot()
            if debug_robot:
                sys.argv.extend(["--qi-url", debug_robot])
                qi_url = debug_robot
            else:
                raise RuntimeError("No robot, not running.")

Best regards,
Frederik

@EmileKroeger
Copy link
Contributor

  1. when you rename files or executable_id, make sure to also rename those in manifest.xml

  2. hard-coding the IP address in your source code is not a good idea; it's best to pass it as a command-line parameter with --qi-url when debugging.

@Frederik201314
Copy link
Author

  1. Now the names are identical. I thought one is supposed to change the executable_id&name to make it compact with the generated files.

  2. Principally you are absolutely right.
    At the beginning 3~4 weeks, I did use the command line with --qi-url parameters to debug, but it was a little painful. Honestly speaking, debugging with PyCharm by changing that parameter that way makes your project more beginner friendly...

  3. Should I understand lastUploadedChoregrapheBehavior as a built-in app in NAoqi?

@Frederik201314
Copy link
Author

Frederik201314 commented Aug 30, 2018

It works well in debugging through SSH:
lokalisierungdebuggingthroughsshwithputty01
But not in Choregraphe... You have in the documentation saying that one should change the "main.py" but what in details then? like "executable_id&name" or?

@EmileKroeger
Copy link
Contributor

".lastUploadedChoregrapheBehavior" is the name given to your package when you hit "play" in Choregraphe. That means that if you install it on the robot and run it with the "play" button, your package is installed twice on the robot. I recommend you delete the .lastUploadedChoregrapheBehavior, and only use the "install" function. It might be the one causing some of your problems (because it probably also has a service called "main", with an older version of the code, so maybe that one is getting started instead of of your new one).

The "executable" is the ID given to a service in manifest.xml, you just have to make sure that it's the same name as the parameter of the "run executable" box in Choregraphe; by default it's "main", but you could name it "my-navigation-helper" etc. to make sure it doesn't conflict with other packages (it might conflict anyway with .lastUploadedChoregrapheBehavior, so delete that one ...)

note that you can also do things like qicli call ALServiceManager.startService my-navigation-helper and see if that works (it should have about the same effect as running your behavior)

@Frederik201314
Copy link
Author

Frederik201314 commented Sep 4, 2018

Every time I run the App, the application “.lastUploadedChoregrapheBehavior” (including a behavior “./behavior.xar” and a service named “main”) will be automatically generated, even if I deleted it before the running action. And this application “.lastUploadedChoregrapheBehavior“ also contains the same service “my-navigation-helper” after I renamed “main.py” to “my-navigation-helper”… Changing the name to “scripts.my-navigation-helper” solved the problem of name conflict.
Found: The “.lastUploadedChoregrapheBehavior“ is the value of the variable “packageUid” from the original code of this project.
PS:
lokalisierungdebuggingthroughsshwithmobaxterm02

@Frederik201314
Copy link
Author

After reading another related project on GitHub: qi-package-services, there is still one question unclear:
Should the path in the manifest.xml be “execStart=/usr/bin/python2 scripts/my-navigation-helper.py" ?
Or what about “execStart=/usr/bin/python2 home/nao/.local/share/PackageManager/apps/localization/scripts/my-navigation-helper.py”?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants