• Stars
    star
    148
  • Rank 248,498 (Top 5 %)
  • Language
    Python
  • Created about 6 years ago
  • Updated almost 6 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Udacity Self-Driving Car Engineer Nanodegree: Quintic Polynomial Solver. & Paper 'Optimal Trajectory Generation for Dynamic Street Scenarios in a Frenet Frame'

Robotics-Path-Planning-04-Quintic-Polynomial-Solver

Udacity Self-Driving Car Engineer Nanodegree: Quintic Polynomial Solver. & Paper 'Optimal Trajectory Generation for Dynamic Street Scenarios in a Frenet Frame'

Implement the Quintic Polynomial Solver

Calculate the Jerk Minimizing Trajectory that connects the initial state to the final state in time T.

Our problem is to find a function s of t that minimize the total jerk.

We find that all the time derivatives of s are further six and more have to be zero in order for s to be jerk minimize.

All minimum jerk trajectories can be repersented as a fifth order polynomial like that.

INPUTS:

  • start: The vehicles start location given as a length three array corresponding to initial values of [s, s_dot, s_double_dot].
  • end: The desired end state for vehicle. Like "start" this is a length three array.
  • T: The duration, in seconds, over which this maneuver should occur.

OUTPUT:

  • an array of length 6, each value corresponding to a coefficent in the polynomial s(t) = a_0 + a_1 * t + a_2 * t ** 2 + a_3 * t ** 3 + a_4 * t ** 4 + a_5 * t ** 5

The equations for position, velocity, and acceleration are given by:

PS: We are solving a system of equations: matrices will be helpful! The Eigen library used from Sensor Fusion is included.

vector<double> JMT(vector< double> start, vector <double> end, double T)
{
    MatrixXd A = MatrixXd(3, 3);
	A << T*T*T, T*T*T*T, T*T*T*T*T,
			    3*T*T, 4*T*T*T,5*T*T*T*T,
			    6*T, 12*T*T, 20*T*T*T;
		
	MatrixXd B = MatrixXd(3,1);	    
	B << end[0]-(start[0]+start[1]*T+.5*start[2]*T*T),
			    end[1]-(start[1]+start[2]*T),
			    end[2]-start[2];
			    
	MatrixXd Ai = A.inverse();
	MatrixXd C = Ai*B;
	
	vector <double> result = {start[0], start[1], .5*start[2]};
	for(int i = 0; i < C.size(); i++)
	{
	    result.push_back(C.data()[i]);
	}
    return result;
}

Paper 'Optimal Trajectory Generation for Dynamic Street Scenarios in a Frene´t Frame'

  • The paper discusses some topics like:

    • Cost Functions.
    • Differences between high speed and low speed trajectory generation.
    • Implementation of specific maneuvers relevant to highway driving like following, merging, and velocity keeping.
    • How to combining lateral and longitudinal trajectories.
    • A derivation of the transformation from Frenet coordinates to global coordinates (in the appendix).
  • Abstract

    • semi-reactive trajectory generation method
    • be tightly integrated into the behavioral layer
    • realize long-term objectives (such as velocity keeping, merging, following, stopping)
    • combine with a reactive collision avoidance
    • Frenét-Frame
  • Related work

    • [11], [19], [2], [4]: fail to model the inherent unpredictability of other traffic, and the resulting uncertainty, given that they rely on precise prediction of other traffic participant’s motions over a long time period.
    • [16], [1], [7]: The trajectories are represented parametrically. A finite set of trajectories is computed, typically by forward integration of the differential equations that describe vehicle dynamics.While this reduces the solution space and allows for fast planning, it may introduce suboptimality.
    • [9]: a tree of trajectories is sampled by simulating the closed loop system using the rapidly exploring random tree algorithm [10].
    • [17]: in a similar spirit to our method but only considers the free problem that is not constrained by obstacle.
    • We propose a local method, which is capable of realizing high-level decisions made by an upstream, behavioral layer (long-term objectives) and also performs (reactive) emergency obstacle avoidance in unexpected critical situations.
  • Optimal control approach

    • system inputs or curvature to be polynomials.
    • cost functional is compliance with Bellman’s principle of optimality.
    • making the best compromise between the jerk and the time.
    • not limited to a certain function class, the problem becomes highly complicated and can be solved numerically at best.

  • Motion planning in the Frenet Frame

Total jerk:

Cost function:

A quintic polynomial through the same points and the same time interval will always lead to a smaller cost.

  • Generation of lateral movement
    • High speed trajectories
      • at high speed, d(t) and s(t) can be chosen independently.
      • cost function: g(T)=T, h(d1)=d1^2.
      • process:
        1. calculate its coefficients and T minimizing.
        2. check it against collision.
        3. if not, check and find the second best and collision-free trajectory.
    • Low speed trajectories
      • at low speed, we must consider the non-holonomic property (invalid curvatures) of the car.
      • cost function: see in the paper.
  • Generation of longitudianal movement
    • Following
      • safe distance (constant time gap law)
    • Merging
    • Stopping
    • Velocity keeping
  • Combining lateral and longitudinal trajectories
    • check aginst outsized acceleration values first.
    • derive higher order infomation (heading, curvature, velocity, acceleration)
    • calculate the conjoint cost: Cost_total = w_lat * Cost_lat + w_lon * Cost_lon
    • for collison dectection: we add a certain safety distance to the size of our car on each side.

More Repositories

1

Robotics-Cooperative-Path-Planning-03-Hybrid-A-Star-Trajectory-Planning

Hybrid A Star Trajectory Planning in multi-vehicle cooperative planning in narrow free space.
Python
131
star
2

Notes-of-MPC-in-Self-Driving-Car

读书笔记《无人驾驶车辆模型预测控制》- 龚建伟
MATLAB
39
star
3

Udaicty-CarND-State-Estimation-02-Lidar-and-Radar-Fusion-with-EKF

Udacity Self-Driving Car Engineer Nanodegree - Term 2 - Lesson 6 - Lidar and Radar Fusion with EKF in C++.
C++
29
star
4

Robotics-Path-Planning-03-Hybrid-A-Star

Udacity Self-Driving Car Engineer Nanodegree: Trajectroy Generation
C++
27
star
5

Udacity-Self-Driving-Car-Engineer-Nanodegree

Contents of repositories in Udacity-Self-Driving-Car-Engineer-Nanodegree
19
star
6

Robotics-Cooperative-Path-Planning-02-Movement-Sequence-Planning

Multi-Vehicle Movement Sequence Planning algorithm on topological map.
Python
11
star
7

Robotics-Prediction-02-Pedestrian-Behavior-Prediction-based-on-Motion-Patterns

Paper: Pedestrian Behavior Prediction based on Motion Patt erns for Vehicle-to-Pedestrian Collision Avoidance
6
star
8

Algorithm-JiuZhang-Basic-03-Dynamic-Programming

九章算法基础班 - 动态规划
5
star
9

Robotics-Prediction-01-Naive-Bayes

Udacity Self-Driving Car Engineer Nanodegree: Prediction.
C++
4
star
10

Notes-of-Labuladong-Fucking-Algorithm

读书笔记《labuladong的算法小抄》- 付东来
3
star
11

CarND-17-Motion-Planning-PID-Control

Udacity Self-Driving Car Engineer Nanodegree: PID Control.
Python
3
star
12

AI-Reinforcement-Learning-06-Planning-Dynamic-Programming

Lecture 3: Planning by Dynamic Programming by David Silver
3
star
13

Math-01-Convex-Optimization

Notes for USTC course 'Convex Optimization' by 凌青
3
star
14

Udacity-CarND-State-Estimation-01-Kalman-Filters

Udacity Self-Driving Car Engineer Nanodegree: Kalman Filters
C++
2
star
15

CarND-Project-01-Finding-Lane-Lines-on-the-Road

Udacity Self-Driving Car Engineer Nanodegree: Project 1 - Finding Lane Lines on the Road
Jupyter Notebook
2
star
16

Robotics-Control-01-PID-Control

Udacity Self-Driving Car Engineer Nanodegree: PID Control
Python
2
star
17

AI-Reinforcement-Learning-05-Markov-Decision-Processes

Lecture 2: Markov Decision Processes by David Silver
2
star
18

AI-Reinforcement-Learning-08-Model-Free-Control

Lecture 5: Model-Free Control by David Silver
2
star
19

AI-Reinforcement-Learning-07-Model-Free-Prediction

Lecture 4: Model-Free Prediction by David Silver
2
star
20

Robotics-Sensor-Fusion-03-UKF-Unscented-Kalman-Filter

Udacity Self-Driving Car Engineer Nanodegree: Unscented Kalman Filter
C++
2
star
21

AI-Reinforcement-Learning-04-RL-Problem

Lecture 1: Introduction to Reinforcement Learning by David Silver
2
star
22

Robotics-Path-Planning-02-Behavior-Planning

Udacity Self-Driving Car Engineer Nanodegree: Behavior Planning.
C++
2
star
23

AI-Reinforcement-Learning-09-Value-Function-Approximation

Lecture 6: Value Function Approximation by David Silver
2
star
24

CarND-01-Computer-Vision-Canny-to-Detect-Lane-Lines

