Go to Post I Don't like to think in the Box so i try not to make robots look like them. - Tytus Gerrish [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 06-12-2007, 20:25
Qbranch Qbranch is offline
wow college goes fast.
AKA: Alex
FRC #1024 (Kil-A-Bytes)
Team Role: Alumni
 
Join Date: Apr 2006
Rookie Year: 2006
Location: Indianapolis
Posts: 1,174
Qbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond repute
Re: Limitless Potentiometers

Just this past year team 1024 used a pair of MA2 Absolute Rotary Encoders from US Digital on our drivetrain.

Seriously, I know everyone hears analog and thinks totally noise immune. Really, with a tiny bit of smart EMF design it wasnt a problem. However, I know personally I'd rather use a digital optical shaft encoder, but unfortunately our robot this past year was really fast and to get any kind of resolution out of the encoders the frequencies got rediculous at the top end, so much so it was impossible to track without losing counts.

So, hence the move the the MA2. The driver took just one evening to write, and works like a charm. Instead of having an interrupt in the multiples of KHz, we only had to sample the encoder at 100Hz. Best of all, you get the ability to handle a high top-end RPM without sacrificing low-end RPM positioning accuracy (our robot last year could position +/-0.05 inches at the frame).

Again, as long as you can do a decent EMF design to keep the analog signals from the encoders safe, they work like a charm. Definitely worth your time to at least research.

Questions? Post.

-q
__________________
Electrical Engineer Illini
1024 | Programmer '06, '07, '08 | Driver '08
  #2   Spotlight this post!  
Unread 07-12-2007, 00:20
Guy Davidson Guy Davidson is offline
Registered User
AKA: formerly sumadin
FRC #0008 (Paly Robotics)
Team Role: Alumni
 
Join Date: Mar 2005
Rookie Year: 2005
Location: Ra'anana, Israel
Posts: 660
Guy Davidson is a splendid one to beholdGuy Davidson is a splendid one to beholdGuy Davidson is a splendid one to beholdGuy Davidson is a splendid one to beholdGuy Davidson is a splendid one to beholdGuy Davidson is a splendid one to beholdGuy Davidson is a splendid one to beholdGuy Davidson is a splendid one to behold
Send a message via ICQ to Guy Davidson Send a message via AIM to Guy Davidson Send a message via MSN to Guy Davidson
Re: Limitless Potentiometers

Quote:
Originally Posted by Qbranch View Post
Just this past year team 1024 used a pair of MA2 Absolute Rotary Encoders from US Digital on our drivetrain.

Seriously, I know everyone hears analog and thinks totally noise immune. Really, with a tiny bit of smart EMF design it wasnt a problem. However, I know personally I'd rather use a digital optical shaft encoder, but unfortunately our robot this past year was really fast and to get any kind of resolution out of the encoders the frequencies got rediculous at the top end, so much so it was impossible to track without losing counts.

So, hence the move the the MA2. The driver took just one evening to write, and works like a charm. Instead of having an interrupt in the multiples of KHz, we only had to sample the encoder at 100Hz. Best of all, you get the ability to handle a high top-end RPM without sacrificing low-end RPM positioning accuracy (our robot last year could position +/-0.05 inches at the frame).

Again, as long as you can do a decent EMF design to keep the analog signals from the encoders safe, they work like a charm. Definitely worth your time to at least research.

Questions? Post.

-q
Sorry to hijack the thread, but I'm wondering how you would tell what direction you moved. I don't doubt this can work very well for something that only goes under a revolution. However, let's say you moved from 100 degrees to 200. How do you know if you moved 100 forwards or 260 back?

Thanks.
  #3   Spotlight this post!  
Unread 07-12-2007, 00:59
AdamHeard's Avatar
AdamHeard AdamHeard is offline
Lead Mentor
FRC #0973 (Greybots)
Team Role: Mentor
 
Join Date: Oct 2004
Rookie Year: 2004
Location: Atascadero
Posts: 5,506
AdamHeard has a reputation beyond reputeAdamHeard has a reputation beyond reputeAdamHeard has a reputation beyond reputeAdamHeard has a reputation beyond reputeAdamHeard has a reputation beyond reputeAdamHeard has a reputation beyond reputeAdamHeard has a reputation beyond reputeAdamHeard has a reputation beyond reputeAdamHeard has a reputation beyond reputeAdamHeard has a reputation beyond reputeAdamHeard has a reputation beyond repute
Send a message via AIM to AdamHeard
Re: Limitless Potentiometers

