brocksam / pycollo

General-purpose optimal control, trajectory optimisation and parameter optimisation using direct collocation
https://brocksam.github.io/pycollo/
MIT License
8 stars 3 forks source link

Error when adding zero endpoint constraints #46

Open NoNotCar opened 2 years ago

NoNotCar commented 2 years ago

If you try to add zero endpoint constraints and bounds (by doing problem.endpoint_constraints = [] and problem.bounds.endpoint_constraints = [] ), pycollo crashes while setting up the problem with this user-unfriendly stacktrace:


  File "C:\Users\13has\Documents\importants\c-gtp-4\main.py", line 19, in <module>
    base_problem = collo.optimise(course, T=TIME, mesh_iteration_limit=3)
  File "C:\Users\13has\Documents\importants\c-gtp-4\collo.py", line 56, in optimise
    problem.initialise()
  File "C:\Users\13has\Documents\importants\pycollo\pycollo\optimal_control_problem.py", line 341, in initialise
    self._check_problem_and_phase_bounds()
  File "C:\Users\13has\Documents\importants\pycollo\pycollo\optimal_control_problem.py", line 366, in _check_problem_and_phase_bounds
    self._backend.create_bounds()
  File "C:\Users\13has\Documents\importants\pycollo\pycollo\backend.py", line 628, in create_bounds
    self.bounds = Bounds(self)
  File "C:\Users\13has\Documents\importants\pycollo\pycollo\bounds.py", line 421, in __init__
    self.process_and_check_user_values()
  File "C:\Users\13has\Documents\importants\pycollo\pycollo\bounds.py", line 430, in process_and_check_user_values
    self.ocp_backend.ocp.bounds._process_and_check_user_values()
  File "C:\Users\13has\Documents\importants\pycollo\pycollo\bounds.py", line 128, in _process_and_check_user_values
    self._process_endpoint_cons()
  File "C:\Users\13has\Documents\importants\pycollo\pycollo\bounds.py", line 147, in _process_endpoint_cons
    self._b_con_bnd, needed = process_single_type_of_values(self,
  File "C:\Users\13has\Documents\importants\pycollo\pycollo\bounds.py", line 546, in process_single_type_of_values
    bnds = process_iterable_bounds_instance(bnds_obj, bnds_info, p_info)
  File "C:\Users\13has\Documents\importants\pycollo\pycollo\bounds.py", line 643, in process_iterable_bounds_instance
    supported_iter = isinstance(bnds_info.user_bnds[0], SUPPORTED_ITER_TYPES)
IndexError: list index out of range