0

I am trying to run this code from Python Robotics github repository. But I am getting following error.

model_predictive_speed_and_steer_control.py 

start!!

Traceback (most recent call last):
  File "model_predictive_speed_and_steer_control.py", line 543, in <module>
    main()
  File "model_predictive_speed_and_steer_control.py", line 520, in main
    t, x, y, yaw, v, d, a = do_simulation(cx, cy, cyaw, ck, sp, dl)
  File "model_predictive_speed_and_steer_control.py", line 403, in do_simulation
    xref, x0, dref, oa, odelta)
  File "model_predictive_speed_and_steer_control.py", line 235, in iterative_linear_mpc_control
    oa, od, ox, oy, oyaw, ov = linear_mpc_control(xref, xbar, x0, dref)
  File "model_predictive_speed_and_steer_control.py", line 262, in linear_mpc_control
    cost += cvxpy.quad_form(u[:, t], R)
  File "/usr/local/lib/python2.7/dist-packages/cvxpy/expressions/expression.py", line 315, in __getitem__
    return cvxtypes.index()(self, key)
  File "/usr/local/lib/python2.7/dist-packages/cvxpy/atoms/affine/index.py", line 48, in __init__
    self.key = ku.validate_key(key, expr.shape)
  File "/usr/local/lib/python2.7/dist-packages/cvxpy/utilities/key_utils.py", line 49, in validate_key
    raise IndexError("Too many indices for expression.")  
IndexError: Too many indices for expression.

I have updated 'cvxpy' module also.

rsvar67
  • 77
  • 8

1 Answers1

0

It looks like the python code is for an older version (pre-1.0) of CVXPY. You can find what changed here.

I suggest you to either

  • Downgrade CVXPT to an earlier version (0.4.x)
  • Upgrade the python files for the 1.0 version using this script.
bstellato
  • 160
  • 1
  • 6