View Single Post
  #2   Spotlight this post!  
Unread 26-01-2011, 15:56
mikets's Avatar
mikets mikets is offline
Software Engineer
FRC #0492 (Titan Robotics)
Team Role: Mentor
 
Join Date: Jan 2010
Rookie Year: 2008
Location: Bellevue, WA
Posts: 667
mikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of light
Re: PID output to a variable

The way the PID controller in WPI lib works is that you inherit the PIDOutput class and provide a PIDWrite callback function. The PID controller will call the PIDOutput:: PIDWrite function to run your motors. In essence, do something similar to this:
Code:
class MyRobot: public SimpleRobot, public PIDOutput
{
 
public:
    void PIDWrite(float output)
    {
        //program your motors accordingly with the output value.
    }
 
    MyRobot()
    {
        //Create the PID controller object.
    }
}
__________________
Reply With Quote