Programming

Overview


TINAH was the microcontroller used for this competition. It uses the Wiring language, a C-based open source language. Our algorithm made the robot tape-follow to the block depot and grabbed the blocks. Then it drove backwards back to the stacking area and simply dropped the blocks. We also developed a menu that allowed the user to set the parameters such as PID values and QRD detection thresholds.

Microcontroller

The microcontroller used for the robot was TINAH, a board custom-made for ENPH253.

From the ENPH253 website:

"TINAH is the micocontroller-based board designed and built for the Physics 253 course. The board is based on two key elements:
  1. Wiring, an open-source electronics I/O board and open-source programming environment based on the Atmel ATMega128 chip.
  2. the TINAH board shield, a printed circuit-board shield designed and built for Phys253 and first used in 2009 by Engphys students and staff. The shield acts as a “buffer” for protecting the the digital and analog inputs and outputs of the Wiring board, and allowing for built-in functions, including:
  • 4 DC motors (max 9V, 1A each with on-board h-bridge driver)
  • 3 RC Servo motors
  • buffered digital and analog inputs (i.e. protecting the ATMega128 with op-amps and digital buffer ICs)
  • 2 switches and 2 knobs for on-board control
  • 16×2 backlit LCD screen
  • access to the enable/direction pins for external motor control
Many of the design considerations for the board were inspired by the HandyBoard, a Motorola 68hc11=based controller system designed by Fred Martin at MIT in the mid-1990′s. The board was used from 2001-2008 as the basis for the Physics 253 course and used by hundreds of Engphys students.
Many thanks to the funding sources which made the development of the TINAH boards possible: UBC Skylight, UBC Teaching and Learning Enhancement Fund, and UBC Physics and Astronomy"

Flowcharts

Tape-following flow chart:



Block-grabbing flowchart:

Tape-following

The general control algorithm for movement along the tape we used was the PID (Proportional, Integral, Derivative) method. Integral gain was not needed and not used in order for the robot to function. Due to the proximity between the front and back wheels as well as the weight of the robot, regular PID algorithm was not sufficient. We were able to discover a method to slow the decay rate of the derivative gain, allowing the robot to move more smoothly. At certain points the tape makes sharp right angle turns, for which we made special 90-degree pivot algorithm. In the end, both forwards and backwards movement worked well.

Block-grabbing

The high success rate of our grabbing mechanism was due to the many sensors. The block grabbing algorithm was initiated as soon as the robot sensed that it reached the depot. The claws closed only if photosensors sensed blocks in the space enclosed by the claws. Sensors at the front of the claw allowed the robot to sense whether there were blocks just outside the enclosed area. The claws then pushed on these blocks, and sometimes this resulted in the block rotating into the reach of the claws.