C++ vs. Python for Automotive Software

This afternoon I posted a long response to a question about how we will use C++ vs. Python in the Udacity Self-Driving Car Nanodegree Program, and how automotive engineers use those languages on the job.

You can read my full response, but here’s the part where I focus on how automotive engineers write software on the job:

Autonomous vehicle engineers on the job tend to use a variety of languages, depending on their team, their facility with different languages, the APIs their tools expose, and performance requirements.

C++ is a compiled, high-performance language, so most code that actually runs on the vehicle tends to be C++.

That said, many engineers spend most of their time prototyping algorithms in Python, Matlab, or even Java or other languages. Other engineers spend pretty much all of their time writing production code in C / C++.

Machine learning engineers often spend a lot of time in Python, because libraries like TensorFlow rely on Python for their primary APIs. TensorFlow does a lot of the heavy lifting in terms of compiling networks for faster performance.

Addendum: Since I have been asked several times recently, my favorite C++ book is Modern C++ Programming with Test-Driven Development, by Jeff Langr. Unfortunately, Udacity does not yet have a C++ course. There appear to be C++ courses on Coursera and edX but I have not reviewed them yet.

Making Motorcycling Safer

From the Department of Progress, Automotive News has a thinkpiece up about how self-driving cars will make motorcycling safer.

The improvement apparently will come largely from left turns:

This year, about 1,000 riders in the U.S. will lose their lives to the left turns of others. Cars traveling in the same direction as the motorcycle often don’t notice the bike overtaking on the left. Cars making a turn while coming from the opposite direction either fail to see the oncoming bike, or misjudge its speed.

And apparently this is a good time to buy Harley-Davidson stock:

Once every aspiring biker realizes that the driver next to him isn’t an existential threat, sales will climb in some places. Xavier Mosquet, a senior partner at Boston Consulting Group, said the bike boost will be most pronounced in markets such as the U.S., where people ride for fun, and in China and India, where many choose motorbikes because they are relatively inexpensive transportation.

Conversely, in such places as Europe. where motorcycles are often the best way to avoid traffic, self-driving cars may actually dent sales, according to Mosquet. If all goes as planned, there will be fewer tie-ups or accidents, less rubbernecking, and thus less to be gained by jumping on a bike and splitting lanes of standstill traffic.

Self-driving motorcycles, however, are still quite a ways off. Here’s a visual explanation of why.

In fairness, if I’ve heard Sebastian Thrun tell the story right, the head of that team was Anthony Levandowski, who went on to found Otto and now runs Uber’s self-driving car program. So he’s done well.

The Race Continues

The self-driving car race continues, with new entrants signaling that California remains the location of choice (or at least “a” location of choice) for autonomous vehicle development.

Wheego, an Atlanta-based assembler of low-speed, electric vehicles, has applied for a testing permit.

As has Valeo, a large French automotive supplier.

The encouraging sign here is that both Wheego and Valeo are out of the mold of previous California autonomous vehicle licensees. Whereas previous licensees have mostly been OEMs (Ford, Mercedes), tech companies (Google, Apple), or startups (Otto, Cruise, Drive.ai), these entrants are more esoteric.

Valeo, in particular, represents wider automotive industry coming to Silicon Valley, which is terrific.

Google Hits Two Million Miles

Google’s Self-Driving Cars just hit two million miles of real-world, public road driving experience.

Dmitri Dolgov, Google’s Head of Self-Driving Car Technology, explains how one of the major challenges now is to pass what I might call the “automotive Turing test”:

Over the last year, we’ve learned that being a good driver is more than just knowing how to safely navigate around people, but also knowing how to interact with them.

In a delicate social dance, people signal their intentions in a number of ways. For example, merging into traffic during rush hour is an exercise in negotiation: I’d like to cut in. May I cut in? If I speed up a little and move into the lane, will you slow down and leave me room, or will you speed up? So much of driving relies on these silent conversations conducted via gentle nudge-and-response. Because we’ve observed or interacted with hundreds of millions of vehicles, pedestrians and cyclists, our software is much better at reliably predicting the trajectory, speed, and intention of other road users. Our cars can often mimic these social behaviors and communicate our intentions to other drivers, while reading many cues that tell us if we’re able to pass, cut in or merge.

Didi is Hiring

Our partner Didi Chuxing is the largest ride-sharing service in China. And it’s looking to hire self-driving car engineers!

Didi founder and CEO Cheng Wei said he is hunting for data scientists in Silicon Valley to develop a self-driving car. Didi Chuxing bought Uber China in a $35 billion deal over the summer.

Cheng added that he’s also been in talks with Gansha Wu, the former director of Intel Labs who also founded UiSee Technology, a Beijing-based self-driving car company.

