Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Programming (http://www.chiefdelphi.com/forums/forumdisplay.php?f=51)
-   -   GearTooth Sensor Destroying Hopes of Autonomous~!!!!!! (http://www.chiefdelphi.com/forums/showthread.php?t=44428)

Prgrmin' 20-02-2006 18:30

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.

Rombus 20-02-2006 22:36

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

Dad1279 20-02-2006 22:52

Re: GearTooth Sensor Destroying Hopes of Autonomous~!!!!!!
 
Quote:

Originally Posted by Rombus
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

They definitely count. With Easy C, are you preseting them with zero?

Mark_K 21-02-2006 19:48

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.

TimCraig 21-02-2006 22:59

Re: GearTooth Sensor Destroying Hopes of Autonomous~!!!!!!
 
Actually, the gear tooth sensor should sense ONLY counts and give NO CLUE as to direction.

gnirts 21-02-2006 23:01

Re: GearTooth Sensor Destroying Hopes of Autonomous~!!!!!!
 
Quote:

Originally Posted by TimCraig
Actually, the gear tooth sensor should sense ONLY counts and give NO CLUE as to direction.

Apparently, direction is possible. Just a little more convoluted.

See "GTS Counting" at http://www.chiefdelphi.com/forums/sh...threadid=44479

Stuart 21-02-2006 23:26

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();

b_mallerd 22-02-2006 01:13

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.

Cuog 22-02-2006 09:09

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.

jzampier 22-02-2006 10:59

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.

Gdeaver 22-02-2006 11:43

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.

Chriszuma 23-02-2006 16:39

Re: GearTooth Sensor Destroying Hopes of Autonomous~!!!!!!
 
Quote:

Originally Posted by Gdeaver
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.

How do you interface with those in the code? Does it just give you a tick every revolution or something similar?

EDIT: 200th post! w00t!

Gdeaver 23-02-2006 20:27

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.

Denz 25-02-2006 13:10

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!

Tom Bottiglieri 25-02-2006 13:16

Re: GearTooth Sensor Destroying Hopes of Autonomous~!!!!!!
 
Quote:

Originally Posted by Denz
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!

Using interrupts really isnt as hard as it seems. You can even use the same code you've already written.. Just take the guts of your counter, put it in a function that whenever called will add one to the counter, and call that function in the ISR for whatever interrupt you choose to use. (I1-I3 are the easiest to get set up and running.)


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