HITL multicopter sim

I am looking at the various ways to simulate a vehicle that is using offboard control. I’m looking at the HITL sim, but from what I can tell, only jmavsim can be used for multicopters. In QGroundControl when I go to Airframe and select HIL Quadcopter X and then select Widgets-> HIL Config, but jmavsim is not listed. Only Xplane 9, 10, and Flightgear are. Is there something I’m not doing?

I’m running QGroundControl v3.0.0 on Windows.

jmavsim is not support as a HITL simulator. I would use jmavsim SITL instead. Way easier to use.

Can you connect an offboard computer to it (just like you would the real vehicle) and also qgroundcontrol?

1 Like

No I don’t think so.

Hello,

If you want to perform HITL with JMavsim, you don’t need to run QGroundControl. I’m using windows but this will be similar for Linux. Youll need java jdk :http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html (jre won’t be enough)

  1. Copy Firmware repository and sync all sub projet to your computer
  2. Connect via USB your pixhawk
  3. Build jar file for jMavSim
    2.1) cd D:\PixHawk\Repos\Firmware\Tools\jMAVSim
    2.2) ant create_run_jar copy_res
    2.3) ant
  4. Laucnh JMavSim ; here is my command line for windows : java -Djava.ext.dirs= -cp D:\PixHawk\Repos\Firmware\Tools\jMAVSim\lib*;D:\PixHawk\Repos\Firmware\Tools\jMAVSim\out\production\jmavsim_run.jar me.drton.jmavsim.Simulator -serial COM3 921600 -qgc -ap px4 -view grnd -rep
    You’ll have to change COM port to the one matching your pixhawk. The -qgc option will allow broadcast of UDP message to QGround Control
  5. Once the simulator is fully started (In console ‘MSG: [lpe] xy resume’) Launch QGroundControl. It will connect to pixhawk through JmavSim

That’s it, you should now have HITL simulator working (if you have a radio transmittor you can try to arm the drone by it, or try using this code for companion https://github.com/mavlink/c_uart_interface_example/).
If the quadcopter keep climbing even with throttle set to 0, this means you have a bug as the UAV is too lightweight (in Simulator.java file, in sub ‘private AbstractMulticopter buildMulticopter()’ add more mass to vehicle.setMass()) You’ll have to recompile using step 2.2 and 2.3

Good luck

1 Like