Tag Archives: PID control loop

Alfa2test. Introducing PID

This Alfa2 test has the scope to introduce in the code the part dedicated to the PID control loop  (see here an introduction of the PID Concept). So I included a new module  pid.py. Here the complete code  alfa2test

The used layout is stille the same as alfa1test so only one motor, mounted on the frame, the frame has got only one degree of freedom arounf the roll axis.

The  software includes two new elements:

  1. The PID control that can calculate the motor speed according the current roll and a target roll . Please note that in the code thare 2 parameters used to limite the pid effect in order to keep it under control. They are the maxW allowed on the motor and the  maxCorrection each  loop.
  2. The opportunity to change the target roll by the user  using the buttons a (increesing ) and z (decreesing).

The main targets were:

  1. pure debugging and code verification
  2. verification of the generated log
  3. first analysis of the log.

Below the roll and the motor speed W with a fixed roll target=0.

alfa2

The most important thing to me was to see that the correction was correct according to the roll position.As you can see it is correct.

Two  comments:

  1. in this test I did not work on the PID parameters. That’s appear clearly in the graph, with this periodical behavior or the system.
  2. In the phase when there is the riduction of the motor speed , the contrast to the inertia is now done only by the gravity. this cause the overshooting at every period.

With the scope to recreate now a more realistic behaviour of the system , in the next alfa3test i will adda new motor, and I will start to do some PID tuning.

Advertisements