Hello
I’m using windows. I tried to install the Python interface according to the procedure under the Anaconda virtual environment, but when I tried to execute the first example, the following error appeared and I could not solve it.
The build was done by VS2019.
Since t_renderer could not be downloaded automatically, I manually downloaded “t_renderer-v0.0.34-windows” from git, renamed it and put it in acados / bin.
I’m sorry for the rudimentary questions and poor English, but I would be grateful if anyone could help.
Thank you.
(Acados2) C:\Users\Kengo\acados\examples\acados_python\getting_started>python minimal_example_closed_loop.py
Traceback (most recent call last):
File "C:\Users\Kengo\acados\examples\acados_python\getting_started\minimal_example_closed_loop.py", line 104, in <module>
acados_ocp_solver = AcadosOcpSolver(ocp, json_file = 'acados_ocp_' + model.name + '.json')
File "c:\users\kengo\acados\interfaces\acados_template\acados_template\acados_ocp_solver.py", line 780, in __init__
with open(json_path + '/simulink_default_opts.json', 'r') as f:
OSError: [Errno 22] Invalid argument: '"C:\\Users\\Kengo\\acados"\\interfaces/acados_template/acados_template/simulink_default_opts.json'
Exception ignored in: <function AcadosOcpSolver.__del__ at 0x00000192477D2790>
Traceback (most recent call last):
File "c:\users\kengo\acados\interfaces\acados_template\acados_template\acados_ocp_solver.py", line 1470, in __del__
model = self.acados_ocp.model
AttributeError: 'AcadosOcpSolver' object has no attribute 'acados_ocp'
Thank you for your reply.
I am deeply grateful for the correction code.
I’m not very familiar with github so I’m not sure if what I’ve done is correct so let me know.
I replaced the 9 fix files you provided in the acados file and then built using VS. Then I installed it in a virtual environment with pip3 to build a Python interface.
After this fix, I ran the first example again, but got the following error.
A part of the code is in Japanese, but the meaning of the Japanese part is "Internal or external command,
It is not recognized as an accurately program or batch file. "
(Acados) C:\Users\Kengo\acados\examples\acados_python\getting_started>python minimal_example_closed_loop.py
'C:\Users\Kengo\acados\bin\t_renderer' は、内部コマンドまたは外部コマンド、
操作可能なプログラムまたはバッチ ファイルとして認識されていません。
Traceback (most recent call last):
File "C:\Users\Kengo\acados\examples\acados_python\getting_started\minimal_example_closed_loop.py", line 104, in <module>
acados_ocp_solver = AcadosOcpSolver(ocp, json_file = 'acados_ocp_' + model.name + '.json')
File "c:\users\kengo\acados\interfaces\acados_template\acados_template\acados_ocp_solver.py", line 799, in __init__
ocp_render_templates(acados_ocp, json_file)
File "c:\users\kengo\acados\interfaces\acados_template\acados_template\acados_ocp_solver.py", line 634, in ocp_render_templates
render_template(in_file, out_file, template_dir, json_path)
File "c:\users\kengo\acados\interfaces\acados_template\acados_template\utils.py", line 219, in render_template
raise Exception('Rendering of {} failed! Exiting.\n'.format(in_file))
Exception: Rendering of main.in.c failed! Exiting.
Exception ignored in: <function AcadosOcpSolver.__del__ at 0x000001E76A88F1F0>
Traceback (most recent call last):
File "c:\users\kengo\acados\interfaces\acados_template\acados_template\acados_ocp_solver.py", line 1465, in __del__
model = self.acados_ocp.model
AttributeError: 'AcadosOcpSolver' object has no attribute 'acados_ocp'
I manually installed the t_renderer file using the same procedure as last time and granted access.
This error is different from the last time and it looks like the path issue has been resolved. I thought about the possibility of my mistake and tried again, but the result was the same. I would be grateful if you could help me.
Thank you to the corresponding.
After rewriting the source code, renaming the t_renderer file to “t_renderer.exe” and executing it, the following error occurred.
(Acados) C:\Users\Kengo\acados\examples\acados_python\getting_started>python minimal_example_closed_loop.py
Error: Os { code: 123, kind: Other, message: "ファイル名、ディレクトリ名、またはボリューム ラベルの構文が間違っ ています。" }
Traceback (most recent call last):
File "C:\Users\Kengo\acados\examples\acados_python\getting_started\minimal_example_closed_loop.py", line 104, in <module>
acados_ocp_solver = AcadosOcpSolver(ocp, json_file = 'acados_ocp_' + model.name + '.json')
File "c:\users\kengo\acados\interfaces\acados_template\acados_template\acados_ocp_solver.py", line 799, in __init__
ocp_render_templates(acados_ocp, json_file)
File "c:\users\kengo\acados\interfaces\acados_template\acados_template\acados_ocp_solver.py", line 634, in ocp_render_templates
render_template(in_file, out_file, template_dir, json_path)
File "c:\users\kengo\acados\interfaces\acados_template\acados_template\utils.py", line 221, in render_template raise Exception('Rendering of {} failed!\n\nAttempted to execute OS command:\n{}\n\nExiting.\n'.format(in_file, os_cmd))
Exception: Rendering of main.in.c failed!
Attempted to execute OS command:
C:\Users\Kengo\acados\bin\t_renderer.exe 'c:\users\kengo\acados\interfaces\acados_template\acados_template\c_templates_tera\*' 'main.in.c' 'C:\Users\Kengo\acados\examples\acados_python\getting_started/acados_ocp_pendulum_ode.json' 'main_pendulum_ode.c'
Exiting.
Exception ignored in: <function AcadosOcpSolver.__del__ at 0x00000195868D51F0>
Traceback (most recent call last):
File "c:\users\kengo\acados\interfaces\acados_template\acados_template\acados_ocp_solver.py", line 1465, in __del__
model = self.acados_ocp.model
AttributeError: 'AcadosOcpSolver' object has no attribute 'acados_ocp'
It seems that the OS command that matches the fix code you provided is being executed, but I don’t know how to fix it. I’m sorry.
I would appreciate your help.
Thank you.
Thank you for your reply.
I tried to apply four new fixes, but I got a similar error. The path to “acados_ocp_pendulum_ode.json” seems to be correct, but for some reason the error seems to continue.
(Acados) C:\Users\Kengo\acados\examples\acados_python\getting_started>python minimal_example_closed_loop.py
Error: Os { code: 123, kind: Other, message: "ファイル名、ディレクトリ名、またはボリューム ラベルの構文が間違っています。" }
Traceback (most recent call last):
File "C:\Users\Kengo\acados\examples\acados_python\getting_started\minimal_example_closed_loop.py", line 104, in <module>
acados_ocp_solver = AcadosOcpSolver(ocp, json_file = 'acados_ocp_' + model.name + '.json')
File "c:\users\kengo\acados\interfaces\acados_template\acados_template\acados_ocp_solver.py", line 797, in __init__
ocp_render_templates(acados_ocp, json_file)
File "c:\users\kengo\acados\interfaces\acados_template\acados_template\acados_ocp_solver.py", line 632, in ocp_render_templates
render_template(in_file, out_file, template_dir, json_path)
File "c:\users\kengo\acados\interfaces\acados_template\acados_template\utils.py", line 221, in render_template raise Exception('Rendering of {} failed!\n\nAttempted to execute OS command:\n{}\n\nExiting.\n'.format(in_file, os_cmd))
Exception: Rendering of main.in.c failed!
Attempted to execute OS command:
C:\Users\Kengo\acados\bin\t_renderer.exe 'c:\users\kengo\acados\interfaces\acados_template\acados_template\c_templates_tera\*' 'main.in.c' 'C:\Users\Kengo\acados\examples\acados_python\getting_started\acados_ocp_pendulum_ode.json' 'main_pendulum_ode.c'
Exiting.
Exception ignored in: <function AcadosOcpSolver.__del__ at 0x000001AF56F941F0>
Traceback (most recent call last):
File "c:\users\kengo\acados\interfaces\acados_template\acados_template\acados_ocp_solver.py", line 1463, in __del__
model = self.acados_ocp.model
AttributeError: 'AcadosOcpSolver' object has no attribute 'acados_ocp'
The japanese error translates to:
“The syntax of the file name, directory name, or volume label is incorrect.”
which probably refers to the path of the binary, which seems correct though,
C:\Users\Kengo\acados\bin\t_renderer.exe
Maybe this is connected to the fact that you use an anaconda virtual environment, but I am really not sure.