Science Projects‎ > ‎

Project 5: Speed Bot 1.1


Speed Bot is little more than a radio controlled car, with poor steering.  I started to build this robot for a middle school science class that I was visiting.  The goal was to introduce the students to robots, and the project for the day was to test the effect of wheel size on the speed of the robot.  Unfortunately, I did not finish the robot in time.

However, an incomplete robot was not a problem.  I was one of three people working with the students that day.  Since the students broke into groups, I had a few students finish the robot for me.  They worked well adapting the directions from one robot to fit this robot.  Unfortunately, they still failed to get the robot to run.

The problem is that when I uploaded the firmware for ROBOTC, the original VEX firmware was erased.  That means that the robot now has to be manually programmed to work with the remote control.  It took me a few hours to figure out what the problem was.  Here is the code that I adapted from the ROBOTC website to get Speed Bot running.

/* tank.c
 * This is a program to implement radio control functions into a robot.
 * ROBOTC overwrites the firmware in the VEX microcontroler, and thus the
 * default remote control settings are erased.
 * Thus, manual implementation of the remote controls is required.
 *
 * This particular program uses the tank style steering from the defalut
 * VEX firmware.  The right joystick on the remote is used to control the
 * right wheel, and the left joystick on the remote is used to control the
 * left wheel.
 */

/* task main() is the main function for all ROBOTC programs.
 */
task main()
{

  /* The current configuration of this robot has port1 driving the left wheel.
   * This function reverses the direction of the motor
   * so that it is not required to account for the direction of the left motor
   * every time it is used in the program.
   */
  bMotorFlippedMode[port1] = true;

  /* This takes the robot out of autonomous mode.  Thus, the robot will know to
   * look for remote control.
   */
  bVexAutonomousMode = false;

  /* This sets up an infinite loop so that the robot is continuously looking for
   * input from the remote control.
   */
  while(true) {
    /* This line checks the current postion of channel 2 of the remote control
     * (the vertical position of the right joystick on the remote) and sends
     * that value to the motor plugged into port 2 (the right motor in this case.)
     */
    motor[port2] = vexRT(Ch2);
    /* This line does almost the same as the previous line, except the vertical
     * postion of the left joystick is sent to the motor plugged into port 1.
     */
    motor[port1] = vexRT(Ch3);
  }

}

Speed Bot is in version 1.1 because I cleaned up the work of the middle school students after they left.  I won't be coming back to that class again, so they won't know that I changed their robot.


Comments