Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   C/C++ (http://www.chiefdelphi.com/forums/forumdisplay.php?f=183)
-   -   PIDController with Potentiometer (http://www.chiefdelphi.com/forums/showthread.php?t=112486)

Jay Meldrum 31-01-2013 19:06

PIDController with Potentiometer
 
Our students are currently trying to reprogram last years robot with Command based programming. Last year we used a homemade PID function to controller our arm instead of wpi's PIDController.

We are now trying to use PIDController with the arm; one potentiometer is the input. When we set the set point to a known location and enable the PID, the pid outputs -1 100% of the time, when we move the arm across the known point the pid output never changes. Below is how we have the ReturnPIDInput defined.

We have had success with controlling the Shooter with a PID but we cannot get the arm to work.

Is it possible the PIDController is trying to read a voltage too quickly from the pot and we are recieving a NULL value back?

Anyone run into issues with this?

Code:

double Arm::ReturnPIDInput () {
        return armPot->GetAverageVoltage();
}


Team3266Spencer 31-01-2013 19:19

Re: PIDController with Potentiometer
 
Have you tuned the PID values?

Ether 31-01-2013 19:19

Re: PIDController with Potentiometer
 
Quote:

Originally Posted by jsmeldru (Post 1225505)
when we move the arm across the known point the pid output never changes

what is happening to the signal from the pot when you are doing this?



Jay Meldrum 31-01-2013 19:27

Re: PIDController with Potentiometer
 
When we read directly armPot->GetAverageVoltage(); we get expected values that range from 0 - 3.

However we believe the PIDController is not receiving that value.

We are using PID values from our previous PID loop, but we are not even trying to power the motors in this debug stage.

If we manually move the arm across the setpoint we should at least expect a change from the output of the PID to go from a negitive number to a positive number or vise versa. We currently do not see that.

Ether 31-01-2013 19:46

Re: PIDController with Potentiometer
 
Quote:

Originally Posted by jsmeldru (Post 1225518)
we believe the PIDController is not receiving that value

Why the uncertainty? Is there no way to examine that?



nightpool 31-01-2013 22:47

Re: PIDController with Potentiometer
 
Try reading armPot->PIDGet(). This should show you exactly what values the PIDController class is getting.

Jay Meldrum 03-02-2013 10:49

Re: PIDController with Potentiometer
 
Quote:

Originally Posted by nightpool (Post 1225634)
Try reading armPot->PIDGet(). This should show you exactly what values the PIDController class is getting.

Thanks nightpool. Interesting results. When reading armPot->GetAverageVoltage() we receive values that range from 0-3. (armPot->GetAverageVoltage() is what we return as the input to the PID loop). However when we read armPot->PIDGet() we receive values from 300 to 600. When we change our set points to match what PIDGet is receiving the PID works as expected... Not sure what is going on here, but at least we have a solution.

Thanks again

Jefferson 04-02-2013 18:24

Re: PIDController with Potentiometer
 
I think the PIDController is getting integer counts ranging from 0-1024.
Interestingly, we've been using the HOT_PID controller for years, starting in 2010. Now, we are doing exactly the same thing this year, switching over to commands and WPI PIDController.
This was confusing to us as well when we switched over. Try reading armPot->GetAverageValue. That should give you the same value as the PIDGet function.
Just give it an integer value in the 0-1024 range instead of the 0-5V range, and you should be good.

And thanks for the years of use from the HOT_PID.

Jay Meldrum 05-02-2013 10:20

Re: PIDController with Potentiometer
 
Thanks Jeff, we'll be sure to try the GetAverageValue function with setting the range differently. Glad HOTPID helped you throughout the years. We are sad to not use it anymore as well, but when PIDController works, it works great.

BradAMiller 06-02-2013 16:29

Re: PIDController with Potentiometer
 
That has been a little confusing.

The hardware returns a value between 0 and 1023 for 0-5V. The library will return either the hardware value or the voltage and it's important to be consistant in your units otherwise the output values will be way off.

Brad


All times are GMT -5. The time now is 12:55.

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