@staticmethod
def generate_code(generated_dir):
    dim_state = CarKalman.x_initial.shape[0]
    name = CarKalman.name
    maha_test_kinds = CarKalman.maha_test_kinds
    (m, j, aF, aR, cF_orig, cR_orig) = CarKalman.global_vars
    state_sym = sp.MatrixSymbol('state', dim_state, 1)
    state = sp.Matrix(state_sym)
    x = state[States.STIFFNESS, :][(0, 0)]
    (cF, cR) = ((x * cF_orig), (x * cR_orig))
    angle_offset = state[States.ANGLE_OFFSET, :][(0, 0)]
    angle_offset_fast = state[States.ANGLE_OFFSET_FAST, :][(0, 0)]
    sa = state[States.STEER_ANGLE, :][(0, 0)]
    sR = state[States.STEER_RATIO, :][(0, 0)]
    (u, v) = state[States.VELOCITY, :]
    r = state[States.YAW_RATE, :][(0, 0)]
    A = sp.Matrix(np.zeros((2, 2)))
    A[(0, 0)] = ((- (cF + cR)) / (m * u))
    A[(0, 1)] = (((- ((cF * aF) - (cR * aR))) / (m * u)) - u)
    A[(1, 0)] = ((- ((cF * aF) - (cR * aR))) / (j * u))
    A[(1, 1)] = ((- ((cF * (aF ** 2)) + (cR * (aR ** 2)))) / (j * u))
    B = sp.Matrix(np.zeros((2, 1)))
    B[(0, 0)] = ((cF / m) / sR)
    B[(1, 0)] = (((cF * aF) / j) / sR)
    x = sp.Matrix([v, r])
    x_dot = ((A * x) + (B * ((sa - angle_offset) - angle_offset_fast)))
    dt = sp.Symbol('dt')
    state_dot = sp.Matrix(np.zeros((dim_state, 1)))
    state_dot[((States.VELOCITY.start + 1), 0)] = x_dot[0]
    state_dot[(States.YAW_RATE.start, 0)] = x_dot[1]
    f_sym = (state + (dt * state_dot))
    obs_eqs = [[sp.Matrix([r]), ObservationKind.ROAD_FRAME_YAW_RATE, None], [sp.Matrix([u, v]), ObservationKind.ROAD_FRAME_XY_SPEED, None], [sp.Matrix([u]), ObservationKind.ROAD_FRAME_X_SPEED, None], [sp.Matrix([sa]), ObservationKind.STEER_ANGLE, None], [sp.Matrix([angle_offset_fast]), ObservationKind.ANGLE_OFFSET_FAST, None], [sp.Matrix([sR]), ObservationKind.STEER_RATIO, None], [sp.Matrix([x]), ObservationKind.STIFFNESS, None]]
    gen_code(generated_dir, name, f_sym, dt, state_sym, obs_eqs, dim_state, dim_state, maha_test_kinds=maha_test_kinds, global_vars=CarKalman.global_vars)
@staticmethod
def generate_code(generated_dir):
    dim_state = CarKalman.x_initial.shape[0]
    name = CarKalman.name
    maha_test_kinds = CarKalman.maha_test_kinds
    (m, j, aF, aR, cF_orig, cR_orig) = CarKalman.global_vars
    state_sym = sp.MatrixSymbol('state', dim_state, 1)
    state = sp.Matrix(state_sym)
    x = state[States.STIFFNESS, :][(0, 0)]
    (cF, cR) = ((x * cF_orig), (x * cR_orig))
    angle_offset = state[States.ANGLE_OFFSET, :][(0, 0)]
    angle_offset_fast = state[States.ANGLE_OFFSET_FAST, :][(0, 0)]
    sa = state[States.STEER_ANGLE, :][(0, 0)]
    sR = state[States.STEER_RATIO, :][(0, 0)]
    (u, v) = state[States.VELOCITY, :]
    r = state[States.YAW_RATE, :][(0, 0)]
    A = sp.Matrix(np.zeros((2, 2)))
    A[(0, 0)] = ((- (cF + cR)) / (m * u))
    A[(0, 1)] = (((- ((cF * aF) - (cR * aR))) / (m * u)) - u)
    A[(1, 0)] = ((- ((cF * aF) - (cR * aR))) / (j * u))
    A[(1, 1)] = ((- ((cF * (aF ** 2)) + (cR * (aR ** 2)))) / (j * u))
    B = sp.Matrix(np.zeros((2, 1)))
    B[(0, 0)] = ((cF / m) / sR)
    B[(1, 0)] = (((cF * aF) / j) / sR)
    x = sp.Matrix([v, r])
    x_dot = ((A * x) + (B * ((sa - angle_offset) - angle_offset_fast)))
    dt = sp.Symbol('dt')
    state_dot = sp.Matrix(np.zeros((dim_state, 1)))
    state_dot[((States.VELOCITY.start + 1), 0)] = x_dot[0]
    state_dot[(States.YAW_RATE.start, 0)] = x_dot[1]
    f_sym = (state + (dt * state_dot))
    obs_eqs = [[sp.Matrix([r]), ObservationKind.ROAD_FRAME_YAW_RATE, None], [sp.Matrix([u, v]), ObservationKind.ROAD_FRAME_XY_SPEED, None], [sp.Matrix([u]), ObservationKind.ROAD_FRAME_X_SPEED, None], [sp.Matrix([sa]), ObservationKind.STEER_ANGLE, None], [sp.Matrix([angle_offset_fast]), ObservationKind.ANGLE_OFFSET_FAST, None], [sp.Matrix([sR]), ObservationKind.STEER_RATIO, None], [sp.Matrix([x]), ObservationKind.STIFFNESS, None]]
    gen_code(generated_dir, name, f_sym, dt, state_sym, obs_eqs, dim_state, dim_state, maha_test_kinds=maha_test_kinds, global_vars=CarKalman.global_vars)