Testing new controllers PX4 autopilot

Hello @bresch ,
I am working to implement different controllers other than PID and want to test on PX4 autopilot in SITL.

Can you please guide me where do i need to make changes in the firmware stack to test a new controller?

Hi @Ranjeet. This might be a good place to start looking:

Hi @benasena @bresch , I have gone through the current PID controller that works at 4 levels (attitude rate, attitude, velocity and position). And, I can see that mc_att_control, mc_pos_control and mc_rate_control are modules that deal with controller implemented.

Like, Suppose I just want to implement a position controller (say sliding mode controller), then many parameters (PID gains) will not be required and few parameters has to be added.
I was thinking of testing different controllers in PX4_sitl. I am aware that i need to write a module for another controller but what communications are going on among other modules and the present controller, if there is some picture, then that would be great.

You can probably take a look at this uorb graph to get an idea of message passing between the modules. Do note that some of the topic names maybe changed for the most-updated version.

Hello @Ranjeet
According to the Multicopter Control Architecture the Position and Velocity Controller Diagram are a mix of P (for position) and PID(for velocity).

I was trying to add a PI/PD/PID controller module instead of the P controller for Position?
I note the following codes (mc_pos_control module) have the controllers.
I wanted to know if there are other places to be modified for the different types of controllers based on your work. Thank you in anticipation!