Chase Car

Chase Car

Our goal is to make the self-driving lab car to chase a remote car which is controlled by us.

Hardware:

The lab car is controlled by a NodeMCU component, which allows us to communicate with the computer via WI-FI. The car is made of a plastic board and uses 5V battery. The lab car chases the remote car using the Opti-Track system.

Code:

We use Arduino in-order to execute the movement commands. Here is the link for the Arduino code.
In order to control the system: receiving the coordinates of the cars and control the lab car’s movement – we use C++ with Visual Studio 2017. Here is a link for the C++ code.

Goals:

1. Chase a remote car as possible as we can using a lab car.
2. Due to the working surface which is bounded square, we should consider a long-term algorithm.

Description:

In order to have to project working, we build the cars in C++, receiving the coordinates of the cars from Motive – into our code, and send the proper commands to the Arduino which will execute these commands.

Building the cars and working with the Arduino:

We used the car which was developed by Yair Marom, and we changed it according to our needs. The car is built from a plastic board and two DC motors, which are connected to two big wheels. Another small wheel is placed at the front of the car, this wheel is free to rotate 360 degrees and it helps the car to rotate right and left. The wheels are controlled by a DRV-8833 controller:

And here is a scheme of the component and the connections to it:

We chose to control the lab car by a NodeMCU component instead of an Arduino board, because the communication in real time with the NodeMCU is more comfortable and it is possible through Wifi. A nodeMCU:

And here is a scheme of the component:

The NodeMCU is connected to a battery (5V) and it provides the voltage to the DRV8833.

This is the lab car:

Bottom view:

The lab car moves according to the commands which are sent through the WI-FI from the computer. The Arduino code basically stands for executing basic commands: moving forward, moving backward, stopping the car, turn right, turn left. The algorithm in C++ is the one to make a sequence of commands which the arduino executes. The commands are sent through WiFi using an http browser, then are parsed so the Arduino will successfully execute the commands.

Writing the C++ interface and main code:

In order to make the project works, we wrote a C++ code which manages the movement of the lab car. The code is a comfortable interface for sending the commands to the cars. We also use the Opti-Track system, using a set of special cameras which follow any marked objects in real time.
For this, we put markers onto our 2 cars so we could follow each. The software we used to see the cameras output such coordinates is Motive (1.8.0). Each car of the two had 3 markers on it so we could mark the cars as rigid bodies in the Motive, and then we could receive a real-time information of the cars.

Here we can see the cars in the Motive (yellow and red):

Here we can see an example of a real-time info for the remote car and the lab car:

To receive both cars coordinates in real-time from the Motive tracking system, we used a library called “NatNet” (2.10) so we could get the coordinates from the Opti-Track.
We used PacketClient sample which helped us to get the coordinates and the angles of the cars.
After we successfully get the coordinates of the cars, the next step was to write an algorithm which will lead the lab car to chase after the remote car.
We designed a long-term algorithm due to the fact that the working surface is a bounded square.
In this case, it is important that the lab car stays in the square because it will be untracked for the Opti-Track as soon as it moves out of the bounded way too much. So, for example – when the lab car is way too close to the borders, we wanted to first fix its angle and then keep tracking the remote car.
Basically, the algorithm will send a reasonable sequence of commands to the Arduino, so the algorithm works good. Thus, the next step is to write a simple code which enables to send commands to be executed on the lab car. We used a simple method called “move” which receives the desired direction. Using move(FORWARD) we could make the lab car to move straight forward. For this, we burnt the proper Arduino code on the NodeMCU.

Here is a short video displaying the project:
ChaseCar.mp4

Contact us:
Tal Rofe : talrofe111@gmail.com
Raz Tel-Vered: razraz350@gmail.com

Accessibility
Close Close