Go to Post Your team has a cave?!?!? OMG, how did you guys get that?!?! Do you have a cave sponsor? We tried talking to cave sponsors but none of them responded. You guys must be an elite team to have a cave. - marshall [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
Thread Tools Rate Thread Display Modes
  #16   Spotlight this post!  
Unread 05-02-2007, 23:30
Alan Anderson's Avatar
Alan Anderson Alan Anderson is offline
Software Architect
FRC #0045 (TechnoKats)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Kokomo, Indiana
Posts: 9,113
Alan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond repute
Re: Encoders not changing...

Quote:
Originally Posted by paulcd2000 View Post
...ours runs at 128 clicks per revolution, and some are concerned that that's too fast for the RC to detect
How many revolutions per second?

We've chosen 256 counts per revolution of the drive wheel. Moving at high speed will give a couple thousand interrupts per second. Our 2005 robot didn't seem to have a problem keeping up with that kind of rate.
  #17   Spotlight this post!  
Unread 06-02-2007, 01:21
radicalnerd radicalnerd is offline
Registered Luser
FRC #0668 (Apes of Wrath)
Team Role: Programmer
 
Join Date: Dec 2005
Location: San Jose, CA
Posts: 12
radicalnerd is an unknown quantity at this point
Send a message via AIM to radicalnerd
Re: Encoders not changing...

There might be a problem with storing a long to an int without typecasting... Kevin's Get_Encoder_n_Count() functions return a long. If you want to store them as ints you should typecast them:
Code:
LeftWheelCount = (int)Get_Encoder_1_Count();
RightWheelCount = (int)Get_Encoder_2_Count();
Otherwise you might get only the most significant bits of the long, which make the int variables 0. In other words, it's counting, but you're not printing them correctly. We had a similar problem with printf displaying longs without typecasting:

Code:
printf("Left encoder count = %d", Get_Encoder_1_Count() );      //incorrect
printf("Left encoder count = %d", (int)Get_Encoder_1_Count() ); //correct
I believe the first one tripped us up because it only printed the highest 16 bits of the long, making it appear like it's not counting.

This might be something you already know, in which case I'm sorry I can't help. But if you have a problem with encoders generating too many counts, BaneBots has an encoder divider board that we're using this year. They have jumpers to select divide by factor: 1, 4, 8, or 16. We have one 128/revolution encoder coupled 2:1 to each CIM motor shaft (that's ~5000 counts/sec at no load speed), divided by 4 so we don't overwhelm the processor with counts.
  #18   Spotlight this post!  
Unread 06-02-2007, 13:35
Jared Russell's Avatar
Jared Russell Jared Russell is offline
Taking a year (mostly) off
FRC #0254 (The Cheesy Poofs), FRC #0341 (Miss Daisy)
Team Role: Engineer
 
Join Date: Nov 2002
Rookie Year: 2001
Location: San Francisco, CA
Posts: 3,082
Jared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond repute
Re: Encoders not changing...

You can also try leaving things as longs and printing using "%ld" instead of "%d"
  #19   Spotlight this post!  
Unread 06-02-2007, 18:38
paulcd2000's Avatar
paulcd2000 paulcd2000 is offline
Accidentally speaks in C
AKA: Paul Dagnelie
FRC #1719 (The Umbrella Corp.)
Team Role: Programmer
 
Join Date: Jan 2006
Rookie Year: 2006
Location: Baltimore
Posts: 368
paulcd2000 is a jewel in the roughpaulcd2000 is a jewel in the roughpaulcd2000 is a jewel in the rough
Send a message via AIM to paulcd2000
Re: Encoders not changing...

i'm not sure which motors we're using but i think they're the chalupas. i'll try typecasting the method's returns as ints. I use ints because i get paranoid about the amount of space the robot really has...

Thanks to everyone for all of their help! It hasn't yet been fixed, but i have great confidence it will be, thanks to this huge outpouring of help!
__________________
"People don't say 'It's just a game' when their team is winning!" -- Scott Adams

