OCCRA
Go to Post We also have a " big daddy" hand riveter. In my estimation one could have assembled the George Washington bridge with it. - DonRotolo [more]
Home
Go Back   Chief Delphi > Technical > Electrical
CD-Events   CD-Media   CD-Spy   FRC-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 02-21-2005, 05:16 PM
theDoctor's Avatar
theDoctor theDoctor is offline
Registered User
AKA: Kelly Butcher
#1502 (Technical Difficulties)
Team Role: Programmer
 
Join Date: Jun 2004
Rookie Year: 2005
Location: MI
Posts: 3
theDoctor is an unknown quantity at this point
Flaky Potentiometers

We're using two potentiometers on the RC analog inputs to measure angles on our arm. I've been monitoring their values through printfs. Sometimes I get lovely and normal values (0-1023), and sometimes I get very strange ones. In strange mode, the values always increase, but in this order: 0 64 192 448 960 1984 4032 7680 7936 8128 (...) The first few numbers follow an obvious pattern but I don't know where the 7000 ones come from. And after that it gets less regular. It goes up to numbers like 32768 and above.

This confuses us in programming, because the function that reads the analog inputs should never return a number above 1023, so it looks like interference. We've wiggled our pwm cables and so on but it doesn't make things better. Um...I assume this is an electrical problem. Does anyone know where this is coming from?

Thanks.
  #2   Spotlight this post!  
Unread 02-21-2005, 06:30 PM
Matt Krass's Avatar
Matt Krass Matt Krass is offline
"Old" and Cranky. Get off my lawn!
AKA: Dark Ages
FRC #0263 (Sachem Aftershock)
Team Role: Mentor
 
Join Date: Oct 2002
Rookie Year: 2002
Location: Long Island, NY
Posts: 1,187
Matt Krass has a reputation beyond reputeMatt Krass has a reputation beyond reputeMatt Krass has a reputation beyond reputeMatt Krass has a reputation beyond reputeMatt Krass has a reputation beyond reputeMatt Krass has a reputation beyond reputeMatt Krass has a reputation beyond reputeMatt Krass has a reputation beyond reputeMatt Krass has a reputation beyond reputeMatt Krass has a reputation beyond reputeMatt Krass has a reputation beyond repute
Send a message via AIM to Matt Krass Send a message via Skype™ to Matt Krass
Re: Flaky Potentiometers

We were having issues like that, could I see the code in question?

You could also PM/Email me with it if you'd prefer.
__________________
Matt Krass
If I suggest something to try and fix a problem, and you don't understand what I mean, please PM me!

I'm a FIRST relic of sorts, I remember when we used PBASIC and we got CH Flightsticks in the KoP. In my day we didn't have motorized carts, we pushed our robots uphill, both ways! (Houston 2003!)
  #3   Spotlight this post!  
Unread 02-21-2005, 06:39 PM
The Cyborg's Avatar
The Cyborg The Cyborg is offline
That Awkward One
AKA: Mary Soltis
FRC #0051 (Wings of Fire)
Team Role: College Student
 
Join Date: Jan 2004
Rookie Year: 2003
Location: Pontiac, MI
Posts: 221
The Cyborg has a brilliant futureThe Cyborg has a brilliant futureThe Cyborg has a brilliant futureThe Cyborg has a brilliant futureThe Cyborg has a brilliant futureThe Cyborg has a brilliant futureThe Cyborg has a brilliant futureThe Cyborg has a brilliant futureThe Cyborg has a brilliant futureThe Cyborg has a brilliant futureThe Cyborg has a brilliant future
Re: Flaky Potentiometers

Hmm.... I will use what I know on this...

What type of variable are you using in the c program to keep track of the potentiometers?

32768 is the positive limit for a signed integer variable in the C program...
There is signed integers which can go from -32768 to positive 32768, and unsigned goes from 0 to 65535.
It is possible that the Potentiometer is put on the robot very loosely, and continues turning in one direction when your arm moves, and etc.

In our program, in order to make it easier for us to read a potentiometer, we use unsigned char (characters), which have a range from 0 to 255, making it easier to keep track of the pot's location.

I hope this helps....
__________________
Sparkie: The little bot(s) that could.

Last edited by The Cyborg : 02-21-2005 at 06:42 PM.
  #4   Spotlight this post!  
Unread 02-21-2005, 07:33 PM
theDoctor's Avatar
theDoctor theDoctor is offline
Registered User
AKA: Kelly Butcher
#1502 (Technical Difficulties)
Team Role: Programmer
 
Join Date: Jun 2004
Rookie Year: 2005
Location: MI
Posts: 3
theDoctor is an unknown quantity at this point
Re: Flaky Potentiometers

We're using unsigned ints. The values when we have strange behavior go above 32766. That's just the last number I wrote down when I was testing the arm.

This is most of our arm routine. (Probably more than you wanted to see--sorry.)

