I am looking to implement my own controller in the PX4 firmware by replacing position control module in the PX4. I have the controller coded in C++ and it produces the same results as my Matlab simulator which is good. Now, I would like to modify the PX4 firmware and test it in SITL with the Gazebo simulator for my multicopter. I understand the Gazebo is powered by the PX4 but I am wondering what influence do the position, rate, and attitude control modules (mc_pos_control, mc_rate_control, and mc_att_control) have on the gazebo simulator? I recently commented out each control module and sent offboard commands to the multicopter in gazebo. Nothing changed from before so it seems these control modules are doing nothing?
How is the gazebo multicopter being controlled? And is it possible then to even test my controller in gazebo before on hardware?
@ssmith-81 The PX4 user guide explains in detail how the Gazebo simulator is integrated with PX4: Simulation | PX4 User Guide
Firstly, do you use QGround Control ? If not, you’d better to install it. it makes it possible to change flight modes.
I have the same path in the presence. I modeled the position control mode in Simulink. But have you managed to map inputs of joystick into the controller and to model the mixer ?
Yes I use Qground control. Also, I was not noticing the changes from my implementations because I was not building the workspace correctly but it is working now which is nice. As of right now, I have my SMC based controller in the position control module but I need to figure out the acceleration to thrust and attitude setpoint or understand it better because since my controller is model based this part needs to be replaced I believe.
I cant say I have mapped those inputs, but hooking the joystick up to the gazebo simulator is possible but in terms of mapping the inputs I am not sure.