5.5 students (on average)* $7/h *210 hours/student= $8085 of labor, all volunteered (not counting mentors', who are each that much)

We have blades on our robot?! ***sweeeeeet***

There are 11 types of people in the world. Those who can read binary, those who can't, and those who say this joke is supposed to be, "There are 10 types of people in the world. Those who can read binary and those who have a life."
  #20   Spotlight this post!  
Unread 07-02-2007, 00:19
Uberbots's Avatar
Uberbots Uberbots is offline
Mad Programmer
AKA: Billy Sisson
FRC #1124 (ÜberBots)
Team Role: College Student
 
Join Date: Jan 2006
Rookie Year: 2005
Location: Avon
Posts: 739
Uberbots has a reputation beyond reputeUberbots has a reputation beyond reputeUberbots has a reputation beyond reputeUberbots has a reputation beyond reputeUberbots has a reputation beyond reputeUberbots has a reputation beyond reputeUberbots has a reputation beyond reputeUberbots has a reputation beyond reputeUberbots has a reputation beyond reputeUberbots has a reputation beyond reputeUberbots has a reputation beyond repute
Re: Encoders not changing...

Dont be paranoid... unless you are doing some crazy coding then you should be fine.

either way, the proper replacement macro in printf for a long is %li
__________________
A few of my favorite numbers:
175 176 177 195 230 558 716 1024 1071 1592 1784 1816
RPI 2012
BREAKAWAY
  #21   Spotlight this post!  
Unread 07-02-2007, 00:22
Jared Russell's Avatar
Jared Russell Jared Russell is offline
Taking a year (mostly) off
FRC #0254 (The Cheesy Poofs), FRC #0341 (Miss Daisy)
Team Role: Engineer
 
Join Date: Nov 2002
Rookie Year: 2001
Location: San Francisco, CA
Posts: 3,082
Jared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond repute
Re: Encoders not changing...

%ld works just fine too

http://www.cplusplus.com/reference/c...io/printf.html
  #22   Spotlight this post!  
Unread 07-02-2007, 16:57
Astronouth7303's Avatar
Astronouth7303 Astronouth7303 is offline
Why did I come back?
AKA: Jamie Bliss
FRC #4967 (That ONE Team)
Team Role: Mentor
 
Join Date: Jan 2004
Rookie Year: 2004
Location: Grand Rapids, MI
Posts: 2,071
Astronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud of
Re: Encoders not changing...

Are you sure the RC is reading the sensors correctly?

What I did to test our GTS's last year was put the last 4 PWMs in User_CCP mode (digital outputs should work equally well) and have the interrupt handler toggle that. I then hooked an oscilloscope to both the GTS and the CCP pin. The wave forms matched nearly perfectly.

In terms of software, the GTS and encoders should be very similar, ignoring direction. Even just putting an LED on the output pin and watching its apparent brightness should be helpful. (You probably won't see flickering, as it goes too fast.)

If that works, you may need to post your code so that we can look at it.
  #23   Spotlight this post!  
Unread 08-02-2007, 17:10
paulcd2000's Avatar
paulcd2000 paulcd2000 is offline
Accidentally speaks in C
AKA: Paul Dagnelie
FRC #1719 (The Umbrella Corp.)
Team Role: Programmer
 
Join Date: Jan 2006
Rookie Year: 2006
Location: Baltimore
Posts: 368
paulcd2000 is a jewel in the roughpaulcd2000 is a jewel in the roughpaulcd2000 is a jewel in the rough
Send a message via AIM to paulcd2000
Re: Encoders not changing...

i've got one last test to determine if the problem is programming or electrical/mechanical at the root. In interrupt handler low:
Code:
	else if (INTCON3bits.INT2IF && INTCON3bits.INT2IE) // encoder 1 interrupt?
	{ 
		INTCON3bits.INT2IF = 0; // clear the interrupt flag
		#ifdef ENABLE_ENCODER_1
	-->    puts("1");
		Encoder_1_Int_Handler(); // call the left encoder interrupt handler (in encoder.c)
		#endif
	}
	else if (INTCON3bits.INT3IF && INTCON3bits.INT3IE) // encoder 2 interrupt?
	{
		INTCON3bits.INT3IF = 0; // clear the interrupt flag
		#ifdef ENABLE_ENCODER_2
	-->    puts("2");
		Encoder_2_Int_Handler(); // call right encoder interrupt handler (in encoder.c)
		#endif
	}
The "puts" will output to my screen every time the interupt is called. if it never gets called, then the problem in electrical/mechanical in origin. Does anyone see a problem with my logic? (I'll test it friday at 3:00)
__________________
"People don't say 'It's just a game' when their team is winning!" -- Scott Adams

5.5 students (on average)* $7/h *210 hours/student= $8085 of labor, all volunteered (not counting mentors', who are each that much)

We have blades on our robot?! ***sweeeeeet***

There are 11 types of people in the world. Those who can read binary, those who can't, and those who say this joke is supposed to be, "There are 10 types of people in the world. Those who can read binary and those who have a life."
  #24   Spotlight this post!  
Unread 10-02-2007, 12:52
paulcd2000's Avatar
paulcd2000 paulcd2000 is offline
Accidentally speaks in C
AKA: Paul Dagnelie
FRC #1719 (The Umbrella Corp.)
Team Role: Programmer
 
Join Date: Jan 2006
Rookie Year: 2006
Location: Baltimore
Posts: 368
paulcd2000 is a jewel in the roughpaulcd2000 is a jewel in the roughpaulcd2000 is a jewel in the rough
Send a message via AIM to paulcd2000
Re: Encoders not changing...

I finally fixed it!!!! yES!! But i have no idea why it didn't work. Oh well... Thank you, everyone, for your help!
__________________
"People don't say 'It's just a game' when their team is winning!" -- Scott Adams

5.5 students (on average)* $7/h *210 hours/student= $8085 of labor, all volunteered (not counting mentors', who are each that much)

We have blades on our robot?! ***sweeeeeet***

There are 11 types of people in the world. Those who can read binary, those who can't, and those who say this joke is supposed to be, "There are 10 types of people in the world. Those who can read binary and those who have a life."
  #25   Spotlight this post!  
Unread 15-02-2007, 18:50
JHale JHale is offline
Registered User
no team
 
Join Date: Feb 2007
Rookie Year: 2008
Location: Nowhere
Posts: 14
JHale is an unknown quantity at this point
Re: Encoders not changing...

Quote:
Originally Posted by paulcd2000 View Post
I finally fixed it!!!! yES!! But i have no idea why it didn't work. Oh well... Thank you, everyone, for your help!
Any chance in sharing what you did (I know the post is late). We are having problems with the code as well, and have ruled out the possibility of a problem with the encoders with an oscilloscope.
  #26   Spotlight this post!  
Unread 15-02-2007, 21:47
paulcd2000's Avatar
paulcd2000 paulcd2000 is offline
Accidentally speaks in C
AKA: Paul Dagnelie
FRC #1719 (The Umbrella Corp.)
Team Role: Programmer
 
Join Date: Jan 2006
Rookie Year: 2006
Location: Baltimore
Posts: 368
paulcd2000 is a jewel in the roughpaulcd2000 is a jewel in the roughpaulcd2000 is a jewel in the rough
Send a message via AIM to paulcd2000
Re: Encoders not changing...

Sure. Well i got sick of trying stuff, so i tested the encoders stuff from kevin's stuff. It worked! So i did every step from the installation, and all of a sudden it worked. The testing steps we took were to check to see if the voltage was changing when the motors turn. If it does, check to see if the interrupt fires. If it does, check the interrupt handling routine. If that checks out, then either it's the print statements or i'm stumped
__________________
"People don't say 'It's just a game' when their team is winning!" -- Scott Adams

5.5 students (on average)* $7/h *210 hours/student= $8085 of labor, all volunteered (not counting mentors', who are each that much)

We have blades on our robot?! ***sweeeeeet***

There are 11 types of people in the world. Those who can read binary, those who can't, and those who say this joke is supposed to be, "There are 10 types of people in the world. Those who can read binary and those who have a life."
  #27   Spotlight this post!  
Unread 17-02-2007, 21:29
paulcd2000's Avatar
paulcd2000 paulcd2000 is offline
Accidentally speaks in C
AKA: Paul Dagnelie
FRC #1719 (The Umbrella Corp.)
Team Role: Programmer
 
Join Date: Jan 2006
Rookie Year: 2006
Location: Baltimore
Posts: 368
paulcd2000 is a jewel in the roughpaulcd2000 is a jewel in the roughpaulcd2000 is a jewel in the rough
Send a message via AIM to paulcd2000
Re: Encoders not changing...

NEW PROBLEM: i now have one good encoder. The other one doesn't count. I've looked at the code, and everything is executed the same as the one that does work. Have yet to test the electrical portion, but my guess is that this is a brand new problem. Anyone have this or know how to fix it?
__________________
"People don't say 'It's just a game' when their team is winning!" -- Scott Adams

5.5 students (on average)* $7/h *210 hours/student= $8085 of labor, all volunteered (not counting mentors', who are each that much)

We have blades on our robot?! ***sweeeeeet***

There are 11 types of people in the world. Those who can read binary, those who can't, and those who say this joke is supposed to be, "There are 10 types of people in the world. Those who can read binary and those who have a life."
  #28   Spotlight this post!  
Unread 18-02-2007, 00:09
benhulett benhulett is offline
Registered User
FRC #1895
 
Join Date: Feb 2007
Location: Manassas
Posts: 28
benhulett is on a distinguished road
Re: Encoders not changing...

When you say it doesn't work, do you mean it get's stuck on a certain value? Or does it just stay at 0 while you turn it...

In Kevin's encoder_readme.txt, Step 4 states the following:

4) Disable encoders not needed for your design by following
the instructions in encoder.h. By default, all six encoders
are enabled.

Did you disable the rest of the encoders? Make sure you have the two your using enabled.

Are you using correct Digital I/O ports? (2 and 12 I think for the second encoder)

Other than that, I'm not sure why both won't work.....we had 2 working at one point by just following the readme.
  #29   Spotlight this post!  
Unread 18-02-2007, 08:34
paulcd2000's Avatar
paulcd2000 paulcd2000 is offline
Accidentally speaks in C
AKA: Paul Dagnelie
FRC #1719 (The Umbrella Corp.)
Team Role: Programmer
 
Join Date: Jan 2006
Rookie Year: 2006
Location: Baltimore
Posts: 368
paulcd2000 is a jewel in the roughpaulcd2000 is a jewel in the roughpaulcd2000 is a jewel in the rough
Send a message via AIM to paulcd2000
Re: Encoders not changing...

yeah, i have disabled 4-6, but 2 is still active. Today when i get in, i'll check whether they're all plugged in right, and whether they even return a signal. I suspect they do, but i can't be sure.
__________________
"People don't say 'It's just a game' when their team is winning!" -- Scott Adams

5.5 students (on average)* $7/h *210 hours/student= $8085 of labor, all volunteered (not counting mentors', who are each that much)

We have blades on our robot?! ***sweeeeeet***

There are 11 types of people in the world. Those who can read binary, those who can't, and those who say this joke is supposed to be, "There are 10 types of people in the world. Those who can read binary and those who have a life."
Closed Thread


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Changing Fields? Steve W Championship Event 8 08-04-2003 19:37
Changing Chairman's Jacqui Sutton Chairman's Award 1 03-04-2003 09:47
Changing gears archiver 2000 1 23-06-2002 23:26
::CHANGING SERVERS:: Brandon Martus General Forum 5 21-12-2001 10:33
changing my name Travis Covington CD Forum Support 1 09-10-2001 08:37


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

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


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