Clear Filters
Clear Filters

Differences in results between simulation and reality

1 view (last 30 days)
Dear community,
I have developed an MPC algorithm for control of a small RC car. Before putting it to the test I of course ran a set of simulations on my computer. The objective is to follow a reference path which for simplicity is a straight line. The vehicle is represented using the kinematic bycicle model which requires two parameters, the distance from each axle to the center of gravity. The velocity is constant and I'm using a curvilinear coordinate system so the position and orientation of the vehicle is related to the path by two parameters. The lateral deviation from the path denoted e_y and the error in heading angle w.r.t the path denoted e_psi. Since the velocity is low I make the assumption of zero slip in my model. The control input is the steering angle of the front wheels. To achieve the objective I have to minimize the square of both e_y and e_psi. Also included in the objective function is the input denoted by delta. In the simulations and the tests the vehicle starts with an offset from the path. Furthermore, the model has been linearized around e_y=0 and e_psi=0. The whole problem is rewritten as a QP problem and solved successfully with QUADPROG. Communication between MATLAB (running on separate computer) and the vehicle is done with ROS. Sensors measure position, orientation and velocity accurately.
The performance of the vehicle differs from that of the simulation. If I only penalize e_y^2 in the objective function I get the following results, first tests followed by simulations:
If I on the other hand I include e_psi^2 and delta^2 in the objective function (with appropriate weights) the performance improves. However, there are still some differences between simulation and reality.
I have investigated a some possible causes. As you can see the velocity is in reality not really constant, something that is assumed in the simulation. I have tried running the simulation with a varying velocity but get almost the exact same results. The vehicle answers almost instantly to the commands so I'm quite sure there is no delay in the actuator that cause the problem. Apart from that I have experimented with the offset, velocity, distances to the C.G and prediction horizon nothing of which seem to explain the differences. What do you think is the underlying cause to these differences?
Thank you in advance!
Best regards
Ahmed

Answers (0)

Products


Release

R2018a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!