The goal of this project was to construct a tractor capable of pulling and pushing a provided trailer, using proportional control to allow a robot to correct itself in unstable equilibrium. Three challenges were provided, of which two were required: 1) driving in reverse in a straight line, and 2) driving in reverse at a given angle; i.e., driving in reverse on a circular path.
The tractor is of a fairly simple design, consisting of two independent motors and a single omnidrectional roller, allowing the vehicle to turn stably. The trailer is connected to the tractor on the motor side, since this side is closer to the center of rotation and is therefore easier to control.
Maintaining a Constant Position:
The goal of the first challenge was to maintain the trailer’s straight path. For this, we used a single gyro sensor. The robot first drives forward for 3 seconds to ensure that the starting position of the gyro is straight. The sensor calibrates to 0, and then the robot begins driving backwards. The program continually reads the gyro sensor position to adjust the robot’s trajectory. If the angle is nonzero, the robot corrects by adding 1.5 times the gyro angle to the right motor speed, and subtracting this from the left. The robot turns left to correct a positive angle, and right to correct a negative angle, and the correction is more significant for larger angles.
One issue we ran into was that the robot would correct for differences in the trailer angle, but would correct regardless of the tractor angle. For example, if the robot corrects the trailer but the tractor is on an angle, the tractor will then drive straight on that angle. This is due to the constraint of the challenge, for which we could only use one gyro sensor placed on the trailer. This could be corrected by fixing a second gyro sensor to the tractor, so that the robot could correct for both angle changes.
Following a Curved Path:
The goal of the second challenge was to follow an arc of a certain degree. The beginning of the code is similar to the first challenge, while calibrating a second gyro sensor fixed to the robot. The desired arc angle is set as a variable. When the robot begins driving forward, the code functions similarly to the first: however, instead of correcting for the angle of the gyro sensor on the trailer, it corrects for the difference between the desired arc angle and the actual difference in the angles of the tractor and trailer. The code worked at both small (20 degrees) and large (50 degrees) angles.
Photos and videos
Side view. Main drive wheels, front omnidirectional "wheel", gyro sensors, aesthetic elements all visible.
Front view. Motor connections to EV3 visible.
Undercarriage view. Tractor/trailer interface visible.
Isometric view. Flag in better focus.
Robot moving in reverse in a straight line. Good demonstration on how hardware requirements actually interfere with software requirements.
Robot moving in reverse at a set angle, resulting in a circle.
Robot moving in reverse at a different angle, resulting in a circle of a different radius.