I have started building and programming my own quadcopter. I used stm32 f103 and right now I'm testing PID controller. The issue is getting right gain constants. I have build a swing and attached quadcopter to test it in one Axis. My problem is that I cannot use Zeigler-Nichols algorithm because the swing don't have big angular space. Quadcopter can move only 86 degrees. Is there a possible way to calculate gain constants from tests where I have measured angle?
You can use angle measurement to find the proper gains. Check out this other SE, they have a few good algorithms for finding the gains by measuring the oscillations. Another option, though a bit more experimental, you could try what this paper proposes as "Probably the best simple PID tuning rules in the world"
My last thought is that you could try applying the improved Ziegler-Nichols rules (Page 7).
One way is to tune the PID controller in a simulated environment and then fine-tune the parameters on the real system starting with the one axis experiment and then the real flights. This method requires an accurate model of your quadcopter especially for the mass and moments of inertia. You can then use a MATLAB/Simulink simulation for the simulated experiments and use Simulink PID auto-tuning for example.