Difference between revisions of "DEWBOT V Programming"

From DEW Robotics
Jump to: navigation, search
(Created page with 'Programming of Dewbot V is fairly simple and clean. Once the design was completed, the corresponding programming was set out: ;Drive functions: Simple tank drive for most activ...')
 
m (categorizing)
 
Line 47: Line 47:
  
 
The vision task runs all the time.  The up / down servo is under control of the vision system at all times.  The left / right servo is the hopper.  While the vision system continuously calculates values for the servo, only when the button is pressed is the value used to move the hopper.  Because the hopper looks like a servo to the vision system the code is very similar to the base code.
 
The vision task runs all the time.  The up / down servo is under control of the vision system at all times.  The left / right servo is the hopper.  While the vision system continuously calculates values for the servo, only when the button is pressed is the value used to move the hopper.  Because the hopper looks like a servo to the vision system the code is very similar to the base code.
 +
 +
[[Category:Robot]][[Category:DEWBOT V]]

Latest revision as of 18:47, 12 June 2009

Programming of Dewbot V is fairly simple and clean. Once the design was completed, the corresponding programming was set out:

Drive functions
Simple tank drive for most activities. Because of the Regolith floor and wheel interactions, some simple traction control is needed. We know from friction experiments how fast the wheels can accelerate (or de-accelerate) without slipping on the floor. A simple solution of monitoring the drive wheel speed by the use of encoders (that counts the speed and direction of the drive shaft.) By comparing current to previous readings the system can tell if the wheels are still on the traction curve. If they are below the curve then acceleration is lower, the wheels most likely have traction. If it is above the curve the wheels are slipping, and power will be reduced to regain traction.
The “7th” wheel is a driven wheel at right angles to the drive train mounted on a compressed air cylinder to move it up and down. This motion allows the wheel to be use in sharp turning situations. The driver pulls the trigger the wheel drops. When it contacts the floor it then spins the direction selected by the operator.
In “7th wheel mode” the joystick the driver selected (by pulling the trigger) moves into arcade drive. This allows the driver to rotate the robot with the single joystick to do sharp turns to the left or right. When the trigger is released, the “7th wheel” is retracted and control returns to tank drive. Either joystick can be used for the “7th wheel” by pulling on either trigger. This facilitates right and left hand drivers.
Ball Management
Buttons on the operator joystick manages the movement of the orbit balls inside the robot. There are two motor / beater bar arrangements. The first bar lifts the orbit ball up into the hopper. The second bar, the spindle, moves the balls up the spiral ramp to the top mounted shooter. Both of these bars are reversible under operator control to clear jams. The bars operate independently.
Hopper positioning
A quick discussion on servos: If you take a servo apart you’ll find a motor, some gearing and on the final output shaft a position potentiometer. The potentiometer sends the position of the shaft to a control circuit. This circuit takes that value and the PWM input value and compares them. The result is what is used to drive the motor the correct direction. When the values “match” the motor stops and holds position.
The hopper arrangement on DEWbot V is a giant servo. There is a motor that drives the hopper left and right. At the center is a potentiometer that gives the rotational position of the hopper. In effect, a giant 50” tall servo.
The control system treats this arrangement as a servo. The operator can select ball pickup and the bin is turned to the correct location to allow balls to be lifted from the floor and into the hopper. The value of the “servo” changes when the hopper turns. When the bottom opening moves into position, the lower beater bar is enabled in the lifting direction. The beater bar can be run in reverse to clear jams at any time.
During the match the operator can press the control button and the hopper will automatically move to the ball load position. This frees the operator from trying to do manual positioning.
When the hopper is turned, the value of the servo changes and the lower beater bar is disabled. The beater bar can be run in reverse to clear jams at any time.
Ball location
At the top of the hopper is the shooter. A sensor can tell when the orbit ball is in place to be fired by the shooter. This sensor is used to turn on the HeadsUp LED display on the robot. A band of LED’s around the hopper light up indicating to the operator that the ball is in position. Later on the Vision system will blink the LED’s when it has a target locked on.
Ball fire
Once there is a ball at the shooter the operator can pull the fire trigger to launch the ball into the opposing teams trailer. The control system has two modes: one where it will not fire the shooter until the ball is in position; the second is a free fire mode.
Target lock
The vision system is used to detect when a target trailer is in range. The camera is mounted on top of the hopper and looks the same direction as the shooter. The operator uses a manual control to position the hopper / shooter / camera in the direction of the target. By pressing a thumb switch they tell the system to lock onto that target. Visioning take over, and locks on to the target by moving the hopper. Manual control of hopper position is disabled while the vision system has control. Once a lock is detected, the HeadsUp display will flash indicating that the operator can fire.
There is a button on the operator joystick that allows the operator to randomly flash the HeadsUp display. This allows the operator to verify that the HeadsUp display is working and to create some confusion and misdirection with the other teams on when it flashes.
Once the button is released, the Vision system gives up control and manual movement of the hopper is allowed. This control allows computer-assisted control of the shooting. The operator can lead the vision system into the target and then have it do the final lock.

Internal flow

There are three main tasks inside the cRio:

  • Operator / Autonomous
  • Vision
  • Watchdog

These three process run at all times.

Operator / Autonomous Task

In autonomous mode, switches on the robot that were set by the strategy team are used to control the first 20 seconds of play. The switches set up a direction (curve left, curve right) and the speed (slow, medium, fast). The robot moves to the middle of the field and then spins. This action should keep the human players from scoring into the trailer.

In Operator mode, the control system works as outlined above.

Vision Task

The vision task runs all the time. The up / down servo is under control of the vision system at all times. The left / right servo is the hopper. While the vision system continuously calculates values for the servo, only when the button is pressed is the value used to move the hopper. Because the hopper looks like a servo to the vision system the code is very similar to the base code.