Udacity Self-Driving Car Engineer Nanodegree: Computer Vision Fundamentals.
Python
2
star
25

Robotics-ROS-02-Writing-ROS-Node

Udacity Self-Driving Car Engineer Nanodegree: Writing ROS Node
1
star
26

CarND-09-Path-Planning-Two-Dimensional-Robot-Motion-and-Trigonometry

Udacity Self-Driving Car Engineer Nanodegree: Two Dimensional Robot Motion and Trigonometry
Jupyter Notebook
1
star
27

CarND-06-Computer-Vision-CNN-Basic

Udacity Self-Driving Car Engineer Nanodegree: Convolutional Neural Networks (CNN)
Python
1
star
28

LeetCode-01-Linked-List

Problems in tag linked list on LeetCode
C++
1
star
29

Others-01-PADI-Open-Water-Diver

Notes for PADI open water diver
1
star
30

CarND-03-Neural-Network-MiniFlow

Udacity Self-Driving Car Engineer Nanodegree: MiniFlow.
Python
1
star
31

Robotics-ROS-01-Introduction-to-ROS

Udacity Self-Driving Car Engineer Nanodegree: Introduction to ROS & Packages & Catkin workspace
1
star
32

Robotics-ROS-03-Communication

ROS course on Shenlanxueyuan.com
CMake
1
star
33

Cpp-Primer-5th

Contents of repositories in C++ Primer 5th.
1
star
34

CarND-14-Motion-Model

Udacity Self-Driving Car Engineer Nanodegree: Motion Model.
1
star
35

CarND-08-Deep-Learning-Transfer-Learning

Udacity Self-Driving Car Engineer Nanodegree: Transfer Learning
1
star
36

Algorithm-JiuZhang-Basic-02-Binary-Tree-and-Divide-Conquer

九章算法基础班 - 二叉树和分治法
C++
1
star
37

CarND-Project-10-MPC-Model-Predictive-Control

Udacity Self-Driving Car Engineer Nanodegree: Project 10 - Model Predictive Control
C++
1
star
38

CarND-05-Deep-Learning-Deep-Neural-Networks-Basic

Udacity Self-Driving Car Engineer Nanodegree: Deep Neural Network
Python
1
star
39

CarND-07-Deep-Learning-Keras-Basic

Udacity Self-Driving Car Engineer Nanodegree: Keras
Python
1
star
40

LeetCode-02-String

Problems in tag string on LeetCode
C++
1
star
41

Robotics-Path-Planning-01-Intro-to-Search

Udacity Self-Driving Car Engineer Nanodegree: Search.
Python
1
star
42

AI-Computer-Vision-03-LeNet

Udacity Self-Driving Car Engineer Nanodegree: LeNet for Traffic Signs
Jupyter Notebook
1
star
43

AI-Reinforcement-Learning-03-Multi-armed-Bandits

《Reinforcement Learning: An Introduction》 Chapter 2.2 Multi-armed Bandits
1
star
44

Robotics-ROS-04-Coordinate-Transform

ROS course on Shenlanxueyuan.com
CMake
1
star
45

Robotics-ROS-05-TF-between-Sensor-and-Robot

ROS Tutorial: Setting up your robot using tf
C++
1
star
46

CarND-04-Deep-Learning-TensorFlow-Basic

Udacity Self-Driving Car Engineer Nanodegree: Introduction to TensorFlow
Python
1
star
47

Notes-of-CPlusPlusPrimer

Solutions for Chapter 6. Functions exercises of C++ Primer 5th.
C++
1
star
48

CarND-13-Localization-Bayes-Markov-Localization

Udacity Self-Driving Car Engineer Nanodegree: Markov-Localization.
C++
1
star
49

Algorithm-JiuZhang-Basic-05-Linked-List

九章算法基础班 - 链表
C++
1
star
50

Notes-Object-Oriented-Programming-HouJie

学习笔记《C++面向对象高级编程》- 侯捷
1
star
51

Algorithm-JiuZhang-Basic-01-Binary-Search-and-Sorted-Array

九章算法基础班 - 二分查找
C++
1
star
52

AI-Reinforcement-Learning-02-Temporal-Difference-Learning

Reinforcement Learning Course Offered at Georgia Tech as CS 8803 on Udacity
1
star
53

AI-Reinforcement-Learning-01-Basics

Reinforcement Learning Course Offered at Georgia Tech as CS 8803 on Udacity
1
star
54

CarND-Project-06-Bicycle-Tracker-with-Extended-Kalman-Filter

Udacity Self-Driving Car Engineer Nanodegree: Project 6 - Extended Kalman Filter
C++
1
star