Finally found the solution for l298n motor driver with Pixhawk!

Don’t do with software what you can do with hardware.