How to stabilize the quadrotor using matlab simulink to change firmware

Hello,
I’ve tried to change in Pikhawk firmware using Qt but I didn’t understand how to do.
Now Im working with simulink. In Mathworks there are non response to quastions about this topic.

My problem is that rotors haven’t the same speed. so I think that I have to change PID parameters in the first part. I don’t know where to find original PID paramaters in order to change them.

In the second part , I didn’t understand the command calculation formula:
idle_PWM = uint16(1000);
% Quad X
M1 = uint16(((Roll + Pitch - Yaw) / 2 * Thrust + Thrust) * single(1000)) + idle_PWM;
M2 = uint16(((-Roll + Pitch + Yaw) / 2 * Thrust + Thrust) * single(1000)) + idle_PWM;
M3 = uint16(((-Roll - Pitch - Yaw) / 2 * Thrust + Thrust) * single(1000)) + idle_PWM;
M4 = uint16(((Roll - Pitch + Yaw) / 2 * Thrust + Thrust) * single(1000)) + idle_PWM;

I will be hopefull if you help me.
Thank you in advance.

Please explain setup more detail. Are you using simulink via mavlink? Or by other means?
If you send mavros topic to control the motors using simulink, the problem might be the computation time.
Of course, the calibration should be checked, too.

Im using embedded support package for px4 autopilots and simulink to build and deploy flight control algorithms to px4 autopilots

Are you using this one:


?

Yes I’m ,im using this package.
There are some basic exemples

1 Like

Hi, I had a look at that simulink example and I think that it is quite simplistic, only showing the attitude control implementation, so I wouldn’t really rely on it.
The mixer script, as well, seems to be working only for the specific example.

How can I solve the problem ?
I changed to mixing motor function for quadrotor but steal have problem.
One rotor don’t want to turn while incresing thrust whith RC.!!

.How can I solve the problem ?
I changed to mixing motor function for quadrotor but steal have problem.
One rotor don’t want to turn while incresing thrust whith RC.!!