这些天来,我正在努力解决我在 Github 项目的帮助下生成的应用程序:Pepper Project robot-jumpstarter
一开始它确实工作得很好,但是在我在文件夹中添加了一些名为“scripts”的模块之后(如图1所示)就没有了。我的基本想法是将“IntersectionPointOfTwoCircles.py”中的类导入“main_localization.py”以使主要工作正常。
而且因为“IntersectionPointOfTwoCircles.py”中需要“sympy”和“numpy”包,所以我首先尝试将这两个包放在“scripts”文件夹中,但这导致了Choregraphe经常只在大约之后才反应的情况5 到 10 分钟或有时没有反应。Choregraphe pml 文件“localization”的路径如下所示:
然后我现在让包在 app 文件夹之外。
“Main_localization”的代码是:
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()
和错误信息:
[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.
有谁知道我现在能做什么?