Go to Post Winning a competition is great, but seeing kids who never thought they had a chance before suddenly discover a brand new future would be the most amazing experience. - MissInformation [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 12-03-2009, 00:34
Steve Compton Steve Compton is offline
Project Manager, Mentor
FRC #1391
 
Join Date: Feb 2004
Rookie Year: 2001
Location: Philadelphia PA
Posts: 75
Steve Compton is a splendid one to beholdSteve Compton is a splendid one to beholdSteve Compton is a splendid one to beholdSteve Compton is a splendid one to beholdSteve Compton is a splendid one to beholdSteve Compton is a splendid one to behold
Problem with quadrature encoder

I just got his from one of my programmers who is playing with encoders. Can anyone provide some guidance after reading the description below?

Gotta problem... We have used encoders for various things this year.
In each of these cases we have used the encoders to measure position. Just the angle of something.
The encoders also have a "rate" pin on them. It tells us how fast something
is spinning which is what we need for traction control.

We have noted that that the encoder, when measuring "rate", measures
zero after a short time of working correctly. In other words, we spin
the wheel, the rate pin shows a velocity, and then after a short
distance, the rate pin no longer measures velocity (it shows zero).
Then once we stop the wheel, and start spinning it again, the rate will
be measured correctly again for a short distance before falling to zero.

We found a usfirst thread on this that is a month or so old. It says
that an encoder in quadrature (4x) mode (which is what we have), will do
this but if you use the "averaging option" of 1x or 2x it will be fine.
We don't see this. It breaks reliably no mater what averaging we use.
It also says this will be fixed in the next cRIO update. It's not.

Thanks in advance!
  #2   Spotlight this post!  
Unread 12-03-2009, 02:11
Unsung FIRST Hero
Mike Betts Mike Betts is offline
Electrical Engineer
no team
Team Role: Engineer
 
Join Date: Dec 2001
Rookie Year: 1995
Location: Homosassa, FL
Posts: 1,442
Mike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond repute
Re: Problem with quadrature encoder

Steve,

Your post is confusing as to when you are referencing the physical encoder and when you are referencing the encoder vi, yada, yada...

That being said, I assume that you are referencing the LabVIEW software...

I would suggest that your programming team load the "encoder example" project and look at how the "minimum rate" control to the "encoder: config timer" vi affects the functionality...

Regards,

Mike
__________________
Mike Betts

Alumnus, Team 3518, Panthrobots, 2011
Alumnus, Team 177, Bobcat Robotics, 1995 - 2010
LRI, Connecticut Regional, 2007-2010
LRI, WPI Regional, 2009 - 2010
RI, South Florida Regional, 2012 - 2013

As easy as 355/113...
  #3   Spotlight this post!  
Unread 12-03-2009, 06:45
Steve Compton Steve Compton is offline
Project Manager, Mentor
FRC #1391
 
Join Date: Feb 2004
Rookie Year: 2001
Location: Philadelphia PA
Posts: 75
Steve Compton is a splendid one to beholdSteve Compton is a splendid one to beholdSteve Compton is a splendid one to beholdSteve Compton is a splendid one to beholdSteve Compton is a splendid one to beholdSteve Compton is a splendid one to behold
Re: Problem with quadrature encoder

Thanks, Mike! I. I'll see if I can get your suggestion worked on, as well as trying to get more precise language in case I need to send something back out to you all. Appreciate the help.
  #4   Spotlight this post!  
Unread 12-03-2009, 08:25
Greg McKaskle Greg McKaskle is offline
Registered User
FRC #2468 (Team NI & Appreciate)
 
Join Date: Apr 2008
Rookie Year: 2008
Location: Austin, TX
Posts: 4,756
Greg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond repute
Re: Problem with quadrature encoder

Definitely compare to the example. The bug by the way is only present with 4x encoding with no averaging. 4x works with as little as 2 pts of averaging and 1x and 2x work with or without. Work of course has to include the behavior of the minimum rate parameter, and for that the docs help and the example should drive it home.

Greg McKaskle
  #5   Spotlight this post!  
Unread 12-03-2009, 08:28
Joe Ross's Avatar Unsung FIRST Hero
Joe Ross Joe Ross is offline
Registered User
FRC #0330 (Beachbots)
Team Role: Engineer
 
Join Date: Jun 2001
Rookie Year: 1997
Location: Los Angeles, CA
Posts: 8,600
Joe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond repute
Re: Problem with quadrature encoder

I think you found this bug: http://forums.usfirst.org/showpost.p...5&postcount=34
  #6   Spotlight this post!  
Unread 12-03-2009, 10:02
Steve Compton Steve Compton is offline
Project Manager, Mentor
FRC #1391
 
Join Date: Feb 2004
Rookie Year: 2001
Location: Philadelphia PA
Posts: 75
Steve Compton is a splendid one to beholdSteve Compton is a splendid one to beholdSteve Compton is a splendid one to beholdSteve Compton is a splendid one to beholdSteve Compton is a splendid one to beholdSteve Compton is a splendid one to behold
Re: Problem with quadrature encoder

Thanks Mike, Greg and Joe. My programmers think it's something to do with the FPGA counters. We're using 128 bit grayhills, but we've seen the same results when we were using ultrasonics earlier in the season:

quote from progammer
"With the Ultrasonics in particular I used several methods. Whenever I used the
FPGA counters, things broke. These are the same counters the encoders use and we are getting similar dysfunction."

Also, we loaded the out of the box 'encoder example' and this is the result:

"so I just loaded up the example out of the box. It broke the same way,
no matter what the averaging and minimum sample settings."

any thoughts?
  #7   Spotlight this post!  
Unread 12-03-2009, 10:32
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: Problem with quadrature encoder

Does the 4x bug affect C++ code as well, or is this strictly a LabView issue?
  #8   Spotlight this post!  
Unread 12-03-2009, 10:57
Steve Compton Steve Compton is offline
Project Manager, Mentor
FRC #1391
 
Join Date: Feb 2004
Rookie Year: 2001
Location: Philadelphia PA
Posts: 75
Steve Compton is a splendid one to beholdSteve Compton is a splendid one to beholdSteve Compton is a splendid one to beholdSteve Compton is a splendid one to beholdSteve Compton is a splendid one to beholdSteve Compton is a splendid one to behold
Re: Problem with quadrature encoder

Both. Seems to be the timer, I think, in the FPGA
  #9   Spotlight this post!  
Unread 12-03-2009, 23:21
Greg McKaskle Greg McKaskle is offline
Registered User
FRC #2468 (Team NI & Appreciate)
 
Join Date: Apr 2008
Rookie Year: 2008
Location: Austin, TX
Posts: 4,756
Greg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond repute
Re: Problem with quadrature encoder

Quote:
Does the 4x bug affect C++ ?
I can't say definitively that there was never a bug with encoders on C++ development, but the 4x encoding bug we are describing is specific to LV.

Greg McKaskle
  #10   Spotlight this post!  
Unread 13-03-2009, 06:30
Steve Compton Steve Compton is offline
Project Manager, Mentor
FRC #1391
 
Join Date: Feb 2004
Rookie Year: 2001
Location: Philadelphia PA
Posts: 75
Steve Compton is a splendid one to beholdSteve Compton is a splendid one to beholdSteve Compton is a splendid one to beholdSteve Compton is a splendid one to beholdSteve Compton is a splendid one to beholdSteve Compton is a splendid one to behold
Re: Problem with quadrature encoder

Thanks, Greg. I did all that research too to discover the same in these threads, so was surprised to have my programmer say it could happen in both. How about the fact that we also got 'zeroing' when playing with ultrasonics? Does that tell you anything? I'm wondering if we aren't getting a battery voltage number as a divisor (like in the analog input issues discussed in a thread for WPI libs.)?
  #11   Spotlight this post!  
Unread 13-03-2009, 10:29
Greg McKaskle Greg McKaskle is offline
Registered User
FRC #2468 (Team NI & Appreciate)
 
Join Date: Apr 2008
Rookie Year: 2008
Location: Austin, TX
Posts: 4,756
Greg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond repute
Re: Problem with quadrature encoder

I'm not going to be much help until Monday as I'm at a regional. The latest head slap with C++ libs and unique to those had to do with synchronization that wasn't enabled. I believe that was what caused the analogs to mix channels and confuse channel data if polled too often. I think it would occasionally cause other symptoms.

Is anyone else able to reproduce the issue, and do you have any insight into a workaround or root cause?

Greg McKaskle
  #12   Spotlight this post!  
Unread 13-03-2009, 18:20
Steve Compton Steve Compton is offline
Project Manager, Mentor
FRC #1391
 
Join Date: Feb 2004
Rookie Year: 2001
Location: Philadelphia PA
Posts: 75
Steve Compton is a splendid one to beholdSteve Compton is a splendid one to beholdSteve Compton is a splendid one to beholdSteve Compton is a splendid one to beholdSteve Compton is a splendid one to beholdSteve Compton is a splendid one to behold
Re: Problem with quadrature encoder

Thanks, Greg. Hope you get a chance to breather once in a while at the competition - I know our NI guy at Trenton (I'm embarrassed to say I forget his name) was instrumental in helping tons of teams deconstruct and solve all kinds of challenges.

Do you think the issue that arose with analog could possible also happen similarly with the digital inputs? I'm afraid I know too little about this part of our work to really be able to think as critically as would be useful here!
  #13   Spotlight this post!  
Unread 14-03-2009, 08:44
Ken Streeter's Avatar
Ken Streeter Ken Streeter is offline
Let the MAYHEM begin!
FRC #1519 (Mechanical Mayhem)
Team Role: Engineer
 
Join Date: Feb 2005
Rookie Year: 2005
Location: Team: Milford, NH; Me: Bedford, NH
Posts: 475
Ken Streeter has a reputation beyond reputeKen Streeter has a reputation beyond reputeKen Streeter has a reputation beyond reputeKen Streeter has a reputation beyond reputeKen Streeter has a reputation beyond reputeKen Streeter has a reputation beyond reputeKen Streeter has a reputation beyond reputeKen Streeter has a reputation beyond reputeKen Streeter has a reputation beyond reputeKen Streeter has a reputation beyond reputeKen Streeter has a reputation beyond repute
Re: Problem with quadrature encoder

Quote:
Originally Posted by Jared341 View Post
Does the 4x bug affect C++ code as well, or is this strictly a LabView issue?
The problem with incorrect rates was present in both the C++ and the LabVIEW code. A workaround for this was released in the most recent official update to WPILib (for both C++ and LabVIEW). For C++, I know this was addressed in "C/C++ Update 3.0.1718". (See http://first.wpi.edu/FRC/frcupdates.html ) Discussion on this matter can be found at http://forums.usfirst.org/showpost.php?p=26395 as Joe Ross mentioned.

However, due to the manner in which the length of the "most recent" pulse is used to determine the rate, the fact that the encoder pulse widths are asymmetric leads to significant rate errors when using 2x and 4x pulse decoding. Accordingly, I personally would suggest using 1x decoding when using the encoders for rate measurement.

A few people are working on a software workaround to the pulse asymmetry issue by averaging a greater number of periods, which has achieved some improvement, but not as much as expected. (See http://forums.usfirst.org/showthread.php?t=12218 for further discussion.)
__________________
Ken Streeter - Team 1519 - Mechanical Mayhem (Milford Area Youth Homeschoolers Enriching Minds)
2015 NE District Winners with 195 & 2067, 125 & 1786, 230 & 4908, and 95 & 1307
2013 World Finalists & Archimedes Division Winners with 33 & 469
2013 & 2012 North Carolina Regional Winners with teams 435 & 4828 and 1311 & 2642
2011, 2010, 2006 Granite State Regional Winners with teams 175 & 176, 1073 & 1058, and 1276 & 133
Team 1519 Video Gallery - including Chairman's Video, and the infamous "Speed Racer!"
  #14   Spotlight this post!  
Unread 14-03-2009, 11:16
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: Problem with quadrature encoder

Quote:
Originally Posted by Ken Streeter View Post
The problem with incorrect rates was present in both the C++ and the LabVIEW code. A workaround for this was released in the most recent official update to WPILib (for both C++ and LabVIEW). For C++, I know this was addressed in "C/C++ Update 3.0.1718". (See http://first.wpi.edu/FRC/frcupdates.html ) Discussion on this matter can be found at http://forums.usfirst.org/showpost.php?p=26395 as Joe Ross mentioned.

However, due to the manner in which the length of the "most recent" pulse is used to determine the rate, the fact that the encoder pulse widths are asymmetric leads to significant rate errors when using 2x and 4x pulse decoding. Accordingly, I personally would suggest using 1x decoding when using the encoders for rate measurement.

A few people are working on a software workaround to the pulse asymmetry issue by averaging a greater number of periods, which has achieved some improvement, but not as much as expected. (See http://forums.usfirst.org/showthread.php?t=12218 for further discussion.)
Great info. I have definitely noticed the "noise" in the rate signal from our encoders at 4x as well, and got around the problem by low pass filtering. But asymmetry coming into play makes perfect sense.
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
Help Programming a Quadrature Encoder programmr Programming 17 20-06-2008 10:40
Quadrature shaft encoder source billbo911 Kit & Additional Hardware 7 06-01-2008 19:52
Encoder Problem DustinB_3 Programming 22 03-01-2007 20:42
Turning a gear-tooth sensor into a quadrature output encoder Jared Russell Programming 4 18-01-2006 22:19
Strange Encoder Problem AIBob Electrical 3 20-02-2005 22:20


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

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