Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Programming (http://www.chiefdelphi.com/forums/forumdisplay.php?f=51)
-   -   Encoder Problem (http://www.chiefdelphi.com/forums/showthread.php?t=50852)

DustinB_3 02-01-2007 13:48

Encoder Problem
 
I am using four grayhill encoders for our robot that uses a mecanum drive system. I am using the frc_encoder code from kevin watson. When I download the code unmodified it works just fine and all the encoders give me a reading. When I copy and paste the mecanum drive code into the encoder code only one of the encoders gives me a reading. Any help is much appreciated.

Joel J 02-01-2007 13:52

Re: Encoder Problem
 
Can you post the code that doesn't work?

DustinB_3 02-01-2007 16:07

Re: Encoder Problem
 
1 Attachment(s)
Attached to this message is the user routines file that doesn't work.

chris31 02-01-2007 16:19

Re: Encoder Problem
 
At a quick glance I dont see anything wrong. To confirm, your sayng when you comment out/dont run Default_Routine() that all 4 encoders work but when you run it only 1 does?

Alan Anderson 02-01-2007 16:19

Re: Encoder Problem
 
Quote:

Originally Posted by DustinB_3 (Post 547038)
Attached to this message is the user routines file that doesn't work.

The "\r\n" part of your printf commands bothers me. Aren't we supposed to use just "\r" and not "\n"?

How does this code differ from what does work?

Tristan Lall 02-01-2007 16:49

Re: Encoder Problem
 
Quote:

Originally Posted by Alan Anderson (Post 547049)
The "\r\n" part of your printf commands bothers me. Aren't we supposed to use just "\r" and not "\n"?

It's a carriage return and a line feed. He's constructed it like a Windows text file, which would normally use that escape sequence to mark a new line.

DustinB_3 02-01-2007 18:40

Re: Encoder Problem
 
I have tried commenting out the calll to default routine but it still only will read one encoder. The only difference between my code and the frc_encoder code ist that I have added some mecanum drive code for our robot.

chris31 02-01-2007 18:53

Re: Encoder Problem
 
Could you please post both copies of your code for us to look at.

bear24rw 02-01-2007 19:56

Re: Encoder Problem
 
Did you add code any where else besides user_routines?

DustinB_3 02-01-2007 22:53

Re: Encoder Problem
 
1 Attachment(s)
The new user routines is the one from my earlier post and the old user routines is attached to this message and the only thing i edited between the two codes is the addition of the mecanum drive code.

bear24rw 02-01-2007 23:13

Re: Encoder Problem
 
Have you tried putting in the frc_encoders code again to see if all the encoders still work?

DustinB_3 03-01-2007 08:30

Re: Encoder Problem
 
When I download the frc_encoders the encoders work great but when I add the mecanum drive code only one encoder will feed back values.

chris31 03-01-2007 08:44

Re: Encoder Problem
 
Try running the 2 through a diff tool to see the difrences in the 2 files. I didnt see anything when I did a quick look, ill check again when I have more time.

DustinB_3 03-01-2007 08:54

Re: Encoder Problem
 
Where would I get a diff tool. I've never even heard of such a thing.

Jack Jones 03-01-2007 09:04

Re: Encoder Problem
 
Quote:

Originally Posted by DustinB_3 (Post 547185)
The new user routines is the one from my earlier post and the old user routines is attached to this message and the only thing i edited between the two codes is the addition of the mecanum drive code.

Not so:

From code that works:
/* SECOND: Set up the I/O pins you want to use as digital OUTPUTS. */
digital_io_17 = OUTPUT; /* Example - Not used in Default Code. */

/* THIRD: Initialize the values on the digital outputs. */
rc_dig_out17 = 0;


From modified code:
/* SECOND: Set up the I/O pins you want to use as digital OUTPUTS. */
digital_io_17 = INPUT; /* Example - Not used in Default Code. */

DustinB_3 03-01-2007 09:14

Re: Encoder Problem
 
My mistake. Thanks for pointing that out but would that make a difference for the encoders.

Jack Jones 03-01-2007 09:41

Re: Encoder Problem
 
If you don't recall changing that, then maybe there's others. Obviously, something's different = one works, one dosen't.

How about the fact that you're getting the encoder count for #s 1..4 in one chunk of code, and for #s 1..6 in the other. Is encoder.h set up to use six(6) encoders?

PS: The call to Default_Routine() is commented out in both sets of code, so don't expect any changes there to show up once you get encoders working.

DustinB_3 03-01-2007 10:17

Re: Encoder Problem
 
I have tried it both ways. I have tried it with all six encoders enabled and I have tried it with 4 enabled. Other than that there are no changes between the encoder.h files. About the default routine I have tried commented and uncommented but it still will only read one encoder.

prograid 03-01-2007 13:45

Re: Encoder Problem
 
It could be that your interrupt handlers are set up wrong in user_routines_fast.c. Have you checked those?
You should be able to drop the user_routines_fast.c from Kevin's code into your project, unless you are using custom timers, or have already written up some autonomous routine.

At the very least, check to see if InterruptHandlerLow is set up the same in both sets of code.

Hope this helps.

chris31 03-01-2007 14:04

Re: Encoder Problem
 
Grab a copy of WinMerge and check out your 2 files.

http://winmerge.org/

Mark Pierce 03-01-2007 14:04

Re: Encoder Problem
 
Quote:

Originally Posted by DustinB_3 (Post 547286)
Where would I get a diff tool. I've never even heard of such a thing.

I've had good luck with winmerge, which is an open source tool for comparing folders and files. I think that such a tool would help with your current problem.

DustinB_3 03-01-2007 14:36

Re: Encoder Problem
 
I am using the exact user routines fast from kevin watsons frc_encoder code.

DustinB_3 03-01-2007 20:42

Re: Encoder Problem
 
Thanks for all of your help. I have finally fixed the problem. I swear that I did not edit the encoder.h file but when I overwrote the old one with one that I got directly from kevin watsons website it fixed the problem.


All times are GMT -5. The time now is 03:23.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi