![]() |
Ball speed trap using 2005 RC
An interrupt/timer example that implements a ball speed trap using banner sensors can be found at:
www.srvhsrobotics.org/eugenebrooks/ in the file SpeedTrap2005.zip. Teams might find this code useful in confirming that your ball shooter does not exceed 12 meters/sec. This code builds and runs on the 2004/2005 RC that you might have laying around from last year. Many teams will have "narrow beam" banner sensors and reflective tape laying about around previous years as well and can quickly cobble a speed trap using these. Set up your banner sensors so that the digital inputs see a "1" when the light beam is clear of any obstruction. The sensor at the start of the speed trap is wired to digital input 01. The sensor at the end is wired to digital input 02. The code assumes a 19 inch separation between the beams, but you can adjust the calibration to any desired distance. The results are printed on the computer display with two digits behind the decimal point (truncated). The result is also shown on the user mode led display on the OI, in tenths of meters per second (rounded), making a selfcontained instrument without an attached computer possible. Have fun, Eugene |
Re: Ball speed trap using 2005 RC
Quote:
We downloaded your code to our 2004 RC, and hooked up the banner sensors to digital inputs 1 and 2 (After making sure that the sensors were wired such that they read 1 when open.). The only output we are receiving is from the call Code:
printf("SpeedTrap2005, assuming a 19 inch light beam separation\r");Code:
if(GetSpeedTrapCycle() != SpeedTrapCycleCount)Thanks, |
Re: Ball speed trap using 2005 RC
We built the hardware to do this early in the build season - two banner sensors on a board. For that to work, we had to assume that we were looking at a brightly colored ball. Of course, with no shooter to test, and with plenty of robot software to make, the software guys focused their energies in more predictible ways.
Which is why I'm so thankful for this code - it worked like a champ, when we finally decided to hook up our trap. For it to work with our shooter, we put a yellow and black ball in so that it was spinning along its equator, and had the yellow side to the sensors. Also, our setup spacing was larger than the 19" that was quoted in the code. In order to adjust it, I took the long magic number (four million something), and scaled it for our length (five million something). Has anyone come up with a good way to calibrate or verify these guys yet? Our numbers are close to what we were expecting, but there might be something that I haven't considered that's bumping it off 2 m/s or something. |
Re: Ball speed trap using 2005 RC
Use banner sensors that throw a tight beam and set them up with retro-reflective tape so that when a ball is not blocking the beam the sensor activates. Adjust the sensor so that it just activates reliably when the beam is bouncing off the reflective tape, and so that a ball in the beam causes the sensor to change state reliably. When the ball goes through it breaks the beam, interrupting the RC to get the time value from the timer. You will not get as clean a signal off the ball itself...
Other than the possibility that you have not wired the sensors correctly, you need to wire the power input to 12 volts, and the signal output and ground to the digital input port on the RC. It also might be the case that you have not adjusted the sensor properly. You can see whether this is the case by the little indicator light on the sensor. The best way to calibrate the sensor is to print out the time in raw clock ticks and time a long interval with a stop watch. With the time carefully calibrated, you can then measure the distance between the light beams and do the appropriate arithmetic. The code provided assumes that the clock rate of the timer is accurate, and it should be checked. The sensor has two signal outputs, one that is high and one that is low when the beam is not blocked by the ball, and it is not all that important which one is used but the two sensors must be wired consistently... In case you want to know, the sensor code is recording start-stop triggers and printing the speed only once for each event. If no beam interrupts are seen, in the proper order, nothing is printed. Eugene |
| All times are GMT -5. The time now is 01:05. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi