Go to Post This place is much brighter than most institutions I have seen. It also seems to be lacking straight jackets which I think is a mistake for many of us. - Andrew Schreiber [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
  #1   Spotlight this post!  
Unread 05-02-2007, 08:49
The Vrooman's Avatar
The Vrooman The Vrooman is offline
Registered User
FRC #1137
 
Join Date: Jan 2007
Location: Mathews, Virginia
Posts: 7
The Vrooman is an unknown quantity at this point
Master Code

We had the camera and the gyro working, but when we hooked up an encoder the gyro stopped working.

So...now we have the camera and an encoder working but not the gyro.

Do any teams have some kind of "Master Code" that has the camera, the gyro, and an encoder working together?

Would any be willing to distribute it?

Otherwise would you be willing to help us get the gyro working?

It doesn't printf the angle at all and the rate doesn't seem quite right either even though it is giving us values.

We made a turn command that turns the robot until the gyro says we have turn a given number of degrees.

Strangely it will turn for what seems to be a random amount of time and then stop. It's never the angle we told it to go, but the gyro is registering something it seems.

Thanks,
Team 1137
  #2   Spotlight this post!  
Unread 05-02-2007, 08:56
tdlrali tdlrali is offline
Registered User
FRC #0469 (Las Guerrillas)
Team Role: Programmer
 
Join Date: Sep 2006
Rookie Year: 2006
Location: MI
Posts: 377
tdlrali has much to be proud oftdlrali has much to be proud oftdlrali has much to be proud oftdlrali has much to be proud oftdlrali has much to be proud oftdlrali has much to be proud oftdlrali has much to be proud oftdlrali has much to be proud of
Re: Master Code

i'm guessing you are using interrupts for both the gyro and the encoders...
are you sure they are not using the same interrupts?
  #3   Spotlight this post!  
Unread 05-02-2007, 09:02
JBotAlan's Avatar
JBotAlan JBotAlan is offline
Forever chasing the 'bot around
AKA: Jacob Rau
FRC #5263
Team Role: Mentor
 
Join Date: Sep 2004
Rookie Year: 2004
Location: Riverview, MI
Posts: 723
JBotAlan has a reputation beyond reputeJBotAlan has a reputation beyond reputeJBotAlan has a reputation beyond reputeJBotAlan has a reputation beyond reputeJBotAlan has a reputation beyond reputeJBotAlan has a reputation beyond reputeJBotAlan has a reputation beyond reputeJBotAlan has a reputation beyond reputeJBotAlan has a reputation beyond reputeJBotAlan has a reputation beyond reputeJBotAlan has a reputation beyond repute
Send a message via AIM to JBotAlan Send a message via Yahoo to JBotAlan
Re: Master Code

Correct me if I'm wrong, but the gyroscope gives you an *analog* value; interrupts are irrelevant when working with analog sources. The encoder needs 2 digital inputs.

Grab a voltmeter and verify that you are getting the 5v out of the 5v pins. That's my guess as to what is going on. Check for shavings and make sure all your RC's lights are flashing green when your 'bot is enabled.

Post your code. I'd be happy to look at it. Just zip it up and attach it to your post.

JBot
__________________
Aren't signatures a bit outdated?
  #4   Spotlight this post!  
Unread 05-02-2007, 10:14
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: Master Code

Quote:
Originally Posted by JBotAlan View Post
Correct me if I'm wrong, but the gyroscope gives you an *analog* value; interrupts are irrelevant when working with analog sources.
You're not exactly wrong, but it sounds like you haven't worked with the gyro. In order to get the best results from a gyro-based control routine, the analog value must be sampled with extremely regular timing. Kevin Watson provides a framework for using the gyro which does use interrupts to do the analog conversions in the background.

Putting his encoder and gyro software together isn't particularly complicated, but getting the interrupt service routines combined properly does take some thought.
  #5   Spotlight this post!  
Unread 05-02-2007, 11:39
JBotAlan's Avatar
JBotAlan JBotAlan is offline
Forever chasing the 'bot around
AKA: Jacob Rau
FRC #5263
Team Role: Mentor
 
Join Date: Sep 2004
Rookie Year: 2004
Location: Riverview, MI
Posts: 723
JBotAlan has a reputation beyond reputeJBotAlan has a reputation beyond reputeJBotAlan has a reputation beyond reputeJBotAlan has a reputation beyond reputeJBotAlan has a reputation beyond reputeJBotAlan has a reputation beyond reputeJBotAlan has a reputation beyond reputeJBotAlan has a reputation beyond reputeJBotAlan has a reputation beyond reputeJBotAlan has a reputation beyond reputeJBotAlan has a reputation beyond repute
Send a message via AIM to JBotAlan Send a message via Yahoo to JBotAlan
Re: Master Code

Quote:
Originally Posted by Alan Anderson View Post
You're not exactly wrong, but it sounds like you haven't worked with the gyro. In order to get the best results from a gyro-based control routine, the analog value must be sampled with extremely regular timing. Kevin Watson provides a framework for using the gyro which does use interrupts to do the analog conversions in the background.
I have worked with the gyro, but I didn't use Kevin's base gyro code; I created my own. I am having accuracy issues, and it makes sense that it needs to be called very regularly. I'll read over Kevin's code and probably rewrite my gyro stuff today.

Now I know why you'd use interrupts with a gyro. You learn new stuff every day...

JBot
__________________
Aren't signatures a bit outdated?
  #6   Spotlight this post!  
Unread 05-02-2007, 12:06
The Vrooman's Avatar
The Vrooman The Vrooman is offline
Registered User
FRC #1137
 
Join Date: Jan 2007
Location: Mathews, Virginia
Posts: 7
The Vrooman is an unknown quantity at this point
Re: Master Code

We have the gyro working with the default gyro code, so we know that it can't be an electrical problem.

We took the gyro.c, gyro.h, adc.c, and adc.h from the defualt code so we know that they aren't the problem either.

So here is our user_rountines_fast.c.

Please fix it.

If you can't find anything wrong with it do you have any ideas what other files would make the gyro not work.

Thanks,
Team 1137
Attached Files
File Type: c user_routines_fast.c (9.3 KB, 48 views)
  #7   Spotlight this post!  
Unread 05-02-2007, 13:04
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: Master Code

I see you have commented out the part of the interrupt service routine that deals with the encoder. Make sure you fix that before you start tearing your hair out because the encoders don't work either. :-)

I don't see anything obviously wrong. What leads you to say your gyro code isn't working? And just for completeness, are you sure Process_Data_From_Local_IO() is being called from your main loop?
  #8   Spotlight this post!  
Unread 05-02-2007, 13:42
Kevin Watson's Avatar
Kevin Watson Kevin Watson is offline
La Caņada High School
FRC #2429
Team Role: Mentor
 
Join Date: Jan 2002
Rookie Year: 2001
Location: La Caņada, California
Posts: 1,335
Kevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond repute
Re: Master Code

Quote:
Originally Posted by The Vrooman View Post
We have the gyro working with the default gyro code, so we know that it can't be an electrical problem.

We took the gyro.c, gyro.h, adc.c, and adc.h from the defualt code so we know that they aren't the problem either.

So here is our user_rountines_fast.c.

Please fix it.

If you can't find anything wrong with it do you have any ideas what other files would make the gyro not work.

Thanks,
Team 1137
You have a piece of redundant code that clears the encoder interrupt flags before the encoder code executes. See my comment in user_routines_fast.c. In user_routines_fast_rkw.c I've fixed the problem and re-arranged the ISRs to be more efficient. As I don't know if you're using both serial ports and the number of encoders, you should delete any code for features you're not using. Also, keep the ADC sample rate as low as you can and keep the encoder-generated interrupts as low as possible (a few hundred per second is fine).

-Kevin
Attached Files
File Type: c user_routines_fast.c (9.5 KB, 54 views)
File Type: c user_routines_fast_rkw.c (9.0 KB, 55 views)
__________________
Kevin Watson
Engineer at stealth-mode startup
http://kevin.org
  #9   Spotlight this post!  
Unread 07-02-2007, 17:23
The Vrooman's Avatar
The Vrooman The Vrooman is offline
Registered User
FRC #1137
 
Join Date: Jan 2007
Location: Mathews, Virginia
Posts: 7
The Vrooman is an unknown quantity at this point
Re: Master Code

Thanks Kevin and everybody, we re-assembled all the parts of the code, cam, gyro etc, and now it seems to be working. Its nice to see that we can expect quick help.


The Vrooman, Team 1137
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
V13 Master Code Kingofl337 Programming 2 15-01-2007 22:49
Need: Master Code JamesBrown Programming 1 09-01-2007 21:53
Master code update Eldarion Control System 1 09-03-2006 21:14
Master Code 11? SteveO Programming 5 22-04-2005 19:48
Master Code? HolyOne207 Programming 4 12-01-2005 22:32


All times are GMT -5. The time now is 00:27.

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