Clear Filters
Clear Filters

SITL with px4 toolbox in external mode with jmavsim

6 views (last 30 days)
I'm usign external mode to flesh my own controller in SITL with jmavsim.The controller I designed works in MIL(Model-in-the-loop) but when I try to perform sitl in external mode in jmavsim it does not work. The problem is that the drone keeps still. Even if my controller is sending the control action so the PWM to the "To actuator" block, the drone does not move.
I have this warnings:
Can one of this be the problem?

Accepted Answer

ProblemSolver on 18 Aug 2023
Those warnings indicate that there is likely a mismatch between the PWM values being sent by your controller and what the SITL simulation is expecting. Here are some things to check:
  • Make sure the PWM output range from your controller matches the input range expected by the SITL simulation. For example, jMAVSim expects PWM values between 1000-2000 microseconds by default. If your controller is sending values outside of that range, they will be clamped and not have the desired effect.
  • Double check that your controller code is actually updating the PWM values correctly. Print or log the outputs to verify they are in the valid range and changing as expected when you try to command maneuvers.
  • Try sending direct throttle/steering commands to the simulation using the MAV_CMD_DO_SET_SERVO command instead of raw PWM. This bypasses the PWM conversion and directly sets the control surfaces. If the drone responds to this but not PWM, it points to a conversion issue.
  • Make sure your controller is publishing commands at a fast enough rate for the simulation. If the control rate is too low, the drone may not respond as expected.
  • Check that your controller has the correct frame of reference and signs on the control outputs for what the simulation is expecting. For example, a positive roll PWM value may correspond to a negative roll rotation depending on the convention.
I hope this helps. However, I can't prviode you extact details of the error occurance, as I don't have the .m file or some part of the codes.

More Answers (0)




Community Treasure Hunt

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

Start Hunting!