Robert Hrabchak

Riley Kolus

2/7/18

The Autonomous Trailer

Intro

The goal for this project was to create a truck that was capable of hauling a premade trailer. Using gyroscopic sensors, the truck had to be capable of driving itself in reverse along a straight path, along a circle, and parallel parking itself. This is small demonstration of what the future of autonomous trucking looks like!

The Vehicle

To construct this truck, first two independently powered wheels were attached via motors to the front of the vehicle. To make the truck stable, a rolling wheel was placed at the back of the cab. The truck was then attached via a simple hinge to the trailer. Next the sensors were attached to the vehicle so that the truck could be made autonomous. One gyroscope was placed above the joint connecting the trailer to the truck. The other gyroscope was placed above the EV3 controller on the truck. Lastly, a simple pushbutton was added to the side of the vehicle to allow the desired program to be stopped more simply than running back to a laptop after the vehicle crashes.

The Code

Part 1: Backing up in a straight line

To make the vehicle reverse in a straight line, the code employed had to follow a simple command structure: REDA. That, of course, stands for Read the sensor, calculate the Error, Decide what to do, and Actuate. Reading the sensor meant initializing the gyroscope and reading it every time through the infinite loop. After a reading was output from the gyroscope, the controller would determine how far and in which direction the trailer was moving away from 0 degrees, with a straight line being perfectly lined up at 0 degrees. Depending on the error, motor speeds for each of the front two wheels would be decided on to realign the trailer. Lastly, the commands were sent to the motors to be implemented. The loop then checks to see if the stop button was hit, and otherwise repeats this process continuously.

This part of the project was straightforward and worked extremely well - the trailer could reverse in a straight line easily. Even when the trailer was “disturbed,” or kicked off course, the truck was able to quickly recover from the situation and realign itself.

Image

Part 2: Backing up in a circle

Reversing in a circle required the same basic logic structure as implemented above, with a few added parameters. First of all, the second gyroscope was used this time. When calculating the error, the two gyroscope readings were subtracted from each other and compared to a reference angle. We found that we could set this reference angle between roughly -35 degrees and + 35 degrees while still having a stable system. The closer this reference angle is to 0, the larger the circle would be. Setting the reference angle close to either limit would result in a tighter turning radius. Otherwise, a similar Read, compute Error, Decide, Actuate control setup was used.

This part of the project took more time to perfect because the gain factor “k” had to be tested at various different levels to make the system stable. This gain factor was directly related to the drive speed, and the reference angle, so all three parameters had to be tuned to work well with each other. This resulted in a few crashes into sofas, but ultimately a suitable of values was arrived upon that allowed the system to remain in a stable circle, even after the trailer was kicked out of the correct direction.

Image

Part 3: Parallel parking

To parallel park the truck, we first researched how real truck drivers parallel park. After observing their methods, the team hardcoded motor speed values to simulate the same actions. A test course was setup with the correct dimensions, and a number of trials were conducted to determine the optimum motors speeds and timing delays. With enough practice, the truck was able to flawlessly park itself. The future of trucking is finally here!

Image