- 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.
SITL with px4 toolbox in external mode with jmavsim
1 次查看(过去 30 天)
显示 更早的评论
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:![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1459707/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1459707/image.png)
Can one of this be the problem?
0 个评论
采纳的回答
ProblemSolver
2023-8-18
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:
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.
更多回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!