Hello,
I am trying to design gimbal.
I have a good encoder and also good perforamnce IMU.
I can get directly AHRS data from my IMU with 100hz.
I use SimpleFOC library to drive my motors. Actually, velocity loop and position loop working normally in a good way. I have designed my own tuner. For example I can give the input with different frequencies and angles or velocity inputs. (for example, 5hz 0.1 rad/s or 10 hz 10 deg) etc.
Here some results. It’s the 5 degree input to position loop at 5 Hz. image-2024-10-10-03-55-12 hosted at ImgBB — ImgBB
Also, here the 0.4 deg/s speed input at 5Hz.
image-2024-10-10-03-57-59 hosted at ImgBB — ImgBB
I think position and speed loops somehow working good.
So, idea for the stabilization, I tried the 2 ways and I faced with similar result.
The first way I tried, once I got the error from AHRS(when I click a button, I got for example YAW angle as target and when I turn the system with my hands I got current YAW angle. Basically, error is target-curren YAW angle). Then I put this angle error to a PID and create a speed reference. Then I give this speed reference to the speed loop. It’s the first way I tried.
Second way, I used the error value as position input. I got the error value and added the current position of the motors(ie. encoder angle) and give that as position reference to position loop. So, position loop basically work like the PID controller I used in the first way.
For both, I faced the same issue. The system reactions are too low. I always got some error. To better understand the issue, I draw the error angles (target YAW and current yaw value). You can see the change of the error value below(blue line).
I used 20khz PWM frequency and my both motor.loopFOC and motor.move functions works 5khz.
I tried to tune PIDs, I tried so many things but never saw a smooth turn and very small error value. I don’t know why it happens. I use good quality IMU and encoder. Also, I think the position loop and velocity loop tuning somehow is good.
What’s your opinion? What should I do?
Thanks.