MPCC icon indicating copy to clipboard operation
MPCC copied to clipboard

Add python

Open Chachay opened this issue 4 years ago • 2 comments

The implementation is far from perfect (obviously the behaviour is different from your work), but added python version.

I have an interest in comparing NMPC and RL algorithms and thought to reproduce your work in Python, which is easier to interface with existing implementations. I'm debugging to get a closer result to yours but will take more time.

Hoping somebody in this community might notice my fatal mistake, I make this PR.

Chachay avatar Jan 26 '21 14:01 Chachay

Thanks for adding you python version. I try to have a look what is not working properly and will merge it if everything is fine. Regarding RL I also have a gym replicating the RC car environment. It is inspired by my paper "Learning in Simulation, Racing in Reality" https://arxiv.org/abs/2011.13332

alexliniger avatar Jan 27 '21 10:01 alexliniger

Thank you very much for taking your time and an inspiring paper.

Regarding a gym environment, I planned to add it to this repository but have been wondering the license compliant way to include parameter files(tracks and models) from this repo.

About my script, I should have commented it, but this python script has two 'duplicated' vehicle model. One is defined in nmpc_sim.py and the other /python/model/sim_model.py.

I defined two separately to separate two models as follows

  1. Ground Truth model and the real environment [/python/model/sim_model.py]
  2. Controller internal model which has currently identical parameters as ground truth [nmpc_sim.py ]
v = VehicleSimModel(scale=2, control_dt = dT*1000) # <-- #1 world model (environment in RL gym context)
dmodel = ExBicycleModel(param=model_params, NX=10, NU=3)  # <-- #2 controller internal model

To run script

python3 nmpc_sim.py --render

shows animation.

I'm sorry about the bad documentation. I'll add a bit more comments.

Chachay avatar Jan 27 '21 10:01 Chachay