During last days I did some test with the following setup:
- Throttle speed = 30 (this value does not permit the drone to fly but it can balance itself on the semisphere mounted on its base ).
- Roll target=pitch target =0.
- Command =1 ( only the PID controller for roll is active).When it is in this mode the motor1 and motor 3 ( pitch) are spinning at throttle speed.
- PID k : I change them in different tests to have a first comparison .
- Cycletime = 10ms.
Analizing the logs saved I find out those remarks :
- The cycle time average is = 11ms, sometime I get a pick up to 21ms.I need to investigate on this .
- I need to compare data from different logs coming from different threads (main loop and sensor for the moment).So I just modify the code including a column that reports the absolute time. This can allow me to match the 2 logs.
- When I switch from command 0 (no PID controller) to 1 (roll PID controller) I notice a pick on the motor speed. I find a bug: one data initialization missing.Now it is corrected.
- When I switch from command 0 to 1 it takes around 1,5 sec to start to balance,evenif the difference in motor speed is already high. Possible explanation (to be investigated) is the inertia effect (to start the movement).I should allow a bigger speed correction.
- Right now the best result is obtained with Kp= 0.6 Ki=0 Kd=0.5. I will try increasing a little the Kp and reducing the Kd.