I found the best method is simply to use a POT that has more turns than is required. For both joints of our arm this year, the arm would hit the frame or the ground before the shaft would break. Now, we obviously has limits so this wouldn't happen, but we never had to worry about a POT breaking.
  #4   Spotlight this post!  
Unread 07-12-2007, 01:20
dtengineering's Avatar
dtengineering dtengineering is offline
Teaching Teachers to Teach Tech
AKA: Jason Brett
no team (British Columbia FRC teams)
Team Role: Mentor
 
Join Date: Jan 2005
Rookie Year: 2004
Location: Vancouver, BC
Posts: 1,829
dtengineering has a reputation beyond reputedtengineering has a reputation beyond reputedtengineering has a reputation beyond reputedtengineering has a reputation beyond reputedtengineering has a reputation beyond reputedtengineering has a reputation beyond reputedtengineering has a reputation beyond reputedtengineering has a reputation beyond reputedtengineering has a reputation beyond reputedtengineering has a reputation beyond reputedtengineering has a reputation beyond repute
Re: Limitless Potentiometers

Encoders don't need to be hooked directly to the RC. A little custom circuit using a PIC microcontroller (or other device... consider a VEX RC) can decode several encoder signals.

This means that while you might still use interrupts on the RC to count the rotations, they need not be as frequent as with a direct connection, nor do you need to worry about tracking the timing to determine direction using the RC. Heck, you could even have the custom circuit send a serial data pack of shaft position and velocity to the RC upon request if you really wanted to get creative.

We had a circuit set up like this for the gear tooth encoders a couple years back in the event we needed to use it, and used a similar... although simpler board from banebots with the encoders for the 56mm gearboxes this past year.

Using the banebots boards we had no... well... almost no... problems reading inputs from four encoders. For joints with less than about 270 or 300 degrees rotation, pots work great. (And sliding pots work great, too for linear applications of a few inches or so.... although now that I think of it... why couldn't a long length of nichrome serve as a very long linear pot...?) But in any case for continuous rotation, making an encoder work will be more than worth your time.

Jason
  #5   Spotlight this post!  
Unread 07-12-2007, 01:23
slavik262's Avatar
slavik262 slavik262 is offline
We do what we must because we can.
AKA: Matt Kline
FRC #0537 (Charger Robotics)
Team Role: Alumni
 
Join Date: Jan 2007
Rookie Year: 2007
Location: Sussex, WI
Posts: 310
slavik262 is a splendid one to beholdslavik262 is a splendid one to beholdslavik262 is a splendid one to beholdslavik262 is a splendid one to beholdslavik262 is a splendid one to beholdslavik262 is a splendid one to beholdslavik262 is a splendid one to behold
Send a message via AIM to slavik262
Re: Limitless Potentiometers

Sorry for the hijack, but...

Have you ever looked into using WPILib?

I know you said you wanted to stay away from encoders, but WPILib makes all the interrupts you mentioned painfully easy and very hard to screw up. Our team has been using pots for the last few years, but after beginning to use WPILib, we switched to encoders with relatively few problems.
__________________
  #6   Spotlight this post!  
Unread 07-12-2007, 11:42
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,567
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: Limitless Potentiometers

Quote:
Originally Posted by sumadin View Post
Sorry to hijack the thread, but I'm wondering how you would tell what direction you moved. I don't doubt this can work very well for something that only goes under a revolution. However, let's say you moved from 100 degrees to 200. How do you know if you moved 100 forwards or 260 back?

Thanks.
You choose a sampling rate such that you can never move more then 180 degrees per sample. If you see a change less then 180, you're moving forward, if you see a change greater then 180, you're moving back.

We used continuous turn pots for our drive last year very successfully. We followed the directions in this white paper: http://www.chiefdelphi.com/media/papers/1743
  #7   Spotlight this post!  
Unread 09-12-2007, 20:36
Qbranch Qbranch is offline
wow college goes fast.
AKA: Alex
FRC #1024 (Kil-A-Bytes)
Team Role: Alumni
 
Join Date: Apr 2006
Rookie Year: 2006
Location: Indianapolis
Posts: 1,174
Qbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond repute
Re: Limitless Potentiometers

Quote:
Originally Posted by sumadin View Post
Sorry to hijack the thread, but I'm wondering how you would tell what direction you moved. I don't doubt this can work very well for something that only goes under a revolution. However, let's say you moved from 100 degrees to 200. How do you know if you moved 100 forwards or 260 back?

Thanks.
Before I even start, here's the, well, you might call it the Nyquist rate for sampling these rotary analog encoders (aka Limitless Pots). Unless you use adaptive sampling rates (DO NOT if you are using a PID and don't want to have dynamic constants on the terms) you have to sample the voltage about four times per revolution, or else you won't know which way you went (there may be a more efficient way but this is what I used last season). Therefore, I suggest you figure how many RPM the shaft you are coupled to could do in the worst possible situation, then add some to that (use your engineering sense). Obviously if you miss a revolution you'll be in trouble and have problems like you mentioned above.

