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

Example mhe.py not working #707

Closed
Rum02 opened this issue Jul 4, 2023 · 3 comments
Closed

Example mhe.py not working #707

Rum02 opened this issue Jul 4, 2023 · 3 comments
Labels
question Further information is requested

Comments

@Rum02
Copy link

Rum02 commented Jul 4, 2023

Hello,
I'm trying to get started with bioptim and tried to run a view examples. Afterwards I'm discribing a few Errors I got on the way and how I solved them this is just for clarification so the main Issue can be better understood. And I hope me trying to solve the original Issues doesn't cause the current Issue.

I started with the pendulum.py were I got the following Error message:
ImportError: cannot import name 'OdeSolverBase' from 'bioptim' (C:\Users\miniconda3\envs\pyomeca\Lib\site-packages\bioptim\__init__.py)
I was able to solve that by including the following line from .dynamics.ode_solver import OdeSolverBase in the __init__.py

After that I got another Error Message TypeError: OptimalControlProgram.__init__() got an unexpected keyword argument 'assume_phase_dynamics'
To solve this issue I commented out every occurrence of the assume_phase_dynamics in the running Example After that the pendulum.py was running for my Impression errorless

Now I wanted to get started on the MHE example but when I run the mhe.py I get the following message:
The same thing happens if I start the gui for the examples.

image

Traceback (most recent call last):
File "C:\Bioptim\bioptim-master\bioptim\examples\moving_horizon_estimation\mhe.py", line 241, in
main()
File "C:\Bioptim\bioptim-master\bioptim\examples\moving_horizon_estimation\mhe.py", line 208, in main
sol = mhe.solve(update_functions, **get_solver_options(solver))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\miniconda3\envs\pyomeca\Lib\site-packages\bioptim\optimization\receding_horizon_optimization.py", line 138, in solve
sol = super(RecedingHorizonOptimization, self).solve(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\miniconda3\envs\pyomeca\Lib\site-packages\bioptim\optimization\optimal_control_program.py", line 1147, in solve
self.ocp_solver.solve()
File "C:\Users\miniconda3\envs\pyomeca\Lib\site-packages\bioptim\interfaces\acados_interface.py", line 739, in solve
self.ocp_solver = AcadosOcpSolver(self.acados_ocp, json_file="acados_ocp.json", build=self.opts.c_compile)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "c:\acados\acados\interfaces\acados_template\acados_template\acados_ocp_solver.py", line 950, in init
self.build(code_export_directory, with_cython=False, cmake_builder=cmake_builder, verbose=verbose)
File "c:\acados\acados\interfaces\acados_template\acados_template\acados_ocp_solver.py", line 896, in build
call(
File "C:\Users\miniconda3\envs\pyomeca\Lib\subprocess.py", line 392, in call
with Popen(*popenargs, **kwargs) as p:
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\miniconda3\envs\pyomeca\Lib\subprocess.py", line 1028, in init
self._execute_child(args, executable, preexec_fn, close_fds,
File "C:\Users\miniconda3\envs\pyomeca\Lib\subprocess.py", line 1515, in _execute_child
hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [WinError 2] Das System kann die angegebene Datei nicht finden

translation in English:

FileNotFoundError: [WinError 2] The system cannot find the file specified

Now I don't know how to solve this Issue I tried to find a solution but everything I tried does not work.

I hope someone can solve this if there was a similar Issue I'm sorry I didn't find it

@Ipuch
Copy link
Collaborator

Ipuch commented Jul 4, 2023

Hi @Rum02,

Thank you for trying bioptim and reaching us.

Some questions to clarify the issue:

  1. Which version of bioptim have you installed? Are you working with the source code ?
  2. Which Example are you trying to execute ? If it is a custom example, try to provide a minimal example that reproduces your error message (i.e., a few lines of code I can execute myself.)
  3. Which examples worked so far?

I launched mhe.py on my computer with the latest version of bioptim. It works. I see you are trying to use Acados. It takes an extra installation to use it on macOS or Linux. The procedure is written in the README. We don't have any script to automate the installation on Windows. So only the example mhe.py with IPOPT would work on Windows with the present version of bioptim. It would require finding out how to install Acados on Windows first.

assume_phase_dynamics is an argument that allows to define dynamics functions per interval. e.g. f0(x,u) for the first interval and f1(x,u) in the second. If you have the same equations of motion across all intervals you should set this argument to True.

Again thanks for reaching out.
We'd be glad to answer more of your questions.

@Ipuch Ipuch added the question Further information is requested label Jul 4, 2023
@Ipuch
Copy link
Collaborator

Ipuch commented Oct 30, 2023

up, Did my response help you ? :)

@Ipuch
Copy link
Collaborator

Ipuch commented Jan 3, 2025

Closed as unanswered.

@Ipuch Ipuch closed this as completed Jan 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants