Develop PX4 custom controller without QGroundControl

1 view (last 30 days)
Hello, I'm trying to develop a custom controller for my Pixracer R15 autopilot. I followed the MATLAB tutorials and I want to know if is possibile to develop a custom controller and do HITL simulation without using QGroundControl. For example I'm trying to implement the example Position Tracking for X-Configuration Quadcopter in my hardware board instead of PX4 host target. Indeed in this example I can specify some trajectories and modify run-time parameters of the controller, I don't need to specify a mission on QGround I want only that my quadcopter follows some trajectories using the custom controller implemented in my board.
Thanks for help.

Answers (1)

Jianxin Sun
Jianxin Sun on 3 Oct 2022
Hi Paolo,
There are two HITL examples related to your application:
https://www.mathworks.com/help/supportpkg/px4/ref/hitl-simulink-plant-example.html shows how to configure HITL with multirotor dynamics in Simulink
https://www.mathworks.com/help/supportpkg/px4/ref/hitl-simulink-fixed-wing-plant-example.html shows how to configure the UAV to follow pre-defined mission in MATLAB/Simulink for fixed-wing UAV
You probably want to base your setup following the first example, but instead of using mission read block to get mission from QGroundControl, you can use pre-defined mission in MATLAB based on the second example implementation.
Jianxin
  1 Comment
Paolo
Paolo on 4 Oct 2022
Edited: Paolo on 5 Oct 2022
Hi Jianxin,
thansk for the reply. I saw the example for a fixed-wing UAV but I think that there isn't what I'm looking for. I need to simulate my quadcopter dynamics with JMAVSim and run HITL simulation, not in Monitor & Tune mode. So I don't understand how can I do this simulation based on Position Tracking for X-Configuration Quadcopter. All I need is to use my hardware board instead of the one simulatued by Simulink when I use PX4HostTarget as hw board.
So the question is if there is a way to connect my Pixracer with the computer and run the example I mentioned above with my hw board, I didn't understand if I need two serial connection between my board and the computer or if one connection (USB) is enough.
For example if I run the Position Tracking for X-Configuration Quadcopter with Px4HostTarget as hw board and I click on Build, Deploy & Start I see the quadcopter follow the trajectory specified in my Simulink model, I want to do the same thing with JMAVSim but instead of using PX4HostTarget I want to use PixRacer. I don't need any QGroundControl comunication beacuse I specify my trajectory in the Simulink Model like the example Position Tracking for X-Configuration Quadcopter shows.
Thanks again,
Paolo

Sign in to comment.

Products


Release

R2022b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!