The best way to learn how self-driving cars work is building one.

The best way to learn how self-driving cars work is building one.

A self-driving car or an autonomous vehicle is a robotic vehicle that is designed to travel between destinations without a human operator. To qualify as fully autonomous, a vehicle must be able to navigate without human intervention to a predetermined destination over roads that have not been adapted for its use.

Companies developing and/or testing driverless cars include Tesla, Audi, BMW, Ford, Google with Waymo, General Motors, Volkswagen Volvo and others.

How does a car work?

  • The “driver” sets a destination. The car’s software calculates a route and starts the car on its way.
  • A rotating, roof-mounted LIDAR (Light Detection and Ranging - a technology similar to radar) sensor monitors around the car and creates a dynamic map of the car’s current environment.
  • A side sensor monitors sideways movement to detect the car’s position relative to the map.
  • Radar systems in the front and rear bumpers calculate distances to obstacles.
  • Artificial intelligence (AI) software in the car is connected to all the sensors and has input from video cameras in the car.
  • The AI simulates human perceptual and decision-making processes and controls actions in driver-control systems such as steering and brakes.
  • An override function is available to allow a human to take control of the vehicle.

Last year I started to learn self-driving cars technology and how to apply Machine Learning and Deep Neural Networks on it. To achieve this, I decided to take some courses, read everything I can about it and achieve some essential technology skills regarding autonomous vehicles.

I love to share anything I learned from my experience, and I do it every time I achieve some new exciting and relevant knowledge. In this period, I am massively improving my programming skills while going deep on Self-driving car’s technology.

Today I am sharing how I am building my first self-driving 4WD robot while enhancing my learnings of robotics and development of Autonomous vehicles technology. I will not go in-depth on technical details here, but I will share a panoramic of some basic concepts and technics I used to build my fully autonomous smart 4WD robot!

My goal with this project is creating my first self-driving robot capable of reacting in some way to its surrounding environment, and take autonomous decisions or actions to achieve a specific task putting in practice the skills I've been developing here.

The self-driving car that I decided to name as SDC01 consists the following components:

1. Structure / Chassis

The structure consists of physical components. The SDC01 has some physical components that move in some way to perform the task. In this case, the chassis and wheels are the structure of the car.

2. Actuators / Motors

An “actuator” is a device that converts energy (in our case it is electrical) into physical motion, producing either rotational or linear motion. In this case, the actuator is a DC gear motor combined with a gearbox that works to decrease the motor’s speed and increase the torque. On SDC01, I am using four DC motors having speed 3000 rpm and torque 0.002 Nm each. Adding the gear to it with a ratio 1:48, the speed is reduced by a factor 48 ( 3000/44 = 68 rpm) and the torque increased by a factor of 48 (0.002 x 48 = 0.096 Nm)

3. Controller

Someone said that Power without control is nothing, and so we need a controller to move the SDC01 from one place to another. The controller is a computing device capable of executing a program and is responsible for all computations, decision making, and communications. In our case, I will be using an Arduino UNO as a Controller who takes input ( sensors, Remote, Bluetooth, Wifi, etc.), process it and then gives a command to the actuator (motor) to perform the desired task (go ahead, forward, turn left, turn right, stop, etc).

4. Inputs / Sensors

Robots (Yes, SDC01 is a robot) are not limited to just sight, sound, touch, smell and taste like we are. Robots can use different sensors, devices that detects and responds to some input from the physical environment (for example light, heat, motion, moisture, pressure, and others) to interact with the external world.

5. Power Supply

My self-driving car needs a power source to drive the actuators (its four motors) and the controller. Most of the robots are powered by a battery. When we talk about batteries, there are many options like Alkaline Battery (Non-Rechargeable), NiMh or NiCd Battery (Rechargeable), Li-Ion Battery and LiPo Battery. My advice is to choose a rechargeable and sufficient capacity battery. I will be using 2x2600mAh LiIon Battery (Model 18650).

Assembling the SDC01

You know, Remote controlled cars are fun, sure, but self-driving robotic vehicles can be even more fun.

On the internet, you can find a lot of smart car kits designed for beginners to learn Arduino programming and get hands-on experience robot design and assembly.

But if you prefer you can easily buy most of the components you will need from an electronics store and put it together yourself.

I choose for this experiment a kit that contains a Motor Driver Module, Ultrasonic Sensor module, Tracking module, Infrared Remote Control and the Bluetooth and Wifi modules other than all the wires, screws and other kinds of stuff to build the structure of the car.

With these modules, I can program my smart car to work in multiple modes such as auto-go, infrared control, obstacle avoidance and line tracking.

The first step, of course, is to assemble the car and having the Arduino, voltage meter, motor control module, motors, batteries, chassis and wire connections between these parts all functioning well, being sure that the bridge and motors are wired up correctly.

Fortunately, after spending some nights assembling the hardware I confirmed that everything was working correctly. Now it is time to make this little thing run!

Power is nothing without control

As I wrote above, all this technology must be controlled. So to give to SDC01 a thinking brain it is necessary to do some programming. The Arduino UNO board is the brain of the car, as it runs the software that controls all the other parts.

The programming language that the Arduino platform uses is but difficult to learn C++. Arduino calls these programs Sketches. Then a utility called compiler reads the sketch and converts it to machine instructions that the Arduino understands.

Starting from the basic Sketches available on Github I was able to perform the initial tests of the whole system. and start to develop some customized sketches to process all data from the several sensors and to control the SDC01’s behavior.

Driving the motors

The Arduino board cannot directly control my four motors so it's necessary to make them selectively run forward or backward, which requires swapping power and ground inputs into the four available motors. I am using a specialized circuit ( L298N) called an H-Bridge that can do this, and there are several implementations of this circuit readily available for the Arduino platform, so I do not need the reinvent the wheel and build one from zero.

Ultrasonic autonomy

To give the first level of autonomy to my smart car, I am using a distance sensor that sends an ultrasonic signal forward and then waits to receive a bounced signal. Depending on how long the signal takes to bounce back the approximated distance to an obstacle can be calculated. I will use this little device to prevent SDC01 from hitting walls or other obstacles in its way.

I mounted the distance sensor on a 180 degrees left-right servo motor and a buzzer. With this ultrasonic module, SDC01 can "see" obstacle through the ultrasonic sensor and measure the distance. If the distance is less than my predefined threshold value, the buzzer will beep, and the car will turn around from the obstacle automatically.

This is how my basic obstacle-avoidance system works: If no obstacle is detected, the car keeps going forward.  When any obstacles are identified, it will go backward first; then the ultrasonic module turns from right to left to detect a surrounding obstacle. If any obstacle is found on the left, the car will turn right and vice versa. If both right and left side has obstacles, then SDC01 will go backward. Here’s a video of the bot in action.

Keeping it on the right track

Other than the ultrasonic sensor, my self-driving car can read data from 5 frontal black/white tracking sensors and automatically guide itself to move along a black track line in the ground.

It will be very useful my future projects when SDC01 will be able to follow a predefined path. I am still working on it, to improve and enhance the track detection.

Conclusion

So that is it! There is so much more that can be done with my first project self-driving vehicle. Much work still must be done in order to allow my SDC01 to behave correctly to several events and very soon I will be able to add more complex behavior, for example, I am planning to alternate between turning left and right based on obstacles, or choose randomly; sound a buzzer if it gets close to something; just turn, instead of backing up like it currently does; 

I will be extending SDC01 capabilities by adding the following features:

  • Enhanced Line following
  • Low-light activated headlights (using light sensors and LEDs)
  • Brake lights
  • Speed measuring and telemetry
  • Rear ultrasonic sensors to avoid reversing into objects or falling off edges
  • Solar Panel for recharge batteries while running the system.
  • Environment Sensors (light, air quality, temperature, barometric pressure and gas detection)
  • Connect to the Watson IoT Platform.

However, most importantly, very soon I will be adding a Raspberry Pi and a camera on this chassis to use Machine Learning to detect objects and tracks, training models that can predict for example where is the line given an image as input from the camera and other.

I will be using Deep Neural Network because that was the method I want to be every day more familiar with and it will be used mostly during my Udacity Nano-degree.

I am enjoying a lot developing this robot and wanted to share with you this experience. Maybe it can inspire other people to discover Self-Driving car’s technology by what I am doing here.

I hope you enjoyed this article, and remember, sharing is caring! So, share it!

Jair Ribeiro

Muhammed Abdul Hayy

Experienced Data Engineer and Data Scientist | python | Hadoop| Spark| AWS | ELK | SQL | MySQL | Docker | ML .. | [email protected]

12 个月

?? ??

回复

要查看或添加评论,请登录

Jair Ribeiro的更多文章

社区洞察

其他会员也浏览了