def calc_forces(self, x, u, return_slip=False):
    steer = u[1]
    psi = x[2]
    vx = x[3]
    vy = x[4]
    omega = x[5]
    if self.approx:
        acc = u[0]
        Frx = (self.mass * acc)
        alphaf = (steer - (((self.lf * omega) + vy) / vx))
        alphar = (((self.lr * omega) - vy) / vx)
        Ffy = ((2 * self.Cf) * alphaf)
        Fry = ((2 * self.Cr) * alphar)
    else:
        if self.input_acc:
            acc = u[0]
            Frx = (self.mass * acc)
        else:
            pwm = u[0]
            Frx = ((((self.Cm1 - (self.Cm2 * vx)) * pwm) - self.Cr0) - (self.Cr2 * (vx ** 2)))
        alphaf = (steer - np.arctan2(((self.lf * omega) + vy), abs(vx)))
        alphar = np.arctan2(((self.lr * omega) - vy), abs(vx))
        Ffy = (self.Df * np.sin((self.Cf * np.arctan((self.Bf * alphaf)))))
        Fry = (self.Dr * np.sin((self.Cr * np.arctan((self.Br * alphar)))))
    if return_slip:
        return (Ffy, Frx, Fry, alphaf, alphar)
    else:
        return (Ffy, Frx, Fry)
def calc_forces(self, x, u, return_slip=False):
    steer = u[1]
    psi = x[2]
    vx = x[3]
    vy = x[4]
    omega = x[5]
    if self.approx:
        acc = u[0]
        Frx = (self.mass * acc)
        alphaf = (steer - (((self.lf * omega) + vy) / vx))
        alphar = (((self.lr * omega) - vy) / vx)
        Ffy = ((2 * self.Cf) * alphaf)
        Fry = ((2 * self.Cr) * alphar)
    else:
        if self.input_acc:
            acc = u[0]
            Frx = (self.mass * acc)
        else:
            pwm = u[0]
            Frx = ((((self.Cm1 - (self.Cm2 * vx)) * pwm) - self.Cr0) - (self.Cr2 * (vx ** 2)))
        alphaf = (steer - np.arctan2(((self.lf * omega) + vy), abs(vx)))
        alphar = np.arctan2(((self.lr * omega) - vy), abs(vx))
        Ffy = (self.Df * np.sin((self.Cf * np.arctan((self.Bf * alphaf)))))
        Fry = (self.Dr * np.sin((self.Cr * np.arctan((self.Br * alphar)))))
    if return_slip:
        return (Ffy, Frx, Fry, alphaf, alphar)
    else:
        return (Ffy, Frx, Fry)