Didi is a terrific partner and we are lucky to have their support.

Term 1: In-Depth on Udacity’s Self-Driving Car Curriculum

Update: Udacity has a new self-driving car curriculum! The post below is now out-of-date, but you can see the new syllabus here.

Last night we offered acceptances to thousands of students who are excited to join Udacity’s Self-Driving Car Nanodegree Program!

We are working hard to make this the world’s best training program for self-driving car engineers. The entire curriculum will consist of three terms over nine months. Here’s what in the program:

Term 1

Introduction

  1. Meet the instructors — Sebastian Thrun, Ryan Keenan, and myself. Learn about the systems that comprise a self-driving car, and the structure of the program.
  2. Project: Detect Lane Lines
    Detect highway lane lines from a video stream. Use OpenCV image analysis techniques to identify lines, including Hough transforms and Canny edge detection.

Deep Learning

  1. Machine Learning: Review fundamentals of machine learning, including regression and classification.
  2. Neural Networks: Learn about perceptrons, activation functions, and basic neural networks. Implement your own neural network in Python.
  3. Logistic Classifier: Study how to train a logistic classifier, using machine learning. Implement a logistic classifier in TensorFlow.
  4. Optimization: Investigate techniques for optimizing classifier performance, including validation and test sets, gradient descent, momentum, and learning rates.
  5. Rectified Linear Units: Evaluate activation functions and how they affect performance.
  6. Regularization: Learn techniques, including dropout, to avoid overfitting a network to the training data.
  7. Convolutional Neural Networks: Study the building blocks of convolutional neural networks, including filters, stride, and pooling.
  8. Project: Traffic Sign Classification
    Implement and train a convolutional neural network to classify traffic signs. Use validation sets, pooling, and dropout to choose a network architecture and improve performance.
  9. Keras: Build a multi-layer convolutional network in Keras. Compare the simplicity of Keras to the flexibility of TensorFlow.
  10. Transfer Learning: Finetune pre-trained networks to solve your own problems. Study cannonical networks such as AlexNet, VGG, GoogLeNet, and ResNet.
  11. Project: Behavioral Cloning
    Architect and train a deep neural network to drive a car in a simulator. Collect your own training data and use it to clone your own driving behavior on a test track.

Computer Vision

  1. Cameras: Learn the physics of cameras, and how to calibrate, undistort, and transform image perspectives.
  2. Lane Finding: Study advanced techniques for lane detection with curved roads, adverse weather, and varied lighting.
  3. Project: Advanced Lane Detection
    Detect lane lines in a variety of conditions, including changing road surfaces, curved roads, and variable lighting. Use OpenCV to implement camera calibration and transforms, as well as filters, polynomial fits, and splines.
  4. Support Vector Machines: Implement support vector machines and apply them to image classification.
  5. Decision Trees: Implement decision trees and apply them to image classification.
  6. Histogram of Oriented Gradients: Implement histogram of oriented gradients and apply it to image classification.
  7. Deep Neural Networks: Compare the classification performance of support vector machines, decision trees, histogram of oriented gradients, and deep neural networks.
  8. Vehicle Tracking: Review how to apply image classification techniques to vehicle tracking, along with basic filters to integrate vehicle position over time.
  9. Project: Vehicle Tracking
    Track vehicles in camera images using image classifiers such as SVMs, decision trees, HOG, and DNNs. Apply filters to fuse position data.

Term 2

Sensor Fusion

Our terms are broken out into modules, which are in turn comprised of a series of focused lessons. This Sensor Fusion module is built with our partners at Mercedes-Benz. The team at Mercedes-Benz is amazing. They are world-class automotive engineers applying autonomous vehicle techniques to some of the finest vehicles in the world. They are also Udacity hiring partners, which means the curriculum we’re developing together is expressly designed to nurture and advance the kind of talent they would like to hire!

Lidar Point Cloud

Below please find descriptions of each of the lessons that together comprise our Sensor Fusion module:

  1. Sensors
    The first lesson of the Sensor Fusion Module covers the physics of two of the most import sensors on an autonomous vehicle — radar and lidar.
  2. Kalman Filters
    Kalman filters are the key mathematical tool for fusing together data. Implement these filters in Python to combine measurements from a single sensor over time.
  3. C++ Primer
    Review the key C++ concepts for implementing the Term 2 projects.
  4. Project: Extended Kalman Filters in C++
    Extended Kalman filters are used by autonomous vehicle engineers to combine measurements from multiple sensors into a non-linear model. Building an EKF is an impressive skill to show an employer.
  5. Unscented Kalman Filter
    The Unscented Kalman filter is a mathematically-sophisticated approach for combining sensor data. The UKF performs better than the EKF in many situations. This is the type of project sensor fusion engineers have to build for real self-driving cars.
  6. Project: Pedestrian Tracking
    Fuse noisy lidar and radar data together to track a pedestrian.

