pyomeca / bioptim

An optimization framework that links CasADi, Ipopt, ACADOS and biorbd for Optimal Control Problem
MIT License
92 stars 46 forks source link

Error Mapping in Plot.py #705

Open AnaisFarr opened 1 year ago

AnaisFarr commented 1 year ago

We run simulations in three phases with different numbers of q and qdot per phase (phase 0 and 2 = 7 q and 7 qdot, phase 1: 5 q, 5 qdot). It is not possible to display graphs with the sol.graphs() command. The problem has been solved by removing line 337 from plot.py

if nlp.plot[key].phase_mappings is None:

and line 357

else:
        size = len(nlp.plot[key].phase_mappings.to_second.map_idx)

Can we remove these two lines, which have a mapping? @EveCharbie

EveCharbie commented 1 year ago
  1. Have you added a mapping in your phase transition ? Something like this (examples/torque_driven/phase_transition_uneven_variable_number_by_mapping.py):
    phase_transitions = PhaseTransitionList()
    phase_transitions.add(
        PhaseTransitionFcn.CONTINUOUS, phase_pre_idx=0, states_mapping=BiMapping([0, 1, 2, 3, 4, 5, 6], [2, 3, 4, 5, 6])
    )
  2. Do the states appear in the right order on the plots when you remove these lines?