我正在尝试用python2或python3运行gekko。我只是简单地遵循一个修改了参数的教程,然后科学整合来模拟我的MPC。它在我的一台电脑上工作,但在我的NVIDIA Jetson TX2上不工作。并在运行m.solve(disp=False)时得到“Exec format error”。你知道吗
两台电脑都有Python2和Python3。因为我也在运行ROS,所以我想使用python2来运行脚本。最初我认为可能是使用python2来解释导致了这个问题,所以我编写了另一个脚本,使用subprocess将我的mpc和模拟器解释为python3。然而,这个问题仍然存在。问题似乎在gekko包中。我确信这是一个环境错误,因为脚本在我的个人计算机上运行良好。目前我正在运行ubuntu16.04。你知道吗
def example_MPC(t_init, x, u_init):
m = GEKKO(remote=False)
dt = 0.5
m.time = np.linspace(t_init,10+t_init,21)
#...
m.solve(disp=False) # <-- The error appears on this line
#...
return p.value[1]
这是来自终端的错误消息:
Traceback (most recent call last):
File "ode_solver.py", line 53, in <module>
simulation()
File "ode_solver.py", line 34, in simulation
u[i] = example_MPC(t[i-1], v0, u[i-1])
File ".../src/MPC_test.py", line 34, in example_MPC
m.solve(disp=False)
File "/home/nvidia/.local/lib/python3.5/site-packages/gekko/gekko.py", line 1880, in solve
env = {"PATH" : self._path }, universal_newlines=True)
File "/usr/lib/python3.5/subprocess.py", line 947, in __init__
restore_signals, start_new_session)
File "/usr/lib/python3.5/subprocess.py", line 1551, in _execute_child
raise child_exception_type(errno_num, err_msg)
OSError: [Errno 8] Exec format error
编辑:
我找到了apm文件夹的位置。当我试着用
./apm
命令告诉我:
-bash: ./apm: cannot execute binary file: Exec format error
我假设这意味着在我的TX2上,apm运行不正常。你知道吗
如果我设置m = GEKKO(remote=True)
,它就会工作。但是,MPC不能实时运行,这对我来说绝对是个问题。你知道吗
我现在尝试在本地桌面上解决这个问题。服务器参数只是本地ip地址吗?我设置:
m = GEKKO(remote=True, server="192.168.1.136")
它返回:
Traceback (most recent call last):
File ".../src/ode_solver.py", line 53, in <module>
simulation()
File ".../src/ode_solver.py", line 34, in simulation
u[i] = example_MPC(t[i-1], v0, u[i-1])
File ".../src/MPC_test.py", line 34, in example_MPC
m.solve(disp=False)
File ".../.local/lib/python2.7/site-packages/gekko/gekko.py", line 1992, in solve
raise ImportError('Results files not found. APM did not find a solution or the server is unreachable.')
ImportError: Results files not found. APM did not find a solution or the server is unreachable.
设置m = GEKKO(remote=True, server="http://192.168.1.136")
会产生相同的问题。你知道吗
您可以远程解决(需要Internet连接):
或者设置Windows APMonitor Server或Linux APMonitor Server并在该服务器上求解(例如IP地址10.0.0.10),使用:
问题是NVIDIA Jetson TX2 hex-core ARMv8 64位CPU没有兼容的可执行文件,否则Python没有选择正确的可执行文件。您可以通过在Lib/site packages/gekko/bin或从当前支持的local executables下载来查看apm\u arm可执行文件是否将在您的计算机上运行:
如果它没有运行或者不在这个列表中,那么我建议对本地服务器或者公共服务器使用
remote=True
。我将nvidiajetsontx2本地可执行文件添加为feature request in the GEKKO repository on GitHub。你知道吗相关问题 更多 >
编程相关推荐