Localization

This module is also built with our partners at Mercedes-Benz, who employ cutting-edge localization techniques in their own autonomous vehicles. Together we show students how to implement and use foundational algorithms that every localization engineer needs to know.

Particle Filter

Here are the lessons in our Localization module:

  1. Motion
    Study how motion and probability affect your belief about where you are in the world.
  2. Markov Localization
    Use a Bayesian filter to localize the vehicle in a simplified environment.
  3. Egomotion
    Learn basic models for vehicle movements, including the bicycle model. Estimate the position of the car over time given different sensor data.
  4. Particle Filter
    Use a probabilistic sampling technique known as a particle filter to localize the vehicle in a complex environment.
  5. High-Performance Particle Filter
    Implement a particle filter in C++.
  6. Project: Kidnapped Vehicle
    Implement a particle filter to take real-world data and localize a lost vehicle.

Control

This module is built with our partners at Uber Advanced Technologies Group. Uber is one of the fastest-moving companies in the autonomous vehicle space. They are already testing their self-driving cars in multiple locations in the US, and they’re excited to introduce students to the core control algorithms that autonomous vehicles use. Uber ATG is also a Udacity hiring partner, so pay attention to their lessons if you want to work there!


Here are the lessons:

  1. Control
    Learn how control systems actuate a vehicle to move it on a path.
  2. PID Control
    Implement the classic closed-loop controller — a proportional-integral-derivative control system.
  3. Linear Quadratic Regulator
    Implement a more sophisticated control algorithm for stabilizing the vehicle in a noisy environment.
  4. Project: Lane-Keeping
    Implement a controller to keep a simulated vehicle in its lane. For an extra challenge, use computer vision techniques to identify the lane lines and estimate the cross-track error.

Term 3

Path Planning

Elective

Systems


Term 2 and Term 3 are under construction and we’ll share more details on those as we finalize the curriculum and projects.

[Update: Term 2 and Term 3 are live!]

All of this, including Term 1, is subject to change as we update the curriculum over time, because part of building a great course is taking feedback and making improvements!

If you’ve been accepted into the course, congratulations! We are excited to teach you.

If we suggested you brush up on a few topics and take a self-assessment before joining the course, please do! We are excited to teach you and want to make sure you have a great experience.

And if you haven’t yet applied, please do! We are taking applications for the 2017 cohorts and would love to have you in the class.

Self-Driving Car Student Applications

We had over 11,000 students apply to join the Udacity Self-Driving Car Nanodegree program, which launches its first cohort this month!

The quality of the students has been astounding. It’s both incredibly exciting and, honestly, intimidating to be teaching students this talented and accomplished. Many of students who applied already work on autonomous vehicles, and want to take the course to make sure they’re at the top of their game. Others are top engineers at companies like Google and Facebook, and still others are stars at universities (including professors!) in the US and abroad.

And many are just good engineers who are excited about self-driving cars, kind of like me not very long ago.

Thank you to everyone!

Dhruv has spent all of his waking hours this past week going through each application and organizing students into cohorts.

Udacity’s mission is to democratize education, so we will be trying to teach as many people as possible.

We’ll start small, with an initial cohort of 500 students, to give us a chance to scale up the program and iron out any wrinkles.

But we plan to be teaching thousands of students about self-driving cars by the end of the year.

See you in class!

(By the way, if you’re interested but haven’t applied yet, you can still do that! We’re taking applications now for our 2017 cohorts, so please apply!)

California Allows Unmanned Car Testing

Only at designated sites in Contra Costa County, but still:

…almost four years to the day since driverless trials on public streets were first approved, a new bill has been signed off by Governor Jerry Brown that permits autonomous car tests without a human passenger overseeing proceedings.

Rather than applying throughout the Golden State, the bill is specific to a pilot project headed by the Contra Costa Transportation Authority. At San Ramon’s Bishop Ranch business park, EasyMile’s 12-seater shuttles will ferry workers around the site, which will include travelling on some public roads. The approval also covers GoMentum Station: A ghost town within the Concord Naval Weapons Station where Honda has been testing its driverless car technologies. Recently, Uber-owned Otto also signed up to test self-driving trucks on the site.

I’m actually a little surprised this wasn’t already legal. I kind of thought you could do whatever you want on your own land.

Another article I read said that disabled-persons groups were key in getting the bill passed.