Here is another vote for making it easier to embed the PID library in another class. I was in the process of creating a motor control class which would embed a PID controller to set the PWM signal to the motor when I saw psyber's post.
Edit:
It may not be necessary to add a default constructor. I haven't tested this yet but it does compile.
test.pde
#include<PID_Beta6.h>
#include "foo.h"
foo myFoo;
setup()
{
}
loop()
{
}
foo.h
class foo
{
public:
foo();
PID myPID;
double Input;
double Output;
double Setpoint;
}
foo.cpp
#include "PID_Beta6.h"
#include "foo.h"
foo::foo() : myPID(&Input, &Output, &Setpoint,2,5,1)
{
// initialize foo
}
I had to look up initialization lists, in my real life I've never used them. In another environment I'd include a pointer to a PID object in my class and use new to create it in the constructor.