I drew a diagram (using my graphic tablet I got on Black Friday... ) that explains how this system works. Essentialy you break the waveform that the analog encoder outputs into sections, and do a state-based decode. Since you're sampling at a rate four+ times that of the rate of revolution, you will be able to detect a high-contrast change in the values comming back from the analog encoder and be able to figure that you went from a high-to-low or low-to-high transition, thus indicating the direction in which you moved.

Aside from that, the rest of the system functions on deltas: you add or subtract how much the values have changed depending on which direction the analog encoder is moving.

Here's the code snippet that handles one of the analog encoders (there were two) on our robot. This function was called at a rate of 100Hz using a CCP module for timing (it also was running a high-performance pwm signal for the pid'ed traction motors on the robot):

Code:
void encoder_left_handler(void)
{
	if(ServoOn)	//if servos running, sample encoder
	{
		leftencoderpos = Get_Analog_Value(LEFTENCODER);		//get value from other encoder
		if (leftencoderpos <= 253)
		{
			leftencoderstate = 0;	//state a
		}
		else if (leftencoderpos <= 505)
		{
			leftencoderstate = 1;	//state b
		}
		else if (leftencoderpos <= 757)
		{
			leftencoderstate = 2;	//state c
		}
		else
		{
			leftencoderstate = 3;	//state d
		}
		if (leftencoderstate == 0 && oldleftencoderstate == 3)	//from top to bottom, rev
		{
			//going backwards
			leftencoder -= (int)((1009 - oldleftencoderpos) + (leftencoderpos-2));
		}
		else if (leftencoderstate == 3 && oldleftencoderstate == 0)	//from bottom to top, fwd
		{
			//going forward
			leftencoder += (int)((1009 - leftencoderpos) + (oldleftencoderpos-2));
		}
		else	//intra-state position calculation
		{
			if (leftencoderpos < oldleftencoderpos)
			{
				//goingfwd, intra state
				leftencoder += (int)(oldleftencoderpos - leftencoderpos);
			}
			else
			{
				//goingbkwd, intra state
				leftencoder -= (int)(leftencoderpos - oldleftencoderpos);
			}
		}
	
	
	
	
	

		oldleftencoderstate = leftencoderstate;	//save encoder state
		oldleftencoderpos = leftencoderpos;	//save old encoderposition
	}	//end if servo on
//...
This system works very very well, we used it to run a 100Hz update rate PID (as I stated before, we were feeding the Victors a 16-bit PWM signal at 100Hz as well as opposed to the standard 8-bit 39.37Hz) which performed with silky-smooth motion control during our post-season autonomous work. I definitely reccomment analog encoders. As long as you show 'em a little love with shielded cables, smart wiring (keep the wires short!), and a little software know how, you get fantastic positional accuracy without the need to handle extreme high frequency (in the KHz) interrupts at high speed.

Questions? Post!

-q
Attached Thumbnails
Click image for larger version

Name:	continuous rotation decode schema.JPG
Views:	58
Size:	45.1 KB
ID:	5827  
__________________
Electrical Engineer Illini
1024 | Programmer '06, '07, '08 | Driver '08
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
1 Megohm Potentiometers phrontist Electrical 9 22-02-2005 02:05
Flaky Potentiometers theDoctor Electrical 4 21-02-2005 21:08
Using Potentiometers arpus maximus Electrical 5 20-11-2004 16:45
Q about potentiometers Nick R. Electrical 13 07-02-2004 09:13
Potentiometers Ulibrium Technical Discussion 1 23-01-2002 19:41


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