Project 3: Trailer Control
Shunta Muto, Osvaldo Calzada
The car was constructed using the same design as Project 1. At the rear of the car, the trailer consisting of acrylic board and wheels was attached. For the first challenge, the gyro sensor was attached at the connection point between the trailer and the car. The gyro sensor was attached in alignment with the trailer, so that it measured the angle between the imaginary straight line drawn across the trailer, when it initially begins moving, and the sensor. For the second challenge, additional gyro sensor was attached above the car, also in alignment with the trailer.
(Above) Gyro sensor placement (Below) Trailer
Challenge 1: Drive Straight
Challenge 1 required the car to drive backward in straight line. Since the challenge only required the orientation to be straight rather than keeping the initial straight path, we only needed to consider the angle that the trailer makes with the initial orientation of the sensor. Speed was set to be -400. After experimenting with several trials, we determined the ideal kp of our proportional control to be 10. At kp that is too small, the car could not adjust its position when struck by large noise (kick). At kp that is too big, the car essentially ran out of control since it overshot its motor speeds every time it tried to adjust its orientation. Video and code are shown below.
Challenge 2: Drive in Circle
Challenge 2 required the truck and trailer to simultaneously move in a circular path. Since we wanted to hold the same angle throughout the movement, 2 gyroscopic sensors were used. They were both calibrated by being in the same plane, or both having the same angle of zero. In order to initiate and hold the rotation, a displacement angle was added to the difference of the angles (theta3) obtained from the sensor. Changing this displacement value resulted in a change of the the circular path (larger displacement value resulted in larger circle, and vice versa). Theta3 in our code was sent to the motors to actuate. It was very important to break down the system and obtain the proper orientation for each angle. Incorrect orientations (adding or subtracting something incorrectly) resulted in the wheels spinning in opposite directions, or the vehicle simply becoming stuck. The Kp value, and our theta3 value allowed the vehicle to sustain the circular path.
[Video 1: angle = 10, speed -200]
[Video 2: angle = 50, speed -200]
[video 3: angle 50, speed = -400]