jMAVSim

jMAVSim is a simple and lightweight multirotor simulator. It connects directly to the hardware-in-the-loop (HITL, via serial) or software-in-the-loop (SITL, via UDP) instance of the autopilot.

jMAVSim

Installation

git clone https://github.com/PX4/jMAVSim.git

Dependencies

These software packages are required to build and run jMAVSim

Linux

sudo apt-get install ant openjdk-7-jdk openjdk-7-jre

Mac OS

brew install ant

Building and Running

Install prerequisites and GIT repository initialization

cd jMAVSim
git submodule init
git submodule update

Build and run:

ant

Software in the Loop (SITL)

Here is an example for quadrotor X.

  1. Start the SITL executable
  2. Run jMAVSim in SITL mode:
    java -Djava.ext.dirs= -cp lib/*:out/production/jmavsim.jar me.drton.jmavsim.Simulator -udp 127.0.0.1:14560
  3. The console will display mavlink messages from the autopilot
  4. To connect QGroundControl to this system: QGC menu → Communication → Add Link
  5. Link type → UDP (do not change default UDP Port: 14550)
  6. Ready to fly!

Hardware in the Loop (HITL)

Here is an example for quadrotor X.

  1. Configure PX4 autopilot for HIL setup using either of these methods:
    1. Using QGroundControl: Connect to board, click Setup, click Airframe, check the box in the Simulation selection (last one in list) and pick the type of HIL setup you want from the drop-down. Apply and Restart, Reconnect
    2. By hand: Set parameter SYS_AUTOSTART = 1001, save parameters and reboot
  2. Run jMAVSim in HITL mode. Change the serial port to the port of Pixhawk and make sure to have QGroundControl NOT connected to serial.
    java -Djava.ext.dirs= -cp lib/*:out/production/jmavsim.jar me.drton.jmavsim.Simulator -serial /dev/tty.usbmodem1 921600 -qgc
  3. The console will display mavlink text messages from the autopilot
  4. To connect QGroundControl to this system: Select the default UDP link from the “connect” button in the top right corner and connect it.
  5. Ready to fly!
Translations of this page:


Quick Links

QR Code: URL of current page