1 Introduction to Self-Driving Cars 课程习题编程解答及笔记

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 Vehicle Model
  • WEEK 5
    • Module 5 Graded Quiz
  • Module 6: Graded Quiz
  • Final Project: Self-Driving Vehicle Control

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

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

希望这以下笔记,和解题答案思路等能给大家领个头,也一起共同学习进步,毕竟国内似乎还没有专门这么针对无人驾驶的课程专项。(为多伦多大学打call)

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.
59 X
56 X
62 X
解释:Incorrect, please review Lesson 2: Industry Methods for Safety Assurance and Testing. The numbers are approximate and may be hard to compute if not using the same assumptions as we used, so refer to the video to find the correct answer.

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
1.33 X

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,先发出来给大家看前面的测试吧~

你可能感兴趣的:(Self-Driving,无人驾驶)