|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
| Thread Tools | Rate Thread | Display Modes |
|
#16
|
||||
|
||||
|
Re: Potentiometer PID
Any 100K Pot will work for most arms a single turn will work. Digikey.com and Mouser.com have parts for 100K 10 turn but you loose some resolution using a 10 turn. I haven't found any 2 turn 100K pots.
|
|
#17
|
|||||
|
|||||
|
Re: Potentiometer PID
We had some awful results 2 years ago with 100k pots on the robot. Last year we used 5k pots on the robot and had great success. I attibute the difference to noise and a close match to the input impedance of the ADC circuit.
Am I crazy? Don |
|
#18
|
|||
|
|||
|
Re: Potentiometer PID
instead of
Code:
if ( Button1 == 1 )
{
Target = 200 ;
}
else if ( Button2 == 1 )
{
Target = 400 ;
}
else if ( Button3 == 1 )
{
Target = 600 ;
}
Code:
if ( (Button1 * Button2) + (Button2 * Button3) + (Button3 * Button1) + ( Button1 + Button2 + Button3 ) == 1 ) //prevents crazy values if more than one button is pressed and keeps the same value if no button is pressed
{
Target = (Button1 * 200) + (Button2 * 400) + (Button3 * 600)
}
Last edited by NextPerception : 21-01-2007 at 02:55. |
|
#19
|
||||
|
||||
|
Re: Potentiometer PID
Quote:
Bourns makes the "good stuff." Avoid radioshack's potentiometers . |
|
#20
|
|||||
|
|||||
|
Re: Potentiometer PID
Quote:
And it takes a lot more time to do it your way. A few comparisons and branches are faster than many multiplications and additions. Note that the original code never does more than three comparisons and one assignment. Yours always does six multiplications, thirteen additions, and one comparison. It would be instructive to compile both alternatives and compare the generated assembly language code in the listing file. As an aside, wouldn't it work just as well to simplify the condition to this? Code:
if ( ( Button1 + Button2 + Button3 ) == 1 ) |
|
#21
|
|||
|
|||
|
Re: Potentiometer PID
Quote:
wow. this is what no sleep does to you. thanks for that. maybe I just think weird or something |
|
#22
|
|||
|
|||
|
Re: Potentiometer PID
how do u get pot sensors to work on easy c?
|
|
#23
|
||||
|
||||
|
Re: Potentiometer PID
The Analog Input block,
The Analog Input function block allows the user to define behavior based on signals from any analog sensor. Analog sensors provide a range of feedback with the range depending on the actual sensor being used. This generic input can be used with any Analog device of your choosing. Last edited by Kingofl337 : 11-02-2008 at 13:37. |
|
#24
|
|||
|
|||
|
Re: Potentiometer PID
I can't agree more. We just call our controllers when the robot is enabled. Dead simple and works great.
|
|
#25
|
||||
|
||||
|
Re: Potentiometer PID
Quote:
i would advise against using a pot for PID control, because the pot will always be returning to the same position, and the brush inside the pot will wear down on the resistive material, which would sacrifice the signal's validity. Im not saying that something like a joystick wouldnt do this, but a joystick is a lot more replaceable than a robot. |
|
#26
|
||||
|
||||
|
Re: Potentiometer PID
I guess I am comfused and I have been trying to get an idea on all this. I wish to be able to move the joystick to say a value of 200, then I want on the robot a motor to turn an arm until it also reads another pot at the same angle.
Example: Joystick tilted slightly forward, thus arm tilted slightly down. I cant figure out do I use a PID loop or do I just get creative with some other code or use a table? In the past I would just use limit switched but II want better control this year and a more varied location. -Mike |
|
#27
|
||||
|
||||
|
Re: Potentiometer PID
Use the sample code that has been bandied about in this thread, but instead of setting Target with conditionals and hardcoded values, just set Target equal to the value coming in from your joystick axis, or some function of that value (for instance, target=p1_y*4; would give you access to the full range of the pot). Does that make sense?
|
|
#28
|
||||
|
||||
|
Re: Potentiometer PID
Do I have to use Kevin's ADC code added somewhere within my code or could I just copy the code from Dustinb_3?
Any help is greatly appreciated the robot is about done but we've been busy on that and waited til the last minute to work on completing the code. -Mike |
|
#29
|
||||
|
||||
|
Re: Potentiometer PID
Quote:
Code:
arm_motor = (arm_pot - p1_y) * 50; |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Potentiometer help | Unholy | Programming | 4 | 07-02-2006 17:48 |
| Potentiometer Help! | thoughtful | Programming | 4 | 18-02-2005 08:21 |
| coding a potentiometer | incognito_NICK | Programming | 5 | 14-02-2005 15:56 |
| Potentiometer | Joshua May | Technical Discussion | 8 | 22-05-2004 19:51 |
| Potentiometer Theory | Ulibrium | Technical Discussion | 6 | 25-01-2002 21:16 |