urosolia / RacingLMPC

Implementation of the Learning Model Predictive Controller for autonomous racing
284 stars 77 forks source link

Runtime error in LMPC #1

Closed alexbuyval closed 6 years ago

alexbuyval commented 6 years ago

Hi Ugo,

I faced with the following error:

  File "main.py", line 165, in <module>
    LMPCSimulator.Sim(ClosedLoopLMPC, LMPController, LMPCOpenLoopData)
  File "fnc/SysModel.py", line 37, in Sim
    Controller.solve(x[i, :])
  File "fnc/LMPC.py", line 96, in solve
    Qfun_SelectedTot    =  np.append(Qfun_SelectedTot, Qfun_Selected, axis=1)
  File "/usr/lib/python2.7/dist-packages/numpy/lib/function_base.py", line 4575, in append
    return concatenate((arr, values), axis=axis)
IndexError: axis 1 out of bounds [0, 1)

It seems that you should use axis=0 instead of axis=1 in line 96 of LMPC.py

Best. Alex

urosolia commented 6 years ago

Hi Alex,

Thanks for catching the bug. I should have fixed it. Does the code run on your machine? (The previous code was running on my machine)

Out of curiosity, which Python version are you using? I am using Python 2.7.

Best, Ugo

alexbuyval commented 6 years ago

I am using Python 2.7.12 too.

Does the code run on your machine?

The code runs and works properly only if I use axis=0 in line 96.

urosolia commented 6 years ago

The code runs and works properly only if I use axis=0 in line 96.

Thanks, I have updated line 96.