Using Arduino-PID-Library on Raspbian

I got aware of Arduino-PID-library years ago when I did more stuff with Arduinos.
https://playground.arduino.cc/Code/PIDLibrary/
Especially the article series describing in detail the design decisions impressed me:
http://brettbeauregard.com/blog/2011/04/improving-the-beginners-pid-introduction/
So it was clear that I would do my first PID project with that library.
Only now I really have to do my first PID controller.

I want to automatically center video on an approach for landing airplane.
I do use this simple stepper PT camera system (just 4 drops of superglue needed):

Later for capturing real airplanes, I will use a 70mm lens.
The small camera is for inhouse algorithm development.
I simulate bright air with white background, and airplane with a non-reflecting black pendulum ball.
A simple P only PID controller basically works for both stepper motors (animation speed 0.25):
https://www.raspberrypi.org/forums/viewtopic.php?f=43&t=252176&p=1568093#p1568093

Because the 20-90fps image processing of Raspberry cameras is done on Raspbian, I wanted to make Arduino-PID-library usable there as well. After an intitial checkin of the unmodified library into my repo, I did commit some glue code in Arduino.cpp/.h (only "millis()" function was needed), and a simple PID_test.cpp that just proves that compilation works, and that millis() and using the library works as well:

$ g++ -Wall -Wextra PID_test.cpp Arduino.cpp Arduino-PID-Library/PID_v1.cpp -o PID_test
$ ./PID_test 
0
100
70.000000
$

Now I will have to learn how to use the PID library, and how to manually tune PID parameters:

P.S:
millis() returns 0ms on first invocation.
In case you want 0ms correspond to program start, just call millis() as first statement.

There is some simple PID code in this link. It may be easier to adapt for the RPi.

...R

Robin2:
There is some simple PID code in this link.

Much simpler, misses most of the features implemented by by Brett.

It may be easier to adapt for the RPi.

I already adapted it, see the commit link in previous posting, was easy and works.

HermannSW:
Much simpler, misses most of the features implemented by by Brett.

But are the missing features of any value?

I already adapted it, see the commit link in previous posting, was easy and works.

As you posted in the Project Guidance section I had assumed you were looking for advice. The Exhibition / Gallery section is more appropriate if you are just presenting a finished project.

...R

My fault, you are right.
I asked moderator to move, and now its where you proposed.