<gh_stars>0
import numpy as np
from sim.sim1d import sim_run

# Simulator options.
options = {}
options['FIG_SIZE'] = [8,8]
options['FULL_RECALCULATE'] = False

class ModelPredictiveControl:
    def __init__(self):
        self.horizon = 20
        self.dt = 0.2

        # Reference or set point the controller will achieve.
        self.reference = [50, 0, 0]

    def plant_model(self, prev_state, dt, pedal, steering):
        x_t = prev_state[0]
        v_t = prev_state[3] # m/s
        
        a_t = pedal     

        x_dot = v_t
        v_dot = a_t

        x_t_1 = x_t + x_dot*dt
        

    def cost_function(self,u, *args):
        state = args[0]
        ref = args[1]
        cost = 0.0
        return cost

sim_run(options, ModelPredictiveControl)

import numpy as np
from sim.sim1d import sim_run

# Simulator options.
options = {}
options['FIG_SIZE'] = [8,8]
options['FULL_RECALCULATE'] = False

class ModelPredictiveControl:
    def __init__(self):
        self.horizon = 20
        self.dt = 0.2

        # Reference or set point the controller will achieve.
        self.reference = [50, 0, 0]

    def plant_model(self, prev_state, dt, pedal, steering):
        x_t = prev_state[0]
        v_t = prev_state[3] # m/s
        
        a_t = pedal     

        x_dot = v_t
        v_dot = a_t

        x_t_1 = x_t + x_dot*dt
        

    def cost_function(self,u, *args):
        state = args[0]
        ref = args[1]
        cost = 0.0
        return cost

sim_run(options, ModelPredictiveControl)
# Simulator options. # Reference or set point the controller will achieve. # m/s