I have investigated some algorithm (such as PID,LQR, GEometric controller …)for controlling the Drone in Matlab, now i am trying to transfer them into the pixhawk simulation for this purpose i need some information or sample code up to know where should exact placed my code. up to control the drone.
i have followed the tutorial and fortunately got the result as i wished, i could run the application, which is not exact my goal. i am going to replace my low level control for flight controlling. thank you for your attention.
if you go in
Firmware and go to
src/modules/mc_att_control then you can find here low-level controller of PX4.
But it is not safe to replace the low-level controller. You can try these things on
Thank you so much for your response,
i am so sorry because of my stupid question again, but i am a bit confused.according to the tutorials for development https://dev.px4.io/en/setup/building_px4.html => in terminal : $make posix jmavsim , then i saw the 3d space, even i chould follow correctly the tutorials for write application and i did run “px4_simple_app”.
BUT, my question is here; if i want to see my own controller’s result that i have designed in Matlab , lets consider convert it to the c++ in correct mode, so where i should add this cpp and header file and compile up to influence on the simulation.
if i will change the file in this directory src/modules/mc_att_control, might i seen my desired result that i am seeking for?
thank you so much for your time.
If you want to change only low-level controller then you have to change just mc_att_controller in my knowledge and all changes inside controller code will be visible in SITL and HITL.
You could use a companion computer and fly px4 in offboard mode. You could do this without modifying px4 source. I assume you have attitude setpoints.