def plot_simulation_results_initial_and_optimized_controls(time_points, \
y_sim_init, y_sim_opt):
pl.rc("text", usetex = True)
pl.rc("font", family="serif")
pl.subplot2grid((4, 2), (0, 0))
pl.plot(time_points, y_sim_init[:,0], label = "initial")
pl.plot(time_points, y_sim_opt[:,0], label = "optimized")
pl.title("Simulation results for initial and optimized control")
pl.xlabel("$t$")
pl.ylabel("$X$", rotation = 0)
pl.legend(loc = "lower left")
pl.subplot2grid((4, 2), (1, 0))
pl.plot(time_points, y_sim_init[:,1], label = "initial")
pl.plot(time_points, y_sim_opt[:,1], label = "optimized")
pl.xlabel("$t$")
pl.ylabel("$Y$", rotation = 0)
pl.legend(loc = "lower left")
pl.subplot2grid((4, 2), (2, 0))
pl.plot(time_points, y_sim_init[:,2], label = "initial")
pl.plot(time_points, y_sim_opt[:,2], label = "optimized")
pl.xlabel("$t$")
pl.ylabel("$\psi$", rotation = 0)
pl.legend(loc = "lower left")
pl.subplot2grid((4, 2), (3, 0))
pl.plot(time_points, y_sim_init[:,3], label = "initial")
pl.plot(time_points, y_sim_opt[:,3], label = "optimized")
pl.xlabel("$t$")
pl.ylabel("$v$", rotation = 0)
pl.legend(loc = "upper left")
pl.subplot2grid((4, 2), (0, 1), rowspan = 4)
pl.plot(y_sim_init[:,0], y_sim_init[:,1], label = "initial")
pl.plot(y_sim_opt[:,0], y_sim_opt[:,1], label = "optimized")
pl.title("Simulated race car path for initial and optimized controls")
pl.xlabel("$X$")
pl.ylabel("$Y$", rotation = 0)
pl.legend(loc = "lower left")
pl.show()
评论列表
文章目录