How to Override PX4 Default Controller with the Custom controller

Hi @Allu_Sreekanth

px4_msgs::msg::VehicleThrustSetpoint
As you can see in document it is possible. But I think offboard mode should only take control to perform high level navigation works not directly drive motor and servos along entire flight. Document already have a warning about this
“The following offboard control modes bypass all internal PX4 control loops and should be used with great care.”

If you want to completely change default controllers with your own controllers I think bypass the actual system with offboard mode not the desired way. Instead of this you can use PX4 support package for simulink and replace only desired part of actual system with your controllers.

For example you can build an outer loop it producing attitude commands and if you publish this commands with right uORB topic(vehicle_attitude_setpoint), rate controller,mixer etc. of PX4 will still work. So you should only disable position controller for this example.(Only one source should publish attitude setpoints). You can implement this logic also for other low level controller loops. Another example while PX4 navigator and position controller working and publishing desired attitude commands to follow waypoints you can take this setpoints and publish desired motor/servo pwm values …

You can check MathWorks official document for more info.
https://www.mathworks.com/help/uav/px4/ref/PX4-HITL-with-VTOL-UAV-in-simulink.html
Also you can check our implementation wtih this method.