Software Design Overview
A crucial part of this project was designing software around the physics of the bot as well as external inputs from the stage. We chose to focus on utilizing the 5kHz IR beacon in the reload box and the T-shaped tape on the stage floor. Assuming the bot starts out in a random orientation and a static position in a corner of the stage, the bot would rotate until it found the reload beacon, reorient itself (using a fixed angle) to face the central tape line, drive toward the tape, and follow the tape line toward and away from the token buckets to drop off, and reload tokens, respectively. This of course required code for operating the motors, gathering readings from the tape and IR sensors, and various algorithms for performing more complex functions.
Bucket_Rover Code sample detailing functions for gathering tape sensor and IR beacon-detection readings.
Implementation Challenges
As mentioned, a particular challenge faced in designing software for this b0t was dealing with constraints imposed on the bot by the physical world. This airtight relationship between software, hardware, and physics kept our strategy in a constant state of change. As various software features were tested, we would learn constantly of issues needing to be accounted for, notably motor coasting, power consumption, and software-hardware command-response delays.
Some notable software features we developed to curtail these issues include:
Some notable software features we developed to curtail these issues include:
Dynamic Braking
Stopping the DC motors outright proved to be ineffective, often causing the bot to coast in its initial direction of movement. A stopping mechanism was implemented in code wherein movement in the reverse direction of motion is invoked shortly before cutting power to the motors, creating a dynamic braking system. Speed Reduction Toggling (PWM control) We found that the bot's performance during rotations and turns was inconsistent. As such, we developed a scheme to normalize the effects of momentum by both dramatically reducing motor speed and by spiking each motor's enable pin PWM briefly before lowering it. In-place Servo Disconnect/Attachment By cutting power to the arm mechanism servos until needed, we were able to conserve power and reduce heat production in the voltage regulators. See the full code here.
|