PX4 SITL with Simulink based Plant Model
33 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Salvatore Matteo Mennea
am 8 Aug. 2023
Kommentiert: Salvatore Matteo Mennea
am 9 Aug. 2023
I'm trying to perform SITL with my custom controller with PX4 toolchain for trajectory tracking for quadcopter.I designed the controller with the MIL(model-in-the-loop) taking into account this link as reference:https://uk.mathworks.com/help/supportpkg/px4/ref/simulator-plant-model-example.html. The controller I designed in MIL works(no code generation everything done in simulink). So I moved to SITL(on PX4 host target) on Simulink based plant model. I press "monitor and tune", wait untill the controller is compiled and it says to run(with pacing active on 1) the model plant, so I did, but it doesn't work. I noticed that the controller and the palnt are running at complitly different times. The drone goes crazy. Is this the problem maybe? Should I syncronize the plant and the controller?
I tried also jmavsim simulator, but it does not work either.
How is possible that the MIl works and the SITL doesn't?
0 Kommentare
Akzeptierte Antwort
Arun Mathamkode
am 9 Aug. 2023
Bearbeitet: Arun Mathamkode
am 9 Aug. 2023
Depends on when the plant and controller start running there can be an offset between controller and plant. And as per the current design plant will run two times for each controller loop, hence typically plant simulation time will be two times controller simulation time plus additional offset. I dont think this might be the reson behind the issue you are facing. There might be some issues in the plant that is getting exposed with your controller design. I recommend you to give a try with the plant model used for HITL (example link) which is more robust. You need to replace the serial based MAVLink Bridge Source and Sink blocks in this model with TCP block to establish connection with PX4 SITL.
To answer your question on why it worked in MIL, I need to know how did you run the MIL. Did you run the MIL with the same plant you are using for SITL? PX4 have multiple module like navigator commander estimator and its only a part is designed in Simulink so technically just with MIL, you cant really verify how the controller runs with other modules in PX4. in SITL along with the PX4 desined controller other modules also will be runnign and they will interact and its lot different from MIL.
Weitere Antworten (0)
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!