Code:
 static unsigned char enable = 0;
 
 void arm_positioning(void)
 {
 	static short use_manual_control_shoulder = 1, use_manual_control_elbow = 1;
 
 	if(arm_sw_freeze == 1)	//Make the arm stop moving
 	{
 		enable = 0;
 		use_manual_control_shoulder = use_manual_control_elbow = 0;
 	}
 
	if(oi_shoulder_sw_fwd)
 	{
 		cylinder_fwd = 0;
 		cylinder_rev = 1;
 		shoulder_target = Get_Shoulder_Pos();
 		use_manual_control_shoulder = 1;
 	}
 	else if(oi_shoulder_sw_rev)
 	{
 		cylinder_fwd = 1;
 		cylinder_rev = 0;
 		shoulder_target = Get_Shoulder_Pos();
 		use_manual_control_shoulder = 1;
 	}
 	
 	
 	if(oi_elbow_sw_fwd)
 	{
 		arm_motor = 127 + arm_speed;
 		elbow_target = Get_Elbow_Pos();
 		use_manual_control_elbow = 1;
 		enable = 1;	//Allow arm to move again, if it was turned off.
 	}
 	else if(oi_elbow_sw_rev)
 	{
 		arm_motor = 127 - arm_speed;
 		elbow_target = Get_Elbow_Pos();
 		use_manual_control_elbow = 1;	
 		enable = 1;	//Allow arm to move again, if it was turned off.
 	}
 
 	// manual positioning, but no movement commanded; hold cylinder in place
 	if (!oi_shoulder_sw_fwd && !oi_shoulder_sw_rev
 		&& use_manual_control_shoulder)
 	{
 		cylinder_fwd = 0;
 		cylinder_rev = 0;
 		enable = 1;
 	}		
 
 	if (!oi_elbow_sw_fwd && !oi_elbow_sw_rev
 		&& use_manual_control_elbow)
 	{
 		arm_motor = 127;
 		enable = 1;
 	}		
 
 
 	if(!use_manual_control_shoulder && !use_manual_control_elbow)
 		position_arm(shoulder_target, elbow_target);
 
 	printf("Manual FWD: %d REV: %d, Shldr Trgt: %u, Elb Trgt: %u, Shldr: 0x%04x, Elbow: 0x%04x\n",
 	oi_shoulder_sw_fwd, oi_shoulder_sw_rev, shoulder_target, elbow_target, Get_Shoulder_Pos(), Get_Elbow_Pos()); 
 	printf("Shoulder Pot: %u, Elbow Pot: %u, Cylinder Values FWD: %d REV: %d\n", 
 	Get_Shoulder_Pos(), Get_Elbow_Pos(), cylinder_fwd, cylinder_rev);
 
 }
 
 
 
 void position_arm(unsigned int shoulder_target, unsigned int elbow_target)
 {
 	//This gets changed a few lines later if enable is on.
 	arm_motor = 127;
 	cylinder_fwd = cylinder_rev = 0;
 	
 	if (enable)
 	{
 		if(Get_Shoulder_Pos() < (shoulder_target - SHOULDER_DEADBAND))
 		 {
 			cylinder_fwd = 1;
 			cylinder_rev = 0;
 		}
 		else if(Get_Shoulder_Pos() > (shoulder_target + SHOULDER_DEADBAND))
 		{
 			cylinder_fwd = 0;
 			cylinder_rev = 1;
 		}
 		else
 		{
 			cylinder_fwd = cylinder_rev = 0;
 		}
 
 
 		if(Get_Elbow_Pos() < (elbow_target - ELBOW_DEADBAND))
 		{
 			arm_motor = 127 + arm_speed;
 		}
 		else if(Get_Elbow_Pos() > (elbow_target + ELBOW_DEADBAND))
 		{
 			arm_motor = 127 - arm_speed;
 		}
 	}
 
 }
 
 unsigned int Get_Shoulder_Pos()
 {
 	return Get_Analog_Value(robot_shoulder_pot);
 }
 
 unsigned int Get_Elbow_Pos()
 {
 	return Get_Analog_Value(robot_elbow_pot);
 }
  #5   Spotlight this post!  
Unread 02-21-2005, 08:08 PM
jimfortytwo jimfortytwo is offline
Registered User
AKA: Jim Paulos
#0418 (Purple Haze)
Team Role: Student
 
Join Date: Feb 2003
Rookie Year: 2002
Location: austin
Posts: 65
jimfortytwo is just really nicejimfortytwo is just really nicejimfortytwo is just really nicejimfortytwo is just really nicejimfortytwo is just really nice
Send a message via ICQ to jimfortytwo Send a message via AIM to jimfortytwo Send a message via Yahoo to jimfortytwo
Re: Flaky Potentiometers

This is probably not your issue, but our team was chasing ghosts until we realized our print statements were actually the problem. Hyperterminal wasn't clearning the screen between updates, but rather just writting lines on top of eachother. The result was that any time an unusually long message or long number was displayed, it would linger to the outside of the 'real' readout and look like a giant integer from that point afterwards.
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 02-22-2005 01:05 AM
Where to buy good potentiometers? Kirk Electrical 3 02-12-2005 09:23 PM
Q about potentiometers Nick R. Electrical 13 02-07-2004 08:13 AM
Working with Potentiometers GrahamS314 Programming 11 02-02-2003 01:34 PM
multi rotational potentiometers jdawson Electrical 8 01-27-2003 07:12 AM


All times are GMT -5. The time now is 08:26 AM.

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


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