![]() |
GearTooth Sensor Destroying Hopes of Autonomous~!!!!!!
We have just hooked up our gear tooth sensors and finally started getting readouts. problem is there are 238 gear tooths and when we spin it around we get gear counts in the hundred millions. we have no idea of why the gear count is reading out like this. We are using the easyC to program the geartooth sensors. Any input on what to do or what might be causing this problem would be much appriciated.
|
Re: GearTooth Sensor Destroying Hopes of Autonomous~!!!!!!
Hate to be the bearer of bad news, but i THINK the gear tooth sensors only sense direction, not tooth count.
http://www2.usfirst.org/2006comp/oth..._Operation.pdf |
Re: GearTooth Sensor Destroying Hopes of Autonomous~!!!!!!
Quote:
|
Re: GearTooth Sensor Destroying Hopes of Autonomous~!!!!!!
The actual issue is the sample code included with EZ C. The printf display of the geartooth variable needs to be cast as a long. Otherwise the upper bytes will be filled in with random data that will make the count look incorrect.
|
Re: GearTooth Sensor Destroying Hopes of Autonomous~!!!!!!
Actually, the gear tooth sensor should sense ONLY counts and give NO CLUE as to direction.
|
Re: GearTooth Sensor Destroying Hopes of Autonomous~!!!!!!
Quote:
See "GTS Counting" at http://www.chiefdelphi.com/forums/sh...threadid=44479 |
Re: GearTooth Sensor Destroying Hopes of Autonomous~!!!!!!
well you should know what way you are turrning your motor . .so while the sensor may not know what way its going your code can.
if(motorPWM# <127) gtscountdown(): if(motorPWM# >127) gtscountup(); |
Re: GearTooth Sensor Destroying Hopes of Autonomous~!!!!!!
Sadly, that only works in theory.
When you are stopping and your motors are getting a pwm of 127 the gears still spin for a little bit. I guess this wouldn't matter too too much but then your gear count wouldn't register during these times. |
Re: GearTooth Sensor Destroying Hopes of Autonomous~!!!!!!
i have found that using the IR sensors they gave us a few years ago and a visual encoder will also give fairly accurate results and with very little programming. The code to handle all the stuff for our visual encoders is about 10 lines in total including overload handling and reset capability.
|
Re: GearTooth Sensor Destroying Hopes of Autonomous~!!!!!!
I tried counting teeth (well sort of... I was using an optical sensor to count the number of revs of a shaft collar). I found the best way is to hook up the output of the sensor to an interrupt pin. That way when the sensor trips you increment your count (or decrement, depending on which way the motor was going last, use a tracking variable).
It's quite a bit more accurate than counting in the main loop as the IRQ time on those PICs is in the microseconds. And, it's largely free. |
Re: GearTooth Sensor Destroying Hopes of Autonomous~!!!!!!
In my opinion the gear tooth sensors are a pain. A cheap alternative solution is to use the vex encoders in place of the gear tooth sensors. They work with the same Easy-C functions as the gear tooth sensors. They are also higher resolution. They can be added to the kit chassis and frame very easily. The KOP trans output shaft is tapped. A piece of threaded rod can be coupled to a piece of 1/8" key stock. Attach the encoder with a piece of 1/16" aluminum angle. You'll need a female by female PWM extension cable.
Works very well for going "x" feet during autonomous. Could easily be done Thurs. morning. |
Re: GearTooth Sensor Destroying Hopes of Autonomous~!!!!!!
Quote:
EDIT: 200th post! w00t! |
Re: GearTooth Sensor Destroying Hopes of Autonomous~!!!!!!
The Vex encoders give 90 counts per revolution. There is no direction info. The same easy-c function that is for the gear tooth sensor can be used for the Vex encoder. They are not of the Grayhill quality or cost. You wouldn't want to use one to measure the shooter wheel RPM but for measuring distance they're not to bad.
|
Re: GearTooth Sensor Destroying Hopes of Autonomous~!!!!!!
When using GTS do you have to use interrupts? Because we wrote a code using simple counters, it kinda works. It would be great if maybe someone could help us up and give like a sample code for the gts. Thanks!
|
Re: GearTooth Sensor Destroying Hopes of Autonomous~!!!!!!
Quote:
|
| All times are GMT -5. The time now is 16:42. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi