You are supposed to know something on what a PID controller can do for you and why it is so versatile and effective 😉
If that's not the case yet, here's below an eclectic incomplete not-at-all curated list of quick or semi-quick refreshers on the argument:
- PID for dummies
- The basics of tuning PID loops
- What is a control system anyway?
- How should I tune my copter?
- The good SE resource
- PID controllers in MATLAB/Simulink
- Did you already take on these awesome control challenges?
Some academic resources (take them more seriously 😏):
But stop loafing around now 🔨 and heat up the skills that made you a great PID human-tuner 💪
There is a robot standing in a world far away, whose body is fully anchored to the ground. Fortunately, the robot can still gaze around. There is also a magic red ball sticking out from the grey landscape. The ball floats insanely in front of the robot, moving along unpredictable trajectories and even teleporting from one place to another.
Given that the robot observes the world through its 320x240 couple of cameras, your task is "simply" 😆 to let the robot look constantly at the floating ball, as fast as possible, controlling both the eyes and the neck.
Thereby, you have to tune a bunch of PID velocity controllers that will drive the joint motors and in turn we will assign you points incrementally, as you meet the two sets of requirements below.
- The x pixel coordinate of the ball in the left camera image shall approach the center: ul ≈ 160.
- The y pixel coordinate of the ball in the left camera image shall approach the center: vl ≈ 120.
- The x pixel coordinate of the ball in the right camera image shall approach the center: ur ≈ 160.
- The y pixel coordinate of the ball in the right camera image shall approach the center: vr ≈ 120.
- The robot shall keep the eyes tilt close to 0 degrees: eyes-tilt ≈ 0 [deg].
- The robot shall keep the eyes pan close to 0 degrees: eyes-pan ≈ 0 [deg].
- The x pixel coordinate of the ball in the left camera image shall approach the center: ul ≈ 160.
- The y pixel coordinate of the ball in the left camera image shall approach the center: vl ≈ 120.
Requirements | Points |
---|---|
R1.1 | 4 |
R1.2 | 1 |
R1.3 | 4 |
R1.4 | 1 |
R1.5 | 2 |
R1.6 | 2 |
R2.1 | 8 |
R2.2 | 4 |
The maximum score you can achieve is therefore 26 🏆
If you'll do your job correctly, the outcome should look like the animation below 😎
We provide you with a starter code (see src/controller.cpp
) that contains missing gaps you have to fill in. Don't panic, most of the software to detect the ball and deal with the module infrastructure is already done. Just focus on the control part, possibly refining and extending what you'll find therein.
Once done, you can test your code in two ways:
- Manually: running the yarpmanager scripts provided from within app/scripts. This will help you tune the PID gains smoothly.
- Automatically: running the script test.sh in the smoke-test directory. This will give you an idea of how many points you might score.
To better inspect the quality of your control, you can plot the position of the ball in the image planes along with the angles of the eyes joints as they evolve over time.
We can achieve that using Octave. Just launch:
$ ./plot.sh
You will obtain temporal diagrams like this one ✨
Once done, type quit
to return to the shell.