Longitudinal Vehicle Model 實作小筆記


使用到的公式

公式的直觀理解

踩下油門 -> 產生 engine torque

當我們踩下油門,就是在跟引擎說:"請引擎大大轉起來!我要前進了",因為引擎轉起來之後才會開始帶動引擎連動的機械,進而轉動輪子。

為啥這邊的公式是:

直觀理解待補完...先實作出來,有需要再回來理解。

實作 step

一開始可以先想辦法算出汽車的加速度、速度跟位置,然後再根據上面提供的公式一路計算,直到算出新的加速度和角加速度:

class Vehicle(Vehicle):
    def step(self, throttle, alpha):
        # Find the current position, velocity, and engine speed first
        self.x = self.x + self.v * self.sample_time
        self.v = self.v + self.a * self.sample_time
        self.w_e = self.w_e + self.w_e_dot * self.sample_time

        # Calculate F_load
        F_aero = self.c_a * self.v * self.v
        R_x = self.c_r1 * self.v
        F_g = self.m * self.g * np.sin(alpha)
        F_load = F_aero + R_x + F_g

        # Calculate F_x
        W_w = self.GR * self.w_e
        s = (W_w * self.r_e - self.v) / self.v
        F_x = self.c * s
        if abs(s) >= 1:
            F_x = self.F_max

        # Update the acceleration variable
        self.a = (F_x - F_load) / self.m
        T_e = throttle * (self.a_0 + self.a_1 * self.w_e + self.a_2 * self.w_e * self.w_e)
        self.w_e_dot = (T_e - self.GR * self.r_e * F_load) / self.J_e
#Self-Driving Car







你可能感興趣的文章

人性較量Day05~工人智慧與人工智慧

人性較量Day05~工人智慧與人工智慧

CSS保健室|mix-blend-mode

CSS保健室|mix-blend-mode

MTR04_0714

MTR04_0714






留言討論