Go to Post Robotics is really preparing us for jobs at NASA. Look. We're past deadline, overweight, overbudget, and our project doesn't even work! - Oblarg [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 29-11-2005, 17:40
Windward's Avatar
Windward Windward is offline
Registered User
FRC #1452
Team Role: Programmer
 
Join Date: Nov 2005
Rookie Year: 2004
Location: So Cal
Posts: 88
Windward is an unknown quantity at this point
Encoder help

Hello,
We have been trying to use Kevin Watson's encoder code for our robot, but we can't tell if it is working. I've used Mr. Watson's code, unmodified and loaded it onto the robot. Even when I spin the encoder by hand, it doesn't count or print it out.

I've tested with different encoders and tried to have the electrician on the team re-wire it.

Any advice?

-Windward Robotics 1452
  #2   Spotlight this post!  
Unread 29-11-2005, 18:01
Mike's Avatar
Mike Mike is offline
has common ground with Matt Krass
AKA: Mike Sorrenti
FRC #0237 (Sie-H2O-Bots (See-Hoe-Bots) [T.R.I.B.E.])
Team Role: Programmer
 
Join Date: Dec 2004
Rookie Year: 2004
Location: Watertown, CT
Posts: 1,003
Mike has a reputation beyond reputeMike has a reputation beyond reputeMike has a reputation beyond reputeMike has a reputation beyond reputeMike has a reputation beyond reputeMike has a reputation beyond reputeMike has a reputation beyond reputeMike has a reputation beyond reputeMike has a reputation beyond reputeMike has a reputation beyond reputeMike has a reputation beyond repute
Re: Encoder help

First step to solving any programming problem, is to isolate the problem. How do you know the problem is with Kevin's code... and you don't have a problem with your encoder?

With that being said, have you tried hooking the encoder up to an oscilloscope? That would tell you whether it is a bad encoder, or bad code.
__________________
http://www.mikesorrenti.com/
  #3   Spotlight this post!  
Unread 29-11-2005, 19:58
Bharat Nain's Avatar
Bharat Nain Bharat Nain is offline
Registered User
no team
Team Role: Alumni
 
Join Date: Jan 2004
Rookie Year: 2003
Location: New York
Posts: 2,000
Bharat Nain has a reputation beyond reputeBharat Nain has a reputation beyond reputeBharat Nain has a reputation beyond reputeBharat Nain has a reputation beyond reputeBharat Nain has a reputation beyond reputeBharat Nain has a reputation beyond reputeBharat Nain has a reputation beyond reputeBharat Nain has a reputation beyond reputeBharat Nain has a reputation beyond reputeBharat Nain has a reputation beyond reputeBharat Nain has a reputation beyond repute
Send a message via AIM to Bharat Nain Send a message via MSN to Bharat Nain
Re: Encoder help

Did you plug your it into the right pins? The correct way to wire it is on Kevins website in the encoder FAQ section. Check his encoder.h/reamde files to see where to plug in the right pins. Follow all the instructins carefully and then follow through and see why it is not working. His unedited code has always worked flawlessly for me.
__________________
-= Bharat Nain =-

Whatever you do, you need courage. Whatever course you decide upon, there is always someone to tell you that you are wrong. There are always difficulties arising that tempt you to believe your critics are right. To map out a course of action and follow it to an end requires some of the same courage that a soldier needs. Peace has its victories, but it takes brave men and women to win them. - Ralph Waldo Emerson
  #4   Spotlight this post!  
Unread 29-11-2005, 20:43
devicenull devicenull is offline
Robot? We need a robot?
no team
 
Join Date: Sep 2004
Rookie Year: 1234
Location: n/a
Posts: 359
devicenull is just really nicedevicenull is just really nicedevicenull is just really nicedevicenull is just really nicedevicenull is just really nice
Re: Encoder help

Also, how are you printing it out? If you are just using %i, be aware it will cause some strange things to happen. I believe the proper thing to use is %li, but I can't exactly remember. I do remember spending about a week trying to debug why the encoder worked eletrically, but it wasn't changing the variables in the code.
  #5   Spotlight this post!  
Unread 29-11-2005, 20:51
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: Encoder help

Quote:
Originally Posted by Windward
Hello,
We have been trying to use Kevin Watson's encoder code for our robot, but we can't tell if it is working. I've used Mr. Watson's code, unmodified and loaded it onto the robot. Even when I spin the encoder by hand, it doesn't count or print it out.

I've tested with different encoders and tried to have the electrician on the team re-wire it.

Any advice?

-Windward Robotics 1452
With as much detail as you can, describe how you've wired the encoders to the robot controller. Also, which encoders are you using?

-Kevin
__________________
Kevin Watson
Engineer at stealth-mode startup
http://kevin.org
  #6   Spotlight this post!  
Unread 01-12-2005, 17:14
Windward's Avatar
Windward Windward is offline
Registered User
FRC #1452
Team Role: Programmer
 
Join Date: Nov 2005
Rookie Year: 2004
Location: So Cal
Posts: 88
Windward is an unknown quantity at this point
Re: Encoder help

Quote:
Originally Posted by Kevin Watson
With as much detail as you can, describe how you've wired the encoders to the robot controller. Also, which encoders are you using?

-Kevin
Well its the stock code (downloaded from http://kevin.org/frc/frc_encoder.zip).

The encoders are Grayhill 63R128 (recommended from http://kevin.org/frc/encoder_faq.html)

The encoder is plugged in to Digital In/Out 1 and 6, with the power and ground connected to the Digital In/Out 5. Is this a possible problem?

The only other problem I could possibly see is that the FRC Robot Controller is from 2004. Could this be another possible problem?

Thank you in advance,

-Windward Robotics 1452

--
Update: We think it might be a problem with the computer. Whenever we program it the yellow program state is constantly orange. Any advice? We are going to try to steal the 2005 FRC Robot Controller from the builders.

Last edited by Windward : 01-12-2005 at 17:27.
  #7   Spotlight this post!  
Unread 01-12-2005, 20:14
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: Encoder help

Quote:
Originally Posted by Windward
Update: We think it might be a problem with the computer. Whenever we program it the yellow program state is constantly orange. Any advice? We are going to try to steal the 2005 FRC Robot Controller from the builders.
Does it do this with the .hex file that's included in the .zip archive?

-Kevin
__________________
Kevin Watson
Engineer at stealth-mode startup
http://kevin.org
  #8   Spotlight this post!  
Unread 03-12-2005, 19:04
RbtGal1351's Avatar
RbtGal1351 RbtGal1351 is offline
~La Reina de los Robots~
AKA: Stephanie
FRC #1351 (TKO)
Team Role: Programmer
 
Join Date: Dec 2004
Rookie Year: 2004
Location: San Jose, CA
Posts: 166
RbtGal1351 is a splendid one to beholdRbtGal1351 is a splendid one to beholdRbtGal1351 is a splendid one to beholdRbtGal1351 is a splendid one to beholdRbtGal1351 is a splendid one to beholdRbtGal1351 is a splendid one to beholdRbtGal1351 is a splendid one to behold
Send a message via AIM to RbtGal1351 Send a message via MSN to RbtGal1351
Re: Encoder help

Try making the variables and functions that are longs ints instead.
e.g. instead of "long Get_Left_Encoder_Count()" change it to "int Get_Left_Encoder_Count()"

I had a problem much like that before; none of my variables (longs) would change ever. Then I changed them to ints and it worked.

Hope that helps,
~Stephanie
__________________
2004 Founding member and Arm leader, 2005 Lead programmer, 2006 Controls leader, 2007 Project Manager/President
Thanks for making FIRST such a great experience for me. I'm no longer on 1351, and I'm not currently planning to mentor team 97, but FIRST has meant so much in getting me to where I am now, in life and at MIT, class of 2011.
I met Billfred! He recognized me!
SVR 04: 11th seed - Highest Rookie Seed - Semifinalists w/ 1120 and 568 - GM Industrial Design Award
SVR 05: Semifinalists w/ 8 and 766
SVR 06: 6th seed - Quarterfinalists w/ 368 and 1072
Davis 06: 1st seed - Quarterfinalists w/ 649 and 100 - KPCB Entrepreneurship Award
SVR 07: 36th seed
David 07: 4th seed - Semifinalists w/ 1280 and 692 - Johnson and Johnson Sportsmanship Award
  #9   Spotlight this post!  
Unread 03-12-2005, 21:54
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: Encoder help

Quote:
Originally Posted by RbtGal1351
I had a problem much like that before; none of my variables (longs) would change ever. Then I changed them to ints and it worked.
I suspect they were changing as they should, and the problem was that they just weren't printing correctly. printf isn't very friendly, and expects to print ints unless you can convince it otherwise. If you try to print a long the way you print most things, you just get the top couple of bytes of the value, which is usually going to end up being either 0 or -1.
  #10   Spotlight this post!  
Unread 06-12-2005, 16:58
Windward's Avatar
Windward Windward is offline
Registered User
FRC #1452
Team Role: Programmer
 
Join Date: Nov 2005
Rookie Year: 2004
Location: So Cal
Posts: 88
Windward is an unknown quantity at this point
Re: Encoder help

Sorry about posting only on Tuesdays and Thursday, until the competition starts that is the only time I can work on it.

I am pretty sure there is a problem with the printfs. When I basically added the same statement (minus the ++counter and just while 1==1) into User_initialization it worked properly; I believe when I added the ++counter part of the original printf in User_initialization it didn't work.

I assume I'm having printf problems. Could this be compiler/cable related (we are using a USB to Serial converter)

Thanks.
  #11   Spotlight this post!  
Unread 06-12-2005, 17:12
Windward's Avatar
Windward Windward is offline
Registered User
FRC #1452
Team Role: Programmer
 
Join Date: Nov 2005
Rookie Year: 2004
Location: So Cal
Posts: 88
Windward is an unknown quantity at this point
Re: Encoder help

Quote:
Originally Posted by Kevin Watson
Does it do this with the .hex file that's included in the .zip archive?

-Kevin

Yes it still remains yellow, and still doesn't print.
  #12   Spotlight this post!  
Unread 07-12-2005, 02:05
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: Encoder help

Quote:
Originally Posted by Windward
Yes it still remains yellow, and still doesn't print.
I haven't a clue what the problem is. I just loaded encoder.hex, dated 1-6-05, into a 2004 full-size robot controller and it worked as advertised. Grasping at straws, what version of the loader and master code are you using? Did you try resetting the RC after loading? If so, did the behavor change? If not, can you do so and report back?

-Kevin
__________________
Kevin Watson
Engineer at stealth-mode startup
http://kevin.org
  #13   Spotlight this post!  
Unread 13-12-2005, 16:55
Windward's Avatar
Windward Windward is offline
Registered User
FRC #1452
Team Role: Programmer
 
Join Date: Nov 2005
Rookie Year: 2004
Location: So Cal
Posts: 88
Windward is an unknown quantity at this point
Re: Encoder help

Quote:
Originally Posted by Kevin Watson
I haven't a clue what the problem is. I just loaded encoder.hex, dated 1-6-05, into a 2004 full-size robot controller and it worked as advertised. Grasping at straws, what version of the loader and master code are you using? Did you try resetting the RC after loading? If so, did the behavor change? If not, can you do so and report back?

-Kevin
The version I got from your website is dated 1-2-05.
IFI loader is 1.0.10
After I hit restart on the CPU, "IFI>" comes up in the COM4 Terminal but no encoder output using the precompiled .hex file.

Although after pressing reset, the Program Light state becomes green.
  #14   Spotlight this post!  
Unread 13-12-2005, 17:27
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: Encoder help

Quote:
Originally Posted by Windward
The version I got from your website is dated 1-2-05.
IFI loader is 1.0.10
After I hit restart on the CPU, "IFI>" comes up in the COM4 Terminal but no encoder output using the precompiled .hex file.

Although after pressing reset, the Program Light state becomes green.
Being clueless myself, I called the folks at IFI to see if they might have some insight into what's going on and they're of the opinion that your USB to serial converter is wonky. Do you have a PC with a real serial port you can try? Anyway, I'll send you a private message with information on who to contact at IFI for help.

-Kevin
__________________
Kevin Watson
Engineer at stealth-mode startup
http://kevin.org

Last edited by Kevin Watson : 13-12-2005 at 17:36. Reason: Icky grammer.
  #15   Spotlight this post!  
Unread 13-12-2005, 20:17
Joe Johnson's Avatar Unsung FIRST Hero
Joe Johnson Joe Johnson is offline
Engineer at Medrobotics
AKA: Dr. Joe
FRC #0088 (TJ2)
Team Role: Engineer
 
Join Date: May 2001
Rookie Year: 1996
Location: Raynham, MA
Posts: 2,648
Joe Johnson has a reputation beyond reputeJoe Johnson has a reputation beyond reputeJoe Johnson has a reputation beyond reputeJoe Johnson has a reputation beyond reputeJoe Johnson has a reputation beyond reputeJoe Johnson has a reputation beyond reputeJoe Johnson has a reputation beyond reputeJoe Johnson has a reputation beyond reputeJoe Johnson has a reputation beyond reputeJoe Johnson has a reputation beyond reputeJoe Johnson has a reputation beyond repute
Re: Encoder help

Quote:
Originally Posted by Kevin Watson
...I called the folks at IFI to see if they might have some insight into what's going on and they're of the opinion that your USB to serial converter is wonky. ...

-Kevin
Whoa! Really?

The USB to Serial is good enough to download code but not to talk to the printf?

If that wasn't enough, he also says that his terminal program shows a "IFI>" on the screen.

Why the "IFI>" but not the stuff from the printf?

I have no clue what it is, but I will bet a case a Mt. Dew (at even odds) against it being the USB to Serial device's fault.

How about this? Is it possible that the printf is sending data to a different serial port on the controller than the one that the "IFI>" message is being sent?

Joe J.
__________________
Joseph M. Johnson, Ph.D., P.E.
Mentor
Team #88, TJ2
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
Encoder Output Problems Mike Electrical 5 25-11-2005 21:43
encoder vs. motor stephenthe1 Programming 55 06-01-2005 22:07
Updated Encoder Code Available Kevin Watson Programming 2 04-01-2005 01:00
how to add steps in the provided encoder program for the edu Zaramel2002 Programming 3 11-02-2004 08:35


All times are GMT -5. The time now is 14:04.

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