精华内容
下载资源
问答
  • 据报道,未来五年新车的平均增长率为3.5%,而二手车的增长率为5%,二手车与新车的比例在持续增长。因此,二手车市场日益增长,消费者希望获得其汽车的最佳转售价。 data dictionary.xlsx test.csv ...
  • 这是一个文件,代表出售的汽车市场。这些数据是在互联网上收集的,代表了汽车市场。数据集于2019年黎明收集。 file/opensearch/documents/92963/cars.csv
  • 二手车价格预测 描述: 通常,新车的价格由制造商确定,因此可以确保质量。 对于二手车而言,情况并非如此,在这种情况下,客户容易被假冒公司欺骗,并为价值较低的汽车支付更高的价格。 我们的想法是实现不同的...
  • used_car_data.zip

    2020-05-01 17:02:19
    阿里云天池比赛——二手车交易价格预测数据集,包含训练集和测试集B。用于入门机器学习数据挖掘的非常好的比赛。
  • 建立的宽带CARS实验系统采用非稳腔空间增强探测(USED)相位匹配构造,其横向空间分辨率约0.1 mm,纵向空间分辨率约3 mm,该系统能实现10 Hz重复频率测量火焰瞬时温度。采用宽带非稳腔空间增强探测CARS在甲烷-空气预混...
  • 验证集 used_car_testB_20200421.csv
  • 二手车预测挑战 回购包含有关如何构建可预测二手车价格的模型的源代码
  • 二手车价格预测 :racing_car: :sport_utility_vehicle: :fuel_pump: 一个基于 ML 的 Web 应用程序,可帮助预测二手商品的售价 :automobile: :sport_utility_vehicle: 提供实时 Web 应用程序 数据集 ...
  • Cars Dataset 汽车数据集

    2020-12-27 18:14:38
    摘要:该数据是由stanford创建,提供了... Can this dataset be used for commercial purposes? A: This dataset is for research purposes only, similar to the ImageNet license. Contact ude.drofnats.sc@esuarkj

    摘要:该数据是由stanford创建,提供了汽车数据集,欢迎访问帕伊提提下载使用(https://www.payititi.com).

    汽车数据集包含196类汽车的16,185张图像。数据被分为8,144个训练图像和8,041个测试图像,其中每个类别已大致分为50-50个分割。类通常处于品牌,型号,年份等级别。 2012特斯拉Model S或2012 BMW M3 coupe。

    Evaluation

    在此设置了评估服务器。 devkit中包含有关提交格式的说明。该数据集是FGComp 2013的一部分,竞赛结果可直接与此处图像评估所得的结果进行比较。

    如果使用此数据集,请引用以下论文:

    1. 3D Object Representations for Fine-Grained Categorization
    2. Jonathan Krause, Michael Stark, Jia Deng, Li Fei-Fei
    3. 4th IEEE Workshop on 3D Representation and Recognition, at ICCV 2013(3dRR-13). Sydney, Australia. Dec. 8, 2013.
    4. [pdf][BibTex][slides]

    请注意,发布的数据集具有196个类别,比论文中少一类,因为自发布以来已对其进行了一些清理。数字应该或多或少具有可比性。

    FAQ

    Q. Can this dataset be used for commercial purposes?
    A: This dataset is for research purposes only, similar to the ImageNet license.

    Contact

    ude.drofnats.sc@esuarkj

    展开全文
  • Used-car-Task-3

    2020-04-03 10:09:44
    载入数据 path = 'E:\Train_Test_data\second_hand_car' Train_data = pd.read_csv(path+'\\used_car_train_20200313.csv',sep=' ') Test_data = pd.read_csv(path+'\\used_car_testA_20200313.csv',sep=' ') print...

    简介

    天池 数据挖掘入门-二手车交易价格预测
    地址 https://tianchi.aliyun.com/competition/entrance/231784/information
    目标 特征工程

    步骤

    引入模块

    %matplotlib inline作用:具体作用是当你调用matplotlib.pyplot的绘图函数plot()进行绘图的时候,或者生成一个figure画布的时候,可以直接在你的python console里面生成图像。

    import pandas as pd
    import numpy as np
    import matplotlib
    import matplotlib.pyplot as plt
    import seaborn as sns
    from operator import itemgetter
    # 模仿命令行来访问magic函数的在IPython中独有的形式
    %matplotlib inline
    
    # 载入数据
    path = 'E:\Train_Test_data\second_hand_car'
    Train_data = pd.read_csv(path+'\\used_car_train_20200313.csv',sep=' ')
    Test_data = pd.read_csv(path+'\\used_car_testA_20200313.csv',sep=' ')
    print(Train_data.shape)
    print(Test_data.shape)
    

    删除异常值

    # 删除异常值
    
    # 处理异常值的函数
    def outliers_proc(data,col_name,scale=3):
        """
        用于清洗异常值,默认用box_plot(scale=3)进行清洗(这里不懂?)
        :param data:接受pandas数据格式
        :param col_name:列名
        :param scale:尺度
        :returm
        """
        def box_plot_outliers(data_ser, box_scale):
            """
            利用箱型图去除异常值
            :param data_ser:接受pandas.Series数据格式
            :param box_scale:箱型图尺度
            :return:
            """
            iqr = box_scale * (data_ser.quantile(0.75) - data_ser.quantile(0.25))
            val_low = data_ser.quantile(0.25) - iqr
            val_up = data_ser.quantile(0.75) + iqr
            rule_low = (data_ser < val_low)
            rule_up = (data_ser > val_up)
            return (rule_low , rule_up),(val_low,val_up)
        data_n = data.copy()
        data_series = data_n[col_name]
        rule , value = box_plot_outliers(data_series , box_scale=scale)
        index = np.arange(data_series.shape[0])[rule[0] | rule[1]]
        print('Delete number is:{}'.format(len(index)))
        data_n = data_n.drop(index)
        data_n.reset_index(drop=True , inplace=True)
        print('Now column number is :{}'.format(data_n.shape[0]))
        index_low = np.arange(data_series.shape[0])[rule[0]]
        outliers = data_series.iloc[index_low]
        print('Description of data less than the lower bound is:')
        print(pd.Series(outliers).describe())
        index_up = np.arange(data_series.shape[0])[rule[1]]
        outliers = data_series.iloc[index_up]
        print('Description of data larger than the upper bound is:')
        print(pd.Series(outliers).describe())
        
        fig , ax = plt.subplots(1,2,figsize=(10,7))
        sns.boxplot(y=data[col_name] , data=data , palette='Set1' , ax=ax[0])
        sns.boxplot(y=data_n[col_name] , data=data_n , palette='Set1' , ax=ax[1])
        return data_n
        # 删除异常值
    Train_data = outliers_proc(train , 'power' , scale=3)
    

    特征构造

    # 训练稽核测试集放一起,方便构造特征
    Train_data['train']=1
    Test_data['train']=0
    data = pd.concat([Train_data, Test_data], ignore_index=True)
    
    # 使用时长:data['creatDate'] - data['regDate'],反应汽车使用时间,一般来说价格与使用时间成反比
    # 时间格式不对,使用:errors = 'coerce',.dt.days转天数
    data['used_time'] = (pd.to_datetime(data['creatDate'] , format='%Y%m%d' ,errors = 'coerce' ) - pd.to_datetime(data['regDate'] , format='%Y%m%d' ,errors = 'coerce')).dt.days
    
    # 看一下空数据,有 15k 个样本的时间是有问题的,我们可以选择删除,也可以选择放着。
    # 但是这里不建议删除,因为删除缺失数据占总样本量过大,7.5%
    # 我们可以先放着,因为如果我们 XGBoost 之类的决策树,其本身就能处理缺失值,所以可以不用管;
    data['used_time'].isnull().sum()
    
    # 从邮编中提取城市信息,加入先验知识,德国的邮编
    data['city'] = data['regionCode'].apply(lambda x : str(x)[:-3])
    data=data
    
    # 计算品牌销售量
    Train_gb = Train_data.groupby("brand")
    all_info = {}
    for kind, kind_data in Train_gb:
        info = {}
        kind_data = kind_data[kind_data['price'] > 0]
        info['brand_amount'] = len(kind_data)
        info['brand_price_max'] = kind_data.price.max()
        info['brand_price_median'] = kind_data.price.median()
        info['brand_price_min'] = kind_data.price.min()
        info['brand_price_sum'] = kind_data.price.sum()
        info['brand_price_std'] = kind_data.price.std()
        info['brand_price_average'] = round(kind_data.price.sum() / (len(kind_data) + 1), 2)
        all_info[kind] = info
    brand_fe = pd.DataFrame(all_info).T.reset_index().rename(columns={"index": "brand"})
    data = data.merge(brand_fe, how='left', on='brand')
    
    # 数据分桶 以 power 为例
    # 这时候我们的缺失值也进桶了,
    # 为什么要做数据分桶呢,原因有很多,= =
    # 1. 离散后稀疏向量内积乘法运算速度更快,计算结果也方便存储,容易扩展;
    # 2. 离散后的特征对异常值更具鲁棒性,如 age>30 为 1 否则为 0,对于年龄为 200 的也不会对模型造成很大的干扰;
    # 3. LR 属于广义线性模型,表达能力有限,经过离散化后,每个变量有单独的权重,这相当于引入了非线性,能够提升模型的表达能力,加大拟合;
    # 4. 离散后特征可以进行特征交叉,提升表达能力,由 M+N 个变量编程 M*N 个变量,进一步引入非线形,提升了表达能力;
    # 5. 特征离散后模型更稳定,如用户年龄区间,不会因为用户年龄长了一岁就变化
    
    # 当然还有很多原因,LightGBM 在改进 XGBoost 时就增加了数据分桶,增强了模型的泛化性
    bin = [i*10 for i in range(31)]
    data['power_bin'] = pd.cut(data['power'] , bin , labels=False)
    data[['power_bin' , 'power']].head()
    
    # 删除不需要的数据
    data = data.drop(['creatDate', 'regDate', 'regionCode'], axis=1)
    
    # 目前的数据其实已经可以给树模型使用了,所以我们导出一下
    data.to_csv('E:\Train_Test_data\second_hand_car\data_for_tree.csv', index=0)
    
    # 我们可以再构造一份特征给 LR NN 之类的模型用
    # 之所以分开构造是因为,不同模型对数据集的要求不同
    # 我们看下数据分布:
    data['power'].plot.hist()
    
    # 我们刚刚已经对 train 进行异常值处理了,但是现在还有这么奇怪的分布是因为 test 中的 power 异常值,
    # 所以我们其实刚刚 train 中的 power 异常值不删为好,可以用长尾分布截断来代替
    train['power'].plot.hist()
    
    # 取log,做归一化处理
    from sklearn import preprocessing
    min_max_scaler = preprocessing.MinMaxScaler()
    data['power'] = np.log(data['power']+1)
    data['power'] = ((data['power'] - np.min(data['power'])) / (np.max(data['power']) - np.min(data['power'])))
    data['power'].plot.hist()
    
    # 公里数
    data['kilometer'].plot.hist()
    
    # 公里数,归一化
    data['kilometer'] = ((data['kilometer'] - np.min(data['kilometer'])) / (np.max(data['kilometer']) - np.min(data['kilometer'])))
    data['kilometer'].plot.hist()
    
    
    # 除此之外 还有我们刚刚构造的统计量特征:
    # 'brand_amount', 'brand_price_average', 'brand_price_max',
    # 'brand_price_median', 'brand_price_min', 'brand_price_std',
    # 'brand_price_sum'
    # 这里不再一一举例分析了,直接做变换,
    
    def max_min(x):
        return (x - np.min(x)) / (np.max(x) - np.min(x))
    data['brand_amount'] = ((data['brand_amount'] - np.min(data['brand_amount'])) / 
                           (np.max(data['brand_amount']) - np.min(data['brand_amount'])))
    data['brand_price_max'] = ((data['brand_price_max'] - np.min(data['brand_price_max'])) / 
                           (np.max(data['brand_price_max']) - np.min(data['brand_price_max'])))
    data['brand_price_median'] = ((data['brand_price_median'] - np.min(data['brand_price_median'])) / 
                           (np.max(data['brand_price_median']) - np.min(data['brand_price_median'])))
    data['brand_price_min'] = ((data['brand_price_min'] - np.min(data['brand_price_min'])) / 
                           (np.max(data['brand_price_min']) - np.min(data['brand_price_min'])))
    data['brand_price_sum'] = ((data['brand_price_sum'] - np.min(data['brand_price_sum'])) / 
                           (np.max(data['brand_price_sum']) - np.min(data['brand_price_sum'])))
    data['brand_price_std'] = ((data['brand_price_std'] - np.min(data['brand_price_std'])) / 
                           (np.max(data['brand_price_std']) - np.min(data['brand_price_std'])))
    data['brand_price_average']=((data['brand_price_average'] - np.min(data['brand_price_average'])) / 
                           (np.max(data['brand_price_average']) - np.min(data['brand_price_average'])))
    
    # 对类别特征进行 OneEncoder
    data = pd.get_dummies(data , columns=['model' , 'brand' , 'bodyType' , 'fuelType',
                                         'gearbox' , 'notRepairedDamage' , 'power_bin'])
    # 查看一下
    print(data.shape)
    data.columns
    
    # 这份数据可以给 LR 用
    data.to_csv('E:\Train_Test_data\second_hand_car\data_for_lr.csv', index=0)
    
    # 特征筛选-根据文档总结知识点有3种
    ##过滤式
    ### 相关性分析
    print(data['power'].corr(data['price'] , method='spearman'))
    print(data['kilometer'].corr(data['price'] , method='spearman'))
    print(data['brand_amount'].corr(data['price'] , method='spearman'))
    print(data['brand_price_average'].corr(data['price'] , method='spearman'))
    print(data['brand_price_max'].corr(data['price'] , method='spearman'))
    print(data['brand_price_median'].corr(data['price'] , method='spearman'))
    
    # 可视化
    data_numeric = data[['power' , 'kilometer' , 'brand_amount' , 'brand_price_average' ,
                         'brand_price_max' , 'brand_price_median']]
    correlation = data_numeric.corr()
    
    f , ax = plt.subplots(figsize=(7,7))
    plt.title('Correlation of Numeric Features with Price')
    sns.heatmap(correlation , square = True , vmax=0.8)
    

    /后边我的电脑一跑就死机,笑哭/

    from mlxtend.feature_selection import SequentialFeatureSelector as SFS
    from sklearn.linear_model import LinearRegression
    
    sfs = SFS(LinearRegression(),
               k_features=10,
               forward=True,
               floating=False,
               scoring = 'r2',
               cv = 0)
    x = data.drop(['price'], axis=1)
    x = x.fillna(0)
    y = data['price']
    sfs.fit(x, y)
    sfs.k_feature_names_ 
    
    # 画出来,可以看到边际效益
    from mlxtend.plotting import plot_sequential_feature_selection as plot_sfs
    import matplotlib.pyplot as plt
    fig1 = plot_sfs(sfs.get_metric_dict(), kind='std_dev')
    plt.grid()
    plt.show()
    
    
    展开全文
  • 目录 。 1.项目概述 该项目的目标是为分类网站(如Craig的清单)创建二手车价格预测工具。 这将有助于卖方使用Logistic线性回归模型设定价格点。 设定合适的价格点,以帮助买卖双方有效地完成销售。...
  • 二手车价格预测 二手车价格预测分析侯赛因·坎·米纳雷西 可用数据: ... 概括 在此项目中,我们旨在为二手车数据集找到最佳回归模型,以便能够预测二手车价格。 数据集是由德国eBay的Scrapy抓取的,存在一些错误,...
  • 1 Introduction to Self-Driving Cars WEEK 1 Lesson 1: Practice Quiz Lesson 2: Practice Quiz Module 1: Graded Quiz Module 2: Graded Quiz Module 3: Graded Quiz WEEK 4 Kinematic Bicycle Model Longitudinal...

    前言:这真的是很难得全方位介绍自动驾驶的组成到实现(理论上),专注于无人驾驶方向的课程算是头一个了(其他课程好像花钱的挺贵,Coursera真心算是为想自学的人提供了一个便捷的方法——可以通过15天的申请申请全部课程)
    我建议大家还是申请官方的课程编程作业和自动驾驶仿真真的很有必要入一下,做一下,才能理解一些运动模型的建立过程,代码的实现吧。

    1. Coursera官方链接
    2. b站搬运不是很高清的 CC英文字幕 但是UP主有建github 下载了视频和课件可以去看看评论区获取吧。
      尽管这样,我还是想强调一遍直接在Coursera申请助学金来听课是效果最好的,一来能督促自己(因为申请的课程是必须要通过的 不通过下次就不能申请其他课程了),二来编程作业只能通过会员/申请/付费来解锁。

    希望这以下笔记,和解题答案思路等能给大家领个头,也一起共同学习进步,毕竟国内似乎还没有专门这么针对无人驾驶的课程专项。(为多伦多大学打call)
    2021/6/3 更新:没想到过了整整一年我才更新Final Project hhhhh 立的flag太多了,一定在这个月搞完… 我编辑一会,单元我的代码和图片都还在… emmm

    WEEK 1

    Lesson 1: Practice Quiz

    1.Which of the following are components of longitudinal control? (Select all that apply)
    Accelerating
    Braking

    2.Which of the following is not an example of OEDR?
    Finding a route from your current location to a gaol location

    3.Which of the following tasks would you expect a Level 2 system to perform? (Select all that apply)
    Stay within a lane
    Change lanes
    Matian constant speed

    4.What is the distinction between Level 3 autonomy and Level 4 autonomy?
    Level 3 systems require full user alertness, Level 4 systems do not
    解释:Correct, level 3 systems cannot handle emergencies automatically and as a result require full user alertness.
    Not quite, level 3 systems can perform OEDR automatically.

    5.What distinguishes Level 5 Autonomy from Level 4?
    Level 4 has a restricted operational design domain, whereas Level 5 is unrestricted.

    Lesson 2: Practice Quiz

    1.Which of the following tasks are associated with perception? (Select all that apply)
    Identifying road signs
    Estimating the motion of other vehicles

    2.Which of the following can be on road objects? (Select all that apply)
    Vehicles
    Potholes

    3.Which of the following tasks pose challenges to perception? (Select all that apply)
    Handling sensor uncertainty
    Handling sensor occlusion and reflection
    Detecting, tracking and predicting dynamic object motions
    Having sensors work in adverse weather conditions

    4.Which of the following sensors are used for ego localization? (Select all that apply)
    IMU
    GNSS

    5.Which of the following objects would be relevant for perception in adaptive cruise control?
    Other vehicles

    Module 1: Graded Quiz

    1.Scenario 1: You’re at home and need to drive to work
    During the trip, you will be performing OEDR tasks. Of the tasks below, which of the following is not an example of OEDR?
    Maintaining a distance to a vehicle ahead

    2.Which of the following tasks are associated with perception?
    Estimating the motion of other vehicles
    Identifying road signs

    3.Before leaving, you decide to check the weather. The forecast states that over the next few days there will be both sun and rain along with some fog. Assuming your vehicle exhibits Level 5 autonomy, which of the following weather conditions can your vehicle operate?
    All of the above

    4.You enter your autonomous vehicle and it drives your usual route to work. While the vehicle is driving, you decide to take a nap. For which levels of autonomy is this safe? (Select all that apply)
    4
    5

    5.Scenario 2: (Assume the car is driving on the right-hand side of the road) .

    You’re approaching an all ways stop sign and you want to make a right turn. Your vehicle is denoted in orange. There are 2 pedestrians currently crossing and another vehicle (denoted in green) approaching the stop sign from the left.
    This task involves multiple considerations, which of them are predictive planning? Select all that apply.
    The green car arrives at the stop sign after you and plans to travel straight through the intersection. You choose to move first.
    Wait for the pedestrians to finish crossing before turning

    6.Here are some rules for driving at a stop sign. Which of the following is an appropriate priority ranking?

    1. For non all-way stop signs, stop at a point where you can see oncoming traffic without blocking the intersection

    2. If there are pedestrians crossing, stop until they have crossed

    3. If you reach a stop sign before another vehicle, you should move first if safe
      2,1,3

    7.Which of the following are off-road objects? (Select all that apply)
    Stop signs
    Curbs
    Trees

    8.Suppose your vehicle has lane keeping assistance, which of these objects are relevant for its performance? (Select all that apply)
    Road markings
    Curbs

    9.Which of the following sensors are used for the lane keeping assistance? (Select all that apply)
    LIDAR
    Cameras
    GPS
    IMU

    10.Scenario 3: You are on the highway and you see a truck in front of you. Assume the car is driving on the right-hand side of the road. There is also a blue car beside the truck in the other lane.
    Your vehicle follows the truck and maintains a constant distance away. What kind of control is this?
    Longitudinal

    11.You decide to change lanes to pass a truck. What kind of decision is this?
    Short term planning

    12.Which of the following tasks are rule-based planning? (Select all that apply)
    During a lane chang, maintain our current speed or accelerate slightly
    If there are vehicles directly beside us on the lane, it is unsafe to lane change.

    13.Suppose the blue vehicle suddenly brakes and you decide to abort the lane change. If your vehicle can respond automatically and remain in its own lane, what is the minimum level of autonomy of your vehicle?
    3

    14.The blue vehicle returns to normal speed and you can now safely change lanes. Your car is performing the lane change, what kind of control is this?
    Lateral

    15.Scenario 4: You are almost at work but encounter a construction site.

    Assume the car is driving on the right-hand side of the road. Your vehicle is denoted in orange.
    B
    C
    E

    16.Here are a set of rules for making these decisions, arrange them in an appropriate prioritization.

    1. If there are no vehicles ahead, accelerate to the speed limit
    2. Drive slowly in construction zones
    3. If there are pedestrians or workers directly ahead in the current lane, stop
    4. Yield to merging vehicles, if necessary

    3 4 2 1

    17.Scenario 5: You’re finished work and need to drive back home, but it’s nighttime.
    You plan a new path home on your GPS application to avoid the construction site, what type of planning is this?
    Long term

    18.Your new path goes through a school zone and you see the school zone sign. You decide to slow down despite there being no pedestrians or children (it’s nighttime). What sort of planning is this?
    Rule based planning

    Module 2: Graded Quiz

    1.What are the differences between exteroceptive sensors and proprioceptive sensors? (Select all that apply)
    Proprioceptive sensors do not interact with the environment, whereas exteroceptive sensors do.
    Exteroceptive sensors can determine obstacle size and distance away, whereas proprioceptive sensors cannot.

    2.Which of the following exteroceptive sensors would you use in harsh sunlight?
    Radar
    Sonar

    3.Why is synchronization and timing accuracy important in the self driving system? Choose the primary reason.
    Synchronization is important to ensure correct sensor fusion.

    4.Your autonomous vehicle is driving on the German autobahn at 150 km/h and you wish to maintain safe following distances with other vehicles. Assuming a safe following distance of 2s, what is the distance (in m) required between vehicles? Round your answer to 2 decimal places.
    83.33

    5.Using the same speed of 150 km/h, what is the braking distance (in m) required for emergency stops? Assume an aggressive deceleration of 5 m/s^2. Round your answer to 2 decimal places.
    173.61

    6.Suppose your vehicle was using long range cameras for sensing forward distance, but it is now nighttime and the images captured are too dark. Which of the following sensors can be used to compensate?
    Lidar
    Radar

    7.What are the differences between an occupancy grid and a localization map? (Select all that apply)
    The localization map is primarily used to estimate the vehicle position, whereas the occupancy grid is primarily used to plan collision free paths.
    An occupancy grid uses a dense representation of the environment, whereas a localization map does not need to be dense.

    8.The vehicle steps through the software architecture and arrives at the controller stage. What information is required for the controller to output its commands to the vehicle?
    Vehicle state
    Planned paths

    9.What is (are) the role(s) of the system supervisor? (Select all that apply)
    To ensure that the sensors are working correctly
    To ensure that the maps update at the correct frequencies

    10.Which of the following tasks should be assigned to the local planner?
    Planning to avoid a parked car in the ego vehicle’s lane

    11.What common objects in the environment appear in the occupancy grid?
    Parked Vehicles

    12.Which of the following maps contain roadway speed limits?
    Detailed roadmap

    Module 3: Graded Quiz

    1.Which from the below options is the most ACCURATE and COMPLETE definition of risk in terms of self-driving vehicles?
    Risk is a probability that an event occurs combined with the severity of the harm that the event can cause

    2.Which of the following are major components of an autonomous driving system? (Select all that apply)
    Perception
    Planning
    Control

    3.What are the most common categories of autonomous vehicle hazard sources? (Select all that apply)
    ALL

    4.Is the following statement TRUE or FALSE?
    The safety framework to structure safety assessment for autonomous driving defined by NHTSA is MANDATORY to follow.
    False

    5.Which categories are included in the safety framework to structure safety assessment for autonomous driving defined by NHTSA? (Select all that apply)
    Testing and crash mitigation
    Well-organized software development process
    Autonomy design

    6.Which actions are needed to be performed in the event of an accident by an autonomous vehicle? (Select all that apply)
    Alerting first responders
    Data recording to a black box
    Returning car to a safe state
    ?Securing

    7.What are the most common accident scenarios? (Select all that apply)
    Lane change
    Crosswalk X
    Intersection
    Rollover X
    ?

    8.What kind of safety system is described by the following definition? This system can be analyzed to define quantifiable safety performance based on critical assessment of various scenarios.
    Analytical safety

    9.According to the report by Rand Corporation, autonomous driving of 8.8 billion miles is required to demonstrate human-level fatality rate of an autonomous vehicle fleet using a 95% Confidence Interval. How many years is required to perform this testing with a fleet of 100 vehicles running 24 hours a day, 7 days a week at an average of 25 miles per hour? Your answer should be an integer.
    400
    解释:881000010000/100vehicles/25/24hors/365days

    10.Given that an autonomous vehicle failure has happened and based on this tree, what is the probability that the failure happened because of Vehicle Control Algorithm Failure OR Inadequate Car Drivers? Please give your answer with the precision of 3 decimal places.

    Please use this probabilistic fault tree for your computation:
    0.382

    11.Given that the autonomous vehicle failure has happened, and based on this tree, what is the probability that the failure happened because of Software Failure AND Extreme Weather Conditions at the same time? Please give your answer with the precision of 3 decimal places.

    Please use the probabilistic fault tree from the previous question for your computation:
    0.001

    12.A computer vision algorithm is responsible for extracting meaningful data from the onboard camera. A computer vision failure restricts the vehicle’s ability to navigate the environment around it, hence a problem with this system is a serious failure. However, LiDAR and radar sense similar environment data, so a computer vision failure does not leave the vehicle completely blind. A Computer vision algorithm failure can be considered a somewhat severe failure as it decreases vehicle sensing ability and it gets a severity score of 5. This could happen regularly in low light situations, hence the occurrence number is assigned 4. Computer vision algorithm failure is fairly detectable in majority of the situations, so the detectability score is 3.

    What is the risk priority number for a Computer vision algorithm failure according to FMEA and based on the description above? Your answer should be an integer.
    60

    13.There are failures listed below. Which failures should we focus on solving first according to FMEA?
    Vehicle driving onto a gravel road (risk priority score of 400)

    14.Which of the following options is the most ACCURATE and COMPLETE definition of functional safety in terms of self-driving vehicles?
    Functional safety is the detection of a potentially dangerous condition resulting in the activation of a protective or corrective device or mechanism to prevent hazardous events arising or providing mitigation to reduce the consequence of the hazardous event

    15.Which of the following standards defines functional safety terms and activities for electrical and electronic systems within motor vehicles?
    ISO 26262

    WEEK 4

    这周是编程题,挺有意思的,特别是绕八,通过可能比较简单,但是100%有点难
    这个一共有两个是我们要填的,务必确保前面的正确了,理解了再进行下面的

    Kinematic Bicycle Model

    class Bicycle(Bicycle):
        def step(self, v, w):
            # ==================================
            #  Implement kinematic model here
            # ==================================
            if w>0:
                w=min(w,self.w_max)
            else:
                w=max(w,-self.w_max)
            
            # sample time 10 milliseconds
            sample_T=10e-3
            
            # bicycle kinematics
            xc_dot=v*np.cos(self.theta+self.beta)
            yc_dot=v*np.sin(self.theta+self.beta)
            theta_dot=v*np.cos(self.beta)*np.tan(self.delta)/self.L
            delta_dot=w
            
            self.beta=np.arctan(self.lr*np.tan(self.delta)/self.L)
            
            # update the state variables
            
            self.xc += xc_dot * sample_T
            self.yc += yc_dot * sample_T
            self.theta += theta_dot * sample_T
            self.delta += delta_dot * sample_T
    
    sample_time = 0.01
    time_end = 30
    model.reset()
    
    t_data = np.arange(0,time_end,sample_time)
    x_data = np.zeros_like(t_data)
    y_data = np.zeros_like(t_data)
    v_data = np.zeros_like(t_data)
    w_data = np.zeros_like(t_data)
    
    # ==================================
    #  Learner solution begins here
    # ==================================
    radius=8
    #delta=np.arctan(np.arctan(np.arctan(np.arctan(model.L/radius))))
    #delta=np.arctan(np.arctan(np.arctan(model.L/radius)))
    delta=np.arctan(np.arctan(model.L/radius))
    #delta=np.arctan(model.L/radius)
    delta=0.983*np.arctan(model.L/radius)
    print(delta)
    print(np.arctan(np.arctan(model.L/radius)))
    v_data[:]=2*2*np.pi*radius/time_end
    
    for i in range(t_data.shape[0]):
        x_data[i]=model.xc
        y_data[i]=model.yc
        
        #w direction will change in first 1/4 circle (t/8) and 5/4 circle (5t/8)
        if i< t_data.shape[0]/8:
            # if model delta < delta then we should use max w
            if model.delta<delta:
                temp_w=abs(model.delta-delta)/model.delta*model.w_max
                if temp_w>0:
                    w=min(temp_w,model.w_max)
                else:
                    w=max(temp_w,-model.w_max)
                model.step(v_data[i],w)
                w_data[i]=w
                #print(w_data[i],t_data[i])
            #else we should use w=0 don't turn your front wheel
            else:
                model.step(v_data[i],0)
                #w_data[i]=0
            
        elif i< 5*t_data.shape[0]/8:
            #print(model.delta,delta,t_data[i])
            if model.delta>-delta:
                model.step(v_data[i],-model.w_max)
                w_data[i]=-model.w_max
                #print(w_data[i],t_data[i])
            else:
                model.step(v_data[i],0)
                #w_data[i]=0
        else:
            if model.delta<delta:
                model.step(v_data[i],model.w_max)
                w_data[i]=model.w_max
            else:
                model.step(v_data[i],0)
                #w_data[i]=0
    #     model.beta = 0
    #     solution_model.beta=0
    # ==================================
    #  Learner solution ends here
    # ==================================
    plt.axis('equal')
    plt.plot(x_data, y_data)
    plt.show()
    

    Longitudinal Vehicle Model

    class Vehicle(Vehicle):
        def step(self, throttle, alpha):
            # ==================================
            #  Implement vehicle model here
            # ==================================
            w_w=self.GR*self.w_e
            s=(w_w*self.r_e-self.v)/self.v
            
            if abs(s)<1:
                F_x=self.c*s
            else:
                F_x=self.F_max
                
            F_aero=self.c_a*(self.v**2)
            R_x=self.c_r1*self.v
            F_g=self.m*self.g*np.sin(alpha)
            
            F_load=R_x+F_aero+F_g
            
    
            
            self.a=(F_x-F_load)/self.m
            self.v += self.a * self.sample_time
            self.x += self.v * self.sample_time
            
            T_e=throttle*(self.a_0+self.a_1*self.w_e+self.a_2*self.w_e**2)
            
            self.w_e_dot = (T_e - self.GR*self.r_e*F_load)/self.J_e
            self.w_e += self.w_e_dot * self.sample_time
    
    time_end = 20
    t_data = np.arange(0,time_end,sample_time)
    x_data = np.zeros_like(t_data)
    s_data = np.zeros_like(t_data)
    # reset the states
    model.reset()
    
    # ==================================
    #  Learner solution begins here
    # ==================================
    throttle_data = np.zeros_like(t_data)
    alpha_data = np.zeros_like(t_data)
    for i,t in enumerate(t_data):
        if t<5:
            throttle_data[i]=0.2+(0.5-0.2)*t/5
        elif t<15:
            throttle_data[i]=0.5
        else:
            throttle_data[i]=0.5-0.5*(t-15)/5
        
    for i in range(t_data.shape[0]):
        v_data[i]=model.v
        
        if model.x<60:
            alpha_data[i]=np.arctan(3/60)
        elif model.x<150:
            alpha_data[i]=np.arctan((12-3)/90)
        else:
            alpha_data[i]=0
    
        model.step(throttle_data[i], alpha_data[i])
        
        x_data[i]=model.x
        v_data[i]=model.v
        w_w=model.GR*model.w_e
        s_data[i]=(w_w*model.r_e-model.v)/model.v
    # ==================================
    #  Learner solution ends here
    # ==================================
    
    # Plot x vs t for visualization
    plt.plot(t_data, x_data)
    plt.show()
    

    WEEK 5

    这周的最后一个课后采访惊到我了,Zook作为自动驾驶的初创公司,不是往传统车上装传感器,而是自己去设计车(比如去除冗余的方向盘,四个轮子都可以转向)专注于自动驾驶的控制方向的公司,emm 很有意思,很像真正的L5等级的自动驾驶了

    Module 5 Graded Quiz

    1.What is the order of the following transfer function?
    This is the second order transfer function

    2.What are the poles and zeros of the following transfer function?
    The poles are -3 and 4;the zeros are 2 and -5

    3.What might be your action as a system control engineer if you need to increase the overshoot of a control loop system? (Select all that apply)
    Increaser K P K_P KP
    Increaser K I K_I KI

    4.Recall the Mass-Spring-Damper System example form the video on PID Control. This system is shown in the figure below.
    Transformation function 4

    5.You are given the step response of a few different PID controllers using the same gains for the same first order transfer function. Determine a possible set of controllers that generated these step responses:
    PD;PID;PI

    6.What is the output of a typical output of a Longitudinal control module? (Select all that apply)
    Throttle angle
    Brake position

    7.Based on the engine map in the figure below, determine the throttle angle needed to produce 250 ft-lb of torque given that the current engine speed is 3500 RPM.
    0.6

    8.The results of a simulation of the control response to a step change in desired speed of a dynamic vehicle model with a PID controller are shown in the figures below. There are two spikes on these figures: one spike is between 2 and 3 seconds, another spike is between 3 and 4 seconds. What is the reason of these spikes?
    Nonlinear engine map

    9.What type of control system is shown in the figure below?
    Feedforward control

    10.What types of inaccuracies are corrected by a feedback controller?
    Disturbance
    Errors in the plant model

    11.What assumptions are essential for creation of a longitudinal feedforward input? (Select all that apply)
    The vehicle is at steady state

    12.What are the sources of the load torque considered for a longitudinal feedforward look-up table computation? (Select all that apply)
    Gravitational resistance
    Rolling resistance
    Aerodynamic resistance

    13.A vehicle is being operated on a highway with the reference velocity of 126 km/h (35 m/s) in gear 4 and it overcomes the total load torque of 300 ft-lb. This vehicle specification includes effective wheel radius of 0.35 m and 4th gear ratio of 2. What throttle angle is required for maintaining the the current speed of the vehicle?
    0.7
    解释: w w = V r e f r r e f f = 35 0.35 = 100 w_w=\frac{{{V_{ref}}}}{{{r_{reff}}}}=\frac{35}{0.35}=100 ww=rreffVref=0.3535=100

    w e = w w G R = 100 2 = 50 [ h e r t z ] w_e=\frac{w_w}{GR}=\frac{100}{2}=50[hertz] we=GRww=2100=50[hertz]

    w e = 50 ∗ 60 = 3000 R P M w_e=50*60=3000RPM we=5060=3000RPM

    Module 6: Graded Quiz

    1.Which reference path is the most compact and easy to construct?
    Track straight line segment

    2.What is the most ACCURATE and PRECISE definition of the crosstrack error?
    The crosstrack error is the distance between the vehicle reference point and the closest point on the reference path

    3.What vehicle reference frame is used in a pure pursuit controller?
    Center of the rear axle

    4.Compute the radius from the instantaneous center of rotation to the center of the vehicle rear axle (in m) required for an autonomous vehicle to follow the desired path based on the information below.
    The lookahead distance is 10 m; the car length is 4 m; the angle between the vehicle’s body heading and the lookahead line is 30°. Your answer should be an integer.
    10

    5.Compute the steering angle (in degrees) required for an autonomous vehicle with pure pursuit lateral control for following the desired path based on the information below.
    The lookahead distance is 15 m; the car length is 5 m; the angle between the vehicle’s body heading and the lookahead line is 60°.
    30

    6.Consider a situation in which a vehicle traveling speed has decreased from 100 km/h to 50 km/h. This vehicle lateral control is implemented with a pure pursuit controller where l d l_d ld is assigned as a function of vehicle speed. How should l d l_d ld change in this situation?
    l d l_d ld should decrease

    !7.What are major components of the Stanley controller? (Select all that apply)
    Steering angle is set equal to the heading direction to eliminate heading error relative to the path
    Proportional control is introduced for minimizing the crosstrack error
    Steering angle command is restricted to the min and max steering angles

    解释:详情见Lesson 3: Limits of Geometric Steering Control

    8.What is the correct figure of the crosstrack error dynamics for a small error value(where
    Figure 3

    9.What is the value of the crosstrack error, governed by the ODE
    0.54
    解释:e(t) = e(0)*e^(-kt)

    10.Which of the statements below about Model Predictive Control (MPC) are TRUE? (Select all that apply)
    MPC works for both linear and nonlinear models
    MPC can impose constraints on the states and the input simultaneously
    The formulation of an MPC controller is straightforward

    11.What is the typical way of finding the solution for a nonlinear vehicle dynamics model given an input function?
    Numerical optimization

    12.What is the output of the Model Predictive Controller described in this course? (Select all that apply)
    Longitudinal forces
    Lateral forces

    Final Project: Self-Driving Vehicle Control

    这个写完了 但是需要时间整理一下笔记… emm,先发出来给大家看前面的测试吧
    首先 毋庸置疑,这个是一个比较大的大作业,然后看后续很多人(随意点了一下看到有粉丝) 都发过运行配置的:https://blog.csdn.net/qwe900/article/details/109060476
    大家可以做个参考,毕竟我是很久之前写的了,就不像现在的CS285那样一步步运行着教了

    作业描述处写的比较清楚了:
    几点提示:CARLA是老版;Python请安装anconda进行版本管理,不过是Ubuntu还是Window都建议这么干

    1. 按照之前阅读的 CARLA 安装指南安装 CARLA 模拟器

    2. 下载以下“Course1FinalProject.zip”文件并解压到“CarlaSimulator”(根)文件夹内的子文件夹“PythonClient”中。 这将在“PythonClient”下创建一个包含作业文件的子文件夹“Course1FinalProject”。

    3. 编辑“controller2d.py”类文件(在“Course1FinalProject”文件夹中,“PythonClient”下)。这是您的控制器将被实施的地方。
      “controller2d.py”文件包含一个控制器对象。您将在由注释块标记的 update_controls 方法中实现控制器(查找包含“MODULE 7”的所有注释块 - 这些作为锚点,您可以在它们下面实现代码)。

      控制器为您提供以下实施所需的相关信息。所有单位都是SI(米、秒、弧度),CARLA工作在左手坐标系(由于虚幻引擎采用左手坐标系)。由于控制器在 x、y 和 yaw 空间中运行,因此这通常不应该成为此分配的问题。

      waypoints 变量是要跟踪的航点的 Python 列表,其中每一行表示格式为 [x, y, v] 的航点,分别是 x 和 y 位置以及该位置的所需速度。访问第三个航点的 y 位置的示例是:

      waypoints[2][1] # Remember that Python's indexing begins at 0
      
    4. 运行Carla,Window下,如果想在Window下快乐命令终端[真的很快乐],见:【Window开发】设置windows terminal

      CarlaUE4.exe /Game/Maps/RaceTrack -windowed -carla-server -benchmark -fps=30
      

      如果想Carla不止于此作业,而是自己将来还要用 建议安装新版本,系列教程也在我的博客中有…

    5. 打开另一个终端界面,然后进入PythonClient的文件夹中

      python module_7.py
      

      如果 module_7 客户端正确连接到服务器,模拟器将开始运行。 它将打开两个新的反馈窗口(除非 live_plotting 被禁用 - 有关更多详细信息,请参阅下面的 options.cfg 编辑),其中一个显示轨迹,另一个显示控件反馈。

      轨迹反馈将包含汽车、起点和终点位置、整个路径/路径以及一个小的阴影区域,该区域表示要发送到控制器进行控制更新的内插点的子集。 航路点之间使用线性插值来为控制器提供更精细的分辨率路径/速度请求。 X 轴和 Y 轴以米为单位。

    后面我就不说了太多废话了,简略点就是:

    1. 安装Carla【就解压一个压缩包而已】
    2. 运行Carla
    3. 运行自己的脚本
    4. 提交对应的格式文档到Coursera打分

    整个完成后的controller2d.py如下:(直接复制整个了)PID应该是我调过OK了的… 吧 吧 吧,看来当时我写这个代码的注释里还考虑到了注释公式对应啥的虽然就是直接说的和课程对应

    #!/usr/bin/env python3
    
    """
    2D Controller Class to be used for the CARLA waypoint follower demo.
    """
    
    import cutils
    import numpy as np
    
    class Controller2D(object):
        def __init__(self, waypoints):
            self.vars                = cutils.CUtils()
            self._current_x          = 0
            self._current_y          = 0
            self._current_yaw        = 0
            self._current_speed      = 0
            self._desired_speed      = 0
            self._current_frame      = 0
            self._current_timestamp  = 0
            self._start_control_loop = False
            self._set_throttle       = 0
            self._set_brake          = 0
            self._set_steer          = 0
            self._waypoints          = waypoints
            self._conv_rad_to_steer  = 180.0 / 70.0 / np.pi
            self._pi                 = np.pi
            self._2pi                = 2.0 * np.pi
    
        def update_values(self, x, y, yaw, speed, timestamp, frame):
            self._current_x         = x
            self._current_y         = y
            self._current_yaw       = yaw
            self._current_speed     = speed
            self._current_timestamp = timestamp
            self._current_frame     = frame
            if self._current_frame:
                self._start_control_loop = True
    
        def update_desired_speed(self):
            min_idx       = 0
            min_dist      = float("inf")
            desired_speed = 0
            for i in range(len(self._waypoints)):
                dist = np.linalg.norm(np.array([
                        self._waypoints[i][0] - self._current_x,
                        self._waypoints[i][1] - self._current_y]))
                if dist < min_dist:
                    min_dist = dist
                    min_idx = i
            if min_idx < len(self._waypoints)-1:
                desired_speed = self._waypoints[min_idx][2]
            else:
                desired_speed = self._waypoints[-1][2]
            self._desired_speed = desired_speed
    
        def update_waypoints(self, new_waypoints):
            self._waypoints = new_waypoints
    
        def get_commands(self):
            return self._set_throttle, self._set_steer, self._set_brake
    
        def set_throttle(self, input_throttle):
            # Clamp the throttle command to valid bounds
            throttle           = np.fmax(np.fmin(input_throttle, 1.0), 0.0)
            self._set_throttle = throttle
    
        def set_steer(self, input_steer_in_rad):
            # Covnert radians to [-1, 1]
            input_steer = self._conv_rad_to_steer * input_steer_in_rad
    
            # Clamp the steering command to valid bounds
            steer           = np.fmax(np.fmin(input_steer, 1.0), -1.0)
            self._set_steer = steer
    
        def set_brake(self, input_brake):
            # Clamp the steering command to valid bounds
            brake           = np.fmax(np.fmin(input_brake, 1.0), 0.0)
            self._set_brake = brake
    
        def update_controls(self):
            ######################################################
            # RETRIEVE SIMULATOR FEEDBACK
            ######################################################
            x               = self._current_x
            y               = self._current_y
            yaw             = self._current_yaw
            v               = self._current_speed
            self.update_desired_speed()
            v_desired       = self._desired_speed
            t               = self._current_timestamp
            waypoints       = self._waypoints
            throttle_output = 0
            steer_output    = 0
            brake_output    = 0
    
            ######################################################
            ######################################################
            # MODULE 7: DECLARE USAGE VARIABLES HERE
            ######################################################
            ######################################################
            """
                Use 'self.vars.create_var(<variable name>, <default value>)'
                to create a persistent variable (not destroyed at each iteration).
                This means that the value can be stored for use in the next
                iteration of the control loop.
    
                Example: Creation of 'v_previous', default value to be 0
                self.vars.create_var('v_previous', 0.0)
    
                Example: Setting 'v_previous' to be 1.0
                self.vars.v_previous = 1.0
    
                Example: Accessing the value from 'v_previous' to be used
                throttle_output = 0.5 * self.vars.v_previous
            """
            self.vars.create_var('v_previous', 0.0)
            self.vars.create_var('t_previous', 0.0)
    
            # For longitudinal PID
            self.vars.create_var('lon_Kp', 1.0)
            self.vars.create_var('lon_Ki', 0.1)
            self.vars.create_var('lon_Kd', 0.1)
            
            # intergal error store
            self.vars.create_var('lot_err_pre', 0.0)
            self.vars.create_var('lot_err_pre_integral', 0.0)
    
            #Throttle parameter store
            self.vars.create_var('throttle_des', 0.0)
            self.vars.create_var('throttle_previous', 0.0)
    
            # For
            self.vars.create_var('lat_constant_K', 0.4)
            self.vars.create_var('steer_des', 0.0)
            # Skip the first frame to store previous values properly
            if self._start_control_loop:
                """
                    Controller iteration code block.
    
                    Controller Feedback Variables:
                        x               : Current X position (meters)
                        y               : Current Y position (meters)
                        yaw             : Current yaw pose (radians)
                        v               : Current forward speed (meters per second)
                        t               : Current time (seconds)
                        v_desired       : Current desired speed (meters per second)
                                          (Computed as the speed to track at the
                                          closest waypoint to the vehicle.)
                        waypoints       : Current waypoints to track
                                          (Includes speed to track at each x,y
                                          location.)
                                          Format: [[x0, y0, v0],
                                                   [x1, y1, v1],
                                                   ...
                                                   [xn, yn, vn]]
                                          Example:
                                              waypoints[2][1]: 
                                              Returns the 3rd waypoint's y position
    
                                              waypoints[5]:
                                              Returns [x5, y5, v5] (6th waypoint)
                    
                    Controller Output Variables:
                        throttle_output : Throttle output (0 to 1)
                        steer_output    : Steer output (-1.22 rad to 1.22 rad)
                        brake_output    : Brake output (0 to 1)
                """
    
                ######################################################
                ######################################################
                # MODULE 7: IMPLEMENTATION OF LONGITUDINAL CONTROLLER HERE
                ######################################################
                ######################################################
                """
                    Implement a longitudinal controller here. Remember that you can
                    access the persistent variables declared above here. For
                    example, can treat self.vars.v_previous like a "global variable".
                """
                
                # Change these outputs with the longitudinal controller. Note that
                # brake_output is optional and is not required to pass the
                # assignment, as the car will naturally slow down over time.
                throttle_output = 0
                brake_output    = 0
    
                # 其实在Final Project里有提示 视频和文字都有,下面我打英文可能能对着课程理解点(主要是..中文有时候没有对应正式翻译哈)
                # Frist throttle&brake control the longitudinal behaviours
                Kp=self.vars.lon_Kp
                Ki=self.vars.lon_Ki
                Kd=self.vars.lon_Kd
    
                t_cur=t # time of current
                t_pre=self.vars.t_previous
    
                t_sample=t_cur-t_pre # Sample time for each loop
    
                # This Part for P
                v_des=v_desired # Current desired speed
                v_cur=v # Current speed
                v_err_cur=v_des-v_cur # error speed of this time
                
                # This Part for I (integral)
                v_err_pre = self.vars.lot_err_pre
                v_err_pre_integ = self.vars.lot_err_pre_integral
                v_err_integ = v_err_pre_integ + v_err_pre * t_sample
    
                # This Part for D
                v_err_diff = (v_err_cur-v_err_pre)/t_sample
                print(v_err_cur,v_err_integ,v_err_diff)
    
                # Combine PID (Ref:In C1M5L2 longitudinal speed control with pid
                a_des = Kp*(v_err_cur) + Ki*v_err_integ + Kd*v_err_diff
    
                throttle_pre = self.vars.throttle_previous
                if a_des>0:
                    throttle_des=a_des
                    if (throttle_des-throttle_pre) >0.1:
                        throttle_des = throttle_pre+0.1 # just for slowly accelaration
                else:
                    throttle_des=0
                    # brake_output=a_des # brake don't need output bcs the Carla will do it for us
    
                self.vars.throttle_des=throttle_des
                throttle_output=self.vars.throttle_des
    
                ######################################################
                ######################################################
                # MODULE 7: IMPLEMENTATION OF LATERAL CONTROLLER HERE
                ######################################################
                ######################################################
                """
                    Implement a lateral controller here. Remember that you can
                    access the persistent variables declared above here. For
                    example, can treat self.vars.v_previous like a "global variable".
                """
                
                # Change the steer output with the lateral controller. 
                steer_output    = 0
                
                # Please watch follow code with class reference picture
                """
                        x               : Current X position (meters)
                        y               : Current Y position (meters)
                        yaw             : Current yaw pose (radians)
                """
                y_final=waypoints[-1][1]
                x_final=waypoints[-1][0]
                y_start=waypoints[0][1]
                x_start=waypoints[0][0]
    
                # For path
                path_angle=(y_final-x_final)/(y_start-x_start)#参考路径的斜率 reference path slope
                yaw_des=np.arctan2((y_final-y_start),(x_final-x_start)) #arctan2 is different with arctan function
                yaw_err=yaw_des-yaw
                if yaw_err >= np.pi:
                    yaw_err -= 2*np.pi
                elif yaw_err < -np.pi:
                    yaw_err += 2*np.pi
                
                # For car coordinate
                point_cur=np.array([x,y]) # just from calculate crosserror conveniently
                crosstrack_err=np.min(np.sum((point_cur-np.array(waypoints)[:,:2])**2,axis=1))
                yaw_crosstrack=np.arctan2(y-y_start,x-x_start)
                yaw_intercross=yaw_des-yaw_crosstrack
                if yaw_intercross >= np.pi:
                    yaw_intercross -= 2*np.pi
                elif yaw_intercross < -np.pi:
                    yaw_intercross += 2*np.pi
                
                # if intercross angle > 0 it means that car state is totally opposite
                if yaw_intercross>0:
                    crosstrack_err = abs(crosstrack_err)
                else:
                    crosstrack_err = - abs(crosstrack_err)
    
                # Combine All
                K=self.vars.lat_constant_K
                yaw_crosstrack_err=np.arctan(K*crosstrack_err/v_cur)
                steer_des=yaw_crosstrack_err+yaw_err
                if steer_des >= np.pi:
                    steer_des -= 2*np.pi
                elif steer_des < -np.pi:
                    steer_des += 2*np.pi      
                if steer_des > 1.22:
                    steer_des=1.22
                elif steer_des < -1.22:
                    steer_des=-1.22
                self.vars.steer_des = steer_des         
                steer_output = self.vars.steer_des
                ######################################################
                # SET CONTROLS OUTPUT
                ######################################################
                self.set_throttle(throttle_output)  # in percent (0 to 1)
                self.set_steer(steer_output)        # in rad (-1.22 to 1.22)
                self.set_brake(brake_output)        # in percent (0 to 1)
    
            ######################################################
            ######################################################
            # MODULE 7: STORE OLD VALUES HERE (ADD MORE IF NECESSARY)
            ######################################################
            ######################################################
            """
                Use this block to store old values (for example, we can store the
                current x, y, and yaw values here using persistent variables for use
                in the next iteration)
            """
            self.vars.v_previous = v  # Store forward speed to be used in next step
            self.vars.t_previous = t_cur # Store current to be used in next step (and it became previous time)
            self.vars.lot_err_pre = v_err_cur
            self.vars.lot_err_pre_integral = v_err_integ
            self.vars.throttle_previous=self.vars.throttle_des
            
    

    具体运行后会由module_7.py输出几幅图如下:
    在这里插入图片描述
    在这里插入图片描述
    在这里插入图片描述
    在这里插入图片描述
    在这里插入图片描述
    生成的.txt我看更新后好像是另一个py文件生成的,我当时是module_7.py里面就生成了

    WAYPOINTS_FILENAME = 'racetrack_waypoints.txt'  # waypoint file to load
    

    运行GIF图:
    在这里插入图片描述

    展开全文
  • Rmarkdown:Duplicate chunk label ‘plot’, which has been used for the chunk: Error in parse_block(g[-1], g[1], params.src, markdown_mode) : Duplicate chunk label ‘plot’, which has been used for the...

    Rmarkdown:Duplicate chunk label ‘plot’, which has been used for the chunk:

    Error in parse_block(g[-1], g[1], params.src, markdown_mode) : Duplicate chunk label ‘plot’, which has been used for the chunk:
    原因:我有两个绘图代码块,但没有命名,系统认为两个代码块是同名的,所以报错。

    ```{r plot}
    plot(x,sqrt(x^(-m))*fit1$residuals,main="残差图")
    
    ```{r plot}
    plot(x,sqrt(x^(-m))*fit2$residuals,main="残差图")
    
    解决办法为:在{r plot}里加上命名,如下:
    ```{r plot1 plot}
    plot(x,sqrt(x^(-m))*fit2$residuals,main="残差图")
    
    ```{r plot2 plot}
    plot(x,sqrt(x^(-m))*fit1$residuals,main="残差图")
    
    展开全文
  • The unstable-resonator spatially enhanced detection (USED) coherent anti-stokes Raman spectroscopy (CARS) measurements of temperature and N_(2) concentration in the combustion of solid propellant at ...
  • Driving Cars WEEK 5 Semantic Segmentation For Self-Driving Cars WEEK 6 Environment Perception For Self-Driving Cars 前言:这真的是很难得全方位介绍自动驾驶的组成到实现(理论上),专注于无人驾驶方向的...
  • A discrete mathematical structure used for representing the road network !4.True or false, Breadth-First Search (BFS) will explore the graph using a “last-in-first-out” data structure known as a ...
  • 当ROS邂逅自动驾驶汽车 [LIVE STREAMING] ROS meets Self-driving Cars 直播日期:2018年9月26日| 下午6点CEST Live Date: Sep 26, 2018 | 6 pm CEST 直播视频网址:https://youtu.be/bownDxQsMxM 自动驾驶...
  • 2 State Estimation and Localization for Self-Driving Cars WEEK 1 Lesson 1: Practice Quiz Lesson 2: Practice Quiz Module 1: Graded Quiz WEEK 2 Module 3: Graded Quiz Module 4: Graded Quiz WEEK 5 Final ...
  • Do electric cars dream of software fixes?
  • UsedCarsCebu-源码

    2021-03-26 10:55:25
    UsedCarsCebu
  • The Guide to Driverless Cars 温馨提示:正文推送半小时,您将收到精编讲义 Passage 1 无人驾驶汽车的革命已经开始 The Driverless Car Revolution Has Begun From Wired · 232 words · 3 mins In the past five ...
  • Deep Learning in Autonomous Driving Cars Forewords:Section 1: Introduction to autonomous driving technologySection 2: Application of deep learning algorithms in autonomous driving2.1 Application of ...
  • 2.3 探索和理解数据 2.3.1 数据的结构 read.scv() str() 数据导入到R后,就要开始对数据做一个基本的检查...## data exploration example using used car data usedcars <- read.csv("usedcars.csv", string...
  • Edmunds - Shop Cars For Sale

    2021-01-14 05:57:06
    Whether you're casually browsing and researching or shopping for your next car, Edmunds is here to help. We make car buying ... Tap into a huge selection of new and used vehicles near you. Unlock in...
  • or by other means of technical information, including: equipment or software information, such as your mobile device and a web browser or other program used to access our services provided by the ...
  • <p>I am trying to get the total count for new and used cars from the column "type" in a csv file. I output the data fine but cant seem to figure out out to split up the new and used count.. <p>Here ...
  • Lance Eliot - AI Self-Driving Cars Divulgement_ Practical Advances In Artificial Intelligence And Machine Learning-LBE Press Publishing (2020) D-01: Sensor Capture the self-driving car that involve ...

空空如也

空空如也

1 2 3 4 5 ... 20
收藏数 5,154
精华内容 2,061
关键字:

carsused