Giter VIP home page Giter VIP logo

jmavsim's Introduction

Build Status

Simple multirotor simulator with MAVLink protocol support

screenshot

Installation

Requirements:

Clone repository and initialize submodules:

git clone https://github.com/PX4/jMAVSim.git
cd ~/jMAVSIM
git submodule init
git submodule update

Install prerequisites via HomeBrew:

brew install ant

Create a standalone runnable JAR file with all libraries included, copy supporting resources, and use a shorter command to execute:

ant create_run_jar copy_res
cd out/production
java -Djava.ext.dirs= -jar jmavsim_run.jar [any jMAVSim options]

To create a complete package ready for distribution, build the distro target (this will create out/production/jMAVSim-distrib.zip):

ant distro

To delete everything in the build folder ant clean-all.

Alternate build / run / distribute

Compile:

ant

Run:

java -cp lib/*:out/production/jmavsim.jar me.drton.jmavsim.Simulator

Some shells (e.g. tcsh) will try to expand *, so use \* instead:

java -cp lib/\*:out/production/jmavsim.jar me.drton.jmavsim.Simulator

On Windows use ; instead of : in -cp:

java -cp lib/*;out/production/jmavsim.jar me.drton.jmavsim.Simulator

Key command

Views:

  • F - First-person-view camera.
  • S - Stationary ground camera.
  • G - Gimbal camera.
  • Z - Toggle auto-zoom for Stationary camera.
  • +/- - Zoom in/out
  • 0/ENTER - Reset zoom to default.

Actions:

  • Q - Disable sim on MAV.
  • I - Enable sim on MAV.
  • H - Toggle HUD overlay.
  • C - Clear all messages on HUD.
  • R - Toggle data report sidebar.
  • T - Toggle data report updates.
  • D - Toggle sensor parameter control sidebar.
  • F1 - Show this key commands reference.
  • P - Pause.
  • ESC - Exit jMAVSim.
  • SPACE - Reset vehicle & view to start position.

Manipulate Vehicle:

  • ARROW KEYS - Rotate around pitch/roll.
  • END/PG-DN - Rotate CCW/CW around yaw.
  • SHIFT + ARROWS - Move N/S/E/W.
  • SHIFT + INS/DEL - Move Up/Down.
  • NUMPAD 8/2/4/6 - Start/increase rotation rate around pitch/roll axis.
  • NUMPAD 1/3 - Start/increase rotation rate around yaw axis.
  • NUMPAD 5 - Stop all rotation.
  • CTRL + NUMPAD 5 - Reset vehicle attitude, velocity, & accelleration.

Manipulate Environment:

  • ALT +

    • ARROW KEYS - Increase wind deviation in N/S/E/W direction.
    • INS/DEL - Increase wind deviation in Up/Down direction.
    • NUMPAD 8/2/4/6 - Increase wind speed in N/S/E/W direction.
    • NUMPAD 7/1 - Increase wind speed in Up/Down direction.
    • NUMPAD 5 - Stop all wind and deviations.
  • CTRL+ Manipulate - Rotate/move/increase at a higher/faster rate.

Troubleshooting

Java 3D

jMAVSim uses java3d library for visualization. It was discontinued for long time, but now maintained again and uses JOGL backend. All necessary jars with java classes and native binaries (Linux/Mac OS/Windows) included in this repo, no need to install java3d manually. But need to make sure that java doesn't use any other deprecated version of java3d. For more info related to java3d see this article: https://gouessej.wordpress.com/2012/08/01/java-3d-est-de-retour-java-3d-is-back/

On Mac OS java may use deprecated version of java3d as extension, if you get following error:

JavaVM WARNING: JAWT_GetAWT must be called after loading a JVM
AWT not found
Exception in thread "main" java.lang.NoClassDefFoundError: apple/awt/CGraphicsDevice
	at javax.media.j3d.GraphicsConfigTemplate3D.<clinit>(GraphicsConfigTemplate3D.java:55)
...

Then add -Djava.ext.dirs= option to command line when starting:

java -Djava.ext.dirs= -cp lib/*:out/production/jmavsim.jar me.drton.jmavsim.Simulator

Serial port

Serial port access is common problem. Make sure to hardcode correct port in Simulator.java:

serialMAVLinkPort.open("/dev/tty.usbmodem1", 230400, 8, 1, 0);

(Baudrate for USB ACM ports (that PX4 uses) has no effect, you can use any value)

Usually port is:

Mac OS: /dev/tty.usbmodem1
Linux: /dev/ttyACM0
Windows: COM15

On Linux you may also get Permission denied error, add your user to dialout group and relogin, or just run as root.

UDP

UDP port used to connect ground station, e.g. qgroundcontrol. jMAVSim in this case works as bridge between ground station and autopilot (behavior can be configured of course). Make sure that jMAVSim and ground station use the same ports. In qgroundcontrol (or another GCS) you also need to add target host in UDP port configuration (localhost:14555), so both ends will know to which port they should send UDP packets.

Development

The simulator configuration is hardcoded in file src/me/drton/jmavsim/Simulator.java. Critical settings like port names or IP addresses can be provided as commandline arguments.

New vehicle types (e.g. non standard multirotors configurations) can be added very easily. (But for fixed wing you will need some more aerodynamics knowledge). See files under src/me/drton/jmavsim/vehicle/ as examples.

The camera can be placed on any point, including gimabal, that can be controlled by autopilot, see CameraGimbal2D class and usage example (commented) in Simulator.java.

Sensors data can be replayed from real flight log, use LogPlayerSensors calss for this.

Custom vehicle visual models in .obj format can be used, edit this line:

AbstractMulticopter vehicle = new Quadcopter(world, "models/3dr_arducopter_quad_x.obj", "x", 0.33 / 2, 4.0, 0.05, 0.005, gc);

Custom MAVLink protocols can be used, no any recompilation needed, just specify XML file instead of custom.xml here:

MAVLinkSchema schema = new MAVLinkSchema("mavlink/message_definitions/common.xml");

It's convenient to start the simulator from IDE. Free and powerful "IntelliJ IDEA" IDE recommended, project files for it are already included, just open project file jMAVSim.ipr and right-click -> Run Simulator.

Exporting 3D vehicle models using Blender

For custom vehicles it might be desirable to export new 3D models. One way of doing so is using Blender. To import an existing model from another application into blender, (e.g. onshape), export to the Collada (.dae) file format.

Once the Collada file has been imported into blender, it is necessary to set the Ambient value in the shading property to 0.0 for all materials used. A value of 1.0 will produce white surfaces in jMAVSIM regardless of the material settings.

When exporting from Blender, choose the Wavefront (.obj) file format. In the export dialogue, make the following changes:

  • Adjust the orientation of the model by specifying the Forward and Up directions. For example, if the z-axis in the Blender scene is pointing upwards, the correct setting for Up: would be -Z up for jMAVSIM.
  • Deselect "Objects as OBJ Objects" and select "Objects as OBJ Groups" instead. Otherwise jMAVSim will fail parsing the 3D model.

jmavsim's People

Contributors

asciich avatar bansiesta avatar bidai541 avatar bkueng avatar bresch avatar catch-twenty-two avatar copterspace avatar doctordrone avatar drton avatar farhangnaderi avatar gitter-badger avatar hamishwillee avatar julianoes avatar katzfey avatar kd0aij avatar lorenzmeier avatar maetugr avatar mcharleb avatar molecule avatar mpaperno avatar potaito avatar romain-chiap avatar stmoon avatar tsc21 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

jmavsim's Issues

HIL_STATE_QUATERNION no longer needed

On the latest PX4 stack the "HIL_STATE_QUATERNION" that jmavsim is sending now causes probems. If you comment out that code in MAVLinkHILSystem.java (line 191 to 224) then the PX4 flies missions smoothly in HITL mode.

Compass overlay is 90 degrees off

The on-screen compass display seems to be 90 degrees off.

E.g. on startup it shows a heading towards west at 270 degrees instead of North at 0 degrees. The same holds for course.

The arrows make sense (North up) but the dial is turned.

jMAVSim Flight controler

Hi,

I was wondering if jMAVSim has a flight controler like PID for example ? And if yes, is it possible to change it using SIMULINK ?

Thanks,
Paul

Warnings/error with Java 10

With Java 10, we get a bunch of warnings and errors:

WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by javax.media.j3d.JoglPipeline (rsrc:j3dcore.jar) to method sun.awt.AppContext.getAppContext()
WARNING: Please consider reporting this to the maintainers of javax.media.j3d.JoglPipeline
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
Exception in thread "AWT-EventQueue-0" java.lang.StackOverflowError
	at java.desktop/java.awt.Font.getStringBounds(Font.java:2603)
	at java.desktop/java.awt.Font.getStringBounds(Font.java:2517)
	at java.desktop/javax.swing.text.WrappedPlainView.updateMetrics(WrappedPlainView.java:445)
	at java.desktop/javax.swing.text.WrappedPlainView.setSize(WrappedPlainView.java:511)
	at java.desktop/javax.swing.plaf.basic.BasicTextUI$RootView.setSize(BasicTextUI.java:1815)
	at java.desktop/javax.swing.plaf.basic.BasicTextUI.getPreferredSize(BasicTextUI.java:942)
	at java.desktop/javax.swing.plaf.basic.BasicTextAreaUI.getPreferredSize(BasicTextAreaUI.java:121)
	at java.desktop/javax.swing.JComponent.getPreferredSize(JComponent.java:1680)
	at java.desktop/javax.swing.JTextArea.getPreferredSize(JTextArea.java:609)
	at java.desktop/javax.swing.text.JTextComponent.getScrollableTracksViewportHeight(JTextComponent.java:2107)
	at java.desktop/javax.swing.ScrollPaneLayout.layoutContainer(ScrollPaneLayout.java:812)
	at java.desktop/java.awt.Container.layout(Container.java:1535)
	at java.desktop/java.awt.Container.doLayout(Container.java:1524)
	at java.desktop/java.awt.Container.validateTree(Container.java:1720)
	at java.desktop/java.awt.Container.validate(Container.java:1655)
	at java.desktop/sun.awt.X11.XTextAreaPeer.setFont(XTextAreaPeer.java:393)
	at java.desktop/java.awt.Component.validate(Component.java:2934)
	at java.desktop/java.awt.Container.validateTree(Container.java:1738)
	at java.desktop/java.awt.Container.validate(Container.java:1655)
	at java.desktop/sun.awt.X11.XTextAreaPeer.setFont(XTextAreaPeer.java:393)

visualisation: No trees or skies under Win 10

Hello, dear friends.
I run jmavsim on Windows 10 Cygwin toolchain, according to this instruction:
http://dev.px4.io/en/setup/dev_env_windows_cygwin.html
It runs OK (takeoff, hold, land, QGS connect, etc), but visualisation window shows only drone and ground - no trees, skies, other evironment - only black background instead:
2018-11-10_12-44-39

When ran on Ubuntu before - I never had such an issue.
Can you please suggest me how to make visualisation work correctly under Windows 10?
It would be better to see at least constant blue sky, instead of black one.

Java compilation on 1.8 broken

@mpaperno I now get this when trying to run your updated version:

    [javac]         return String.format(ff + ff + ff, vec.getX(), vec.getY(), vec.getZ());
    [javac]                                                           ^
    [javac]   symbol:   method getY()
    [javac]   location: variable vec of type Vector3d
    [javac] /Users/lorenzmeier/src/Firmware/Tools/jMAVSim/src/me/drton/jmavsim/ReportUtil.java:20: error: cannot find symbol
    [javac]         return String.format(ff + ff + ff, vec.getX(), vec.getY(), vec.getZ());
    [javac]                                                                       ^
    [javac]   symbol:   method getZ()
    [javac]   location: variable vec of type Vector3d
    [javac] 18 errors

jMAVSim Autopilot is crashing

Hi,

Today i setup qGroundControl and jMAVSim for pixhawk(px4) in Ubuntu 14.04.

When i add target points and set mission mode.It is not working fine in jMAVSim and autopilot crash after some time.

Below is consol log.
WARN [commander] MANUAL CONTROL LOST (at t=113362ms)
WARN [commander] MANUAL CONTROL LOST (at t=115504ms)
WARN [commander] MANUAL CONTROL LOST (at t=117348ms)
WARN [navigator] offboard mission updated: dataman_id=1, count=3, current_seq=0
INFO [tone_alarm] neutral
WARN [commander] MANUAL CONTROL LOST (at t=119345ms)
WARN [commander] MANUAL CONTROL LOST (at t=121478ms)
INFO [tone_alarm] positive
WARN [commander] MANUAL CONTROL LOST (at t=123749ms)
WARN [commander] MANUAL CONTROL LOST (at t=125892ms)
WARN [commander] MANUAL CONTROL LOST (at t=129342ms)
WARN [commander] MANUAL CONTROL LOST (at t=130894ms)
WARN [commander] MANUAL CONTROL LOST (at t=132410ms)
WARN [commander] MANUAL CONTROL LOST (at t=134089ms)
WARN [commander] MANUAL CONTROL LOST (at t=135839ms)
INFO [commander] home: 47.3977420, 8.5455939, 488.00
INFO [tone_alarm] positive
INFO [commander] home: 47.3977420, 8.5455939, 488.00
INFO [tone_alarm] arming
INFO [commander] Takeoff detected
WARN [commander] MANUAL CONTROL LOST (at t=137597ms)
WARN [commander] MANUAL CONTROL LOST (at t=139410ms)
WARN [commander] MANUAL CONTROL LOST (at t=141414ms)
WARN [commander] MANUAL CONTROL LOST (at t=143238ms)
WARN [commander] MANUAL CONTROL LOST (at t=144999ms)
WARN [commander] MANUAL CONTROL LOST (at t=146845ms)
WARN [commander] MANUAL CONTROL LOST (at t=148650ms)
WARN [commander] MANUAL CONTROL LOST (at t=150552ms)
WARN [commander] MANUAL CONTROL LOST (at t=152247ms)
WARN [commander] MANUAL CONTROL LOST (at t=154710ms)
WARN [commander] MANUAL CONTROL LOST (at t=156825ms)
WARN [commander] MANUAL CONTROL LOST (at t=158822ms)
WARN [commander] MANUAL CONTROL LOST (at t=160606ms)
WARN [commander] MANUAL CONTROL LOST (at t=162400ms)
WARN [commander] MANUAL CONTROL LOST (at t=164447ms)
WARN [commander] MANUAL CONTROL LOST (at t=166419ms)
WARN [commander] MANUAL CONTROL LOST (at t=168315ms)
WARN [commander] MANUAL CONTROL LOST (at t=170106ms)
INFO [platforms__posix__px4_layer] simulator is slow. Delay added: 33899 us
WARN [commander] MANUAL CONTROL LOST (at t=172098ms)
WARN [commander] MANUAL CONTROL LOST (at t=174060ms)

JMAVSim Failing To Start: java.lang.reflect.InvocationTargetException

PX4 is successfully building and work fine with the Gazebo simulator, but when making a jmavsim simulation, the simulation is not displaying anything with the error message

./Tools/simulation/jmavsim/jmavsim_run.sh -l
Buildfile: /home/joshlinux/joshdev/PX4-Autopilot/Tools/simulation/jmavsim/jMAVSim/build.xml

make_dirs:

compile:

create_run_jar:

copy_res:

BUILD SUCCESSFUL
Total time: 0 seconds
Options parsed, starting Sim.
Starting GUI...
Exception in thread "main" java.lang.reflect.InvocationTargetException
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader.main(JarRsrcLoader.java:61)
Caused by: java.lang.UnsatisfiedLinkError: Can't load library: /home/joshlinux/joshdev/PX4-Autopilot/Tools/simulation/jmavsim/jMAVSim/out/production/natives/linux-aarch64//libgluegen_rt.so
	at java.base/java.lang.ClassLoader.loadLibrary(ClassLoader.java:2638)
	at java.base/java.lang.Runtime.load0(Runtime.java:768)
	at java.base/java.lang.System.load(System.java:1850)
	at com.jogamp.common.jvm.JNILibLoaderBase.loadLibraryInternal(JNILibLoaderBase.java:625)
	at com.jogamp.common.jvm.JNILibLoaderBase.access$000(JNILibLoaderBase.java:64)
	at com.jogamp.common.jvm.JNILibLoaderBase$DefaultAction.loadLibrary(JNILibLoaderBase.java:107)
	at com.jogamp.common.jvm.JNILibLoaderBase.loadLibrary(JNILibLoaderBase.java:488)
	at com.jogamp.common.os.DynamicLibraryBundle$GlueJNILibLoader.loadLibrary(DynamicLibraryBundle.java:427)
	at com.jogamp.common.os.Platform$1.run(Platform.java:321)
	at java.base/java.security.AccessController.doPrivileged(Native Method)
	at com.jogamp.common.os.Platform.<clinit>(Platform.java:290)
	at com.jogamp.opengl.GLProfile.<clinit>(GLProfile.java:154)
	at jogamp.opengl.ThreadingImpl$1.run(ThreadingImpl.java:83)
	at jogamp.opengl.ThreadingImpl$1.run(ThreadingImpl.java:66)
	at java.base/java.security.AccessController.doPrivileged(Native Method)
	at jogamp.opengl.ThreadingImpl.<clinit>(ThreadingImpl.java:66)
	at com.jogamp.opengl.Threading.disableSingleThreading(Threading.java:164)
	at javax.media.j3d.JoglPipeline.initialize(JoglPipeline.java:129)
	at javax.media.j3d.Pipeline.createPipeline(Pipeline.java:92)
	at javax.media.j3d.MasterControl.loadLibraries(MasterControl.java:858)
	at javax.media.j3d.VirtualUniverse.<clinit>(VirtualUniverse.java:267)
	at me.drton.jmavsim.Visualizer3D.<init>(Visualizer3D.java:194)
	at me.drton.jmavsim.Simulator.<init>(Simulator.java:193)
	at me.drton.jmavsim.Simulator.main(Simulator.java:944)
	... 5 more

Crash on load due to missing image file

@mpaperno Did you may forget to commit the compass image? I get a crash on boot because the image is not found:

Exception in thread "main" java.lang.IllegalArgumentException: input == null!
    at javax.imageio.ImageIO.read(ImageIO.java:1388)
    at me.drton.jmavsim.Visualizer3D$CustomCanvas3D.<init>(Visualizer3D.java:707)
    at me.drton.jmavsim.Visualizer3D.<init>(Visualizer3D.java:114)
    at me.drton.jmavsim.Simulator.<init>(Simulator.java:209)
    at me.drton.jmavsim.Simulator.main(Simulator.java:611)
^C

jMAVSim without GUI

Hello,

Thanks to this post: http://discuss.px4.io/t/lightweight-or-command-line-sitl-simulation-options/2285
Modifying Visualizer3D.java3, and change setVisible(true) to
setVisible(false).

I could run SITL using jMAVSim without the GUI as my low computational power computer was having troubles running it properly.

Do you know if most of PX4 users are using the graphics ?
Or if most of us are just wasting CPU with jMAVSim fency graphics...

I was wondering if we could set a parameter for this in order to be able to specify that we want to turn off graphics, without having to edit and compile jMAVSim .
Do you think it could be feasible and that some people could benefit from that ?

looking forward hearing from you.
Best

windCurrent & windDeviation

Hi, I am little confused about windCurrent & windDeviation.

Specifically, why only use setWindDeviation() to initialize the Environment, instead of setWind().

In jMAVSim we can manipulate both wind and wind direction:

alt+arrow keys
alt+numkey+(2,4,6,8)

I have checked before and increasing the deviation which has a weird effect when the quad is on hover, but changing the wind is different seems more real.

Run JmavSim in HITL Mode

I am trying to run Jmavsim in HITL mode. I follwed the link
https://pixhawk.org/dev/hil/jmavsim
and used /dev/ttyACM0(Pixhawk connected through usb(serial)) and /dev/ttyUSB0(Pixhawk connected through radio telemetry(udp)) and as mention in link ttyusbmodem1 but every time it throws serial port exception either port not found or port busy.

Thanks.

Not able to change location

after setting a new takeoff location using
export PX4_HOME_LAT=50.955xxx
export PX4_HOME_LON=6.953xxx
export PX4_HOME_ALT=53
the drone disappears from the simulator and cant be found zooming in/out or using space.
Is there any way to move the environment to the new drone position or is the simulator limited to the area around the default location?

Recent implementation for HIL_STATE_QUATERNION is causing quite a few issues

Recently user @kd0aij added HIL_STATE_QUATERNION message along with few other changes such as removing nav_mode check. This is causing following issues:

  1. With all default HIL setup (see steps in this issue if needed for repro) you will flickers in qGroundControl where Altitude keeps switching between 0 and 480m.
  2. With RC control, you will frequently see quadcopter suddenly flip over and dive to ground.
  3. You may see heading for the vehicle at 90 degrees instead of 0.

The cause of this is below problem is in the implementation:

  1. altitude (alt) is set to z value of vehicle position. This is incorrect. The z position needs to be projected on global frame to get altitude.
  2. The lat and lon fields of message are not set at all.
  3. The ind_windspeed is not set at all (this might be ok, however).
  4. The quaternion has some issue which is causing wrong heading.

Additionally, I also think this message is possibly interfering PX4 autopilot. See the function MavlinkReceiver::handle_message_hil_state_quaternion(mavlink_message_t *msg) in the PX4 code.

I reverted the MAVLinkHILSystem.java file to version before Sep 1 and above problems went away with vehicle having stable flight.

jMAVsim fails with Java 11

hello everyone!
I tried to run jMAVsim on ubuntu18.04,but it failed to start GUI,
this is the message:

louzq@louzq-HP-Pavilion-Power-Laptop-15-cb0xx:~/src/Firmware/Tools/jMAVSim$ java -cp lib/*:out/production/jmavsim.jar me.drton.jmavsim.Simulator
Options parsed, starting Sim.
Starting GUI...
3D [dev] 1.6.0-pre12-daily-experimental daily

WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by javax.media.j3d.JoglPipeline (file:/home/louzq/src/Firmware/Tools/jMAVSim/lib/j3dcore.jar) to method sun.awt.AppContext.getAppContext()
WARNING: Please consider reporting this to the maintainers of javax.media.j3d.JoglPipeline
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
Inconsistency detected by ld.so: dl-lookup.c: 111: check_match: Assertion `version->filename == NULL || ! _dl_name_match_p (version->filename, map)' failed!

how to solve this problem

Low mass is causing UAV to climb on arming

Recently @kd0aij made a change to set the default mass to 0.8 from 1.0. See below line:

https://github.com/PX4/jMAVSim/blob/master/src/me/drton/jmavsim/Simulator.java#L309

To reproduce issue:

  1. Connect Pixhawk board to PC via USB.
  2. Start jMavSim in HIL mode using the command line: `java -Djava.ext.dirs= -cp lib/*;out/production/jmavsim.jar me.drton.jmavsim.Simulator -serial COM4 115200 -qgc'
  3. Start qGroundControl and arm.
  4. Watch quadcopter climb just on arming.
  5. Change the mass to 1 or 1.2. Repeat the steps above to see vehicle doesn't climb on arm.

Log file:
low_mass.zip

Recommandation:
Add switch for iris and 0.8 mass and leave the default to 1 or 1.2 that works with SITL as well as HIL default setup.

java.lang.IllegalAccessException when running/building on Ubuntu 20.04

OS: Ubuntu 20.04
java: openjdk 16.0.1 2021-04-20
ant: 1.10.7

I get an error:

java.lang.IllegalAccessException: class javax.media.j3d.JoglPipeline cannot access class sun.awt.X11GraphicsDevice

I cloned the repo and tried building as specified in the README.md:

ant create_run_jar copy_res
cd out/production
java -Djava.ext.dirs= -jar jmavsim_run.jar

I also tried building the distribution package

ant distro

Then unzipped it and ran it from the command line with java -jar jmavsim_run.jar

In both cases it stops with error output as follows:
(Full output)

Options parsed, starting Sim.
Starting GUI...
Caught AppContextInfo(Bug 1004) InaccessibleObjectException: Unable to make public static sun.awt.AppContext sun.awt.AppContext.getAppContext() accessible: module java.desktop does not "exports sun.awt" to unnamed module @6c80d78a on thread J3D-Renderer-1
    [0]: java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:357)
    [1]: java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:297)
    [2]: java.base/java.lang.reflect.Method.checkCanSetAccessible(Method.java:199)
    [3]: java.base/java.lang.reflect.Method.setAccessible(Method.java:193)
    [4]: com.jogamp.nativewindow.awt.AppContextInfo$1$1.run(AppContextInfo.java:40)
    [5]: com.jogamp.common.util.UnsafeUtil.doWithoutIllegalAccessLogger(UnsafeUtil.java:202)
    [6]: com.jogamp.nativewindow.awt.AppContextInfo$1.run(AppContextInfo.java:34)
    [7]: java.base/java.security.AccessController.doPrivileged(AccessController.java:312)
    [8]: com.jogamp.nativewindow.awt.AppContextInfo.<clinit>(AppContextInfo.java:31)
    [9]: com.jogamp.nativewindow.awt.JAWTWindow.<init>(JAWTWindow.java:128)
    [10]: jogamp.nativewindow.jawt.x11.X11JAWTWindow.<init>(X11JAWTWindow.java:60)
    [11]: java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    [12]: java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:78)
    [13]: java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    [14]: java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:499)
    [15]: java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:480)
    [16]: jogamp.nativewindow.NativeWindowFactoryImpl.getAWTNativeWindow(NativeWindowFactoryImpl.java:105)
    [17]: jogamp.nativewindow.NativeWindowFactoryImpl.getNativeWindowImpl(NativeWindowFactoryImpl.java:66)
    [18]: com.jogamp.nativewindow.NativeWindowFactory.getNativeWindow(NativeWindowFactory.java:654)
    [19]: javax.media.j3d.JoglPipeline$QueryCanvas.addNotify(JoglPipeline.java:8604)
    [20]: java.desktop/java.awt.Container.addNotify(Container.java:2801)
    [21]: java.desktop/java.awt.Window.addNotify(Window.java:787)
    [22]: java.desktop/java.awt.Frame.addNotify(Frame.java:493)
    [23]: java.desktop/java.awt.Window.show(Window.java:1049)
    [24]: java.desktop/java.awt.Component.show(Component.java:1720)
    [25]: java.desktop/java.awt.Component.setVisible(Component.java:1667)
    [26]: java.desktop/java.awt.Window.setVisible(Window.java:1032)
    [27]: javax.media.j3d.JoglPipeline.getBestConfiguration(JoglPipeline.java:8379)
    [28]: javax.media.j3d.Renderer.doWork(Renderer.java:496)
    [29]: javax.media.j3d.J3dThread.run(J3dThread.java:271)
Caught AppContextInfo(Bug 1004) IllegalAccessException: class com.jogamp.nativewindow.awt.AppContextInfo cannot access class sun.awt.AppContext (in module java.desktop) because module java.desktop does not export sun.awt to unnamed module @6c80d78a on thread J3D-Renderer-1
    [0]: java.base/jdk.internal.reflect.Reflection.newIllegalAccessException(Reflection.java:385)
    [1]: java.base/java.lang.reflect.AccessibleObject.checkAccess(AccessibleObject.java:687)
    [2]: java.base/java.lang.reflect.Method.invoke(Method.java:559)
    [3]: com.jogamp.nativewindow.awt.AppContextInfo.fetchAppContext(AppContextInfo.java:191)
    [4]: com.jogamp.nativewindow.awt.AppContextInfo.update(AppContextInfo.java:135)
    [5]: com.jogamp.nativewindow.awt.AppContextInfo.<init>(AppContextInfo.java:50)
    [6]: com.jogamp.nativewindow.awt.JAWTWindow.<init>(JAWTWindow.java:128)
    [7]: jogamp.nativewindow.jawt.x11.X11JAWTWindow.<init>(X11JAWTWindow.java:60)
    [8]: java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    [9]: java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:78)
    [10]: java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    [11]: java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:499)
    [12]: java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:480)
    [13]: jogamp.nativewindow.NativeWindowFactoryImpl.getAWTNativeWindow(NativeWindowFactoryImpl.java:105)
    [14]: jogamp.nativewindow.NativeWindowFactoryImpl.getNativeWindowImpl(NativeWindowFactoryImpl.java:66)
    [15]: com.jogamp.nativewindow.NativeWindowFactory.getNativeWindow(NativeWindowFactory.java:654)
    [16]: javax.media.j3d.JoglPipeline$QueryCanvas.addNotify(JoglPipeline.java:8604)
    [17]: java.desktop/java.awt.Container.addNotify(Container.java:2801)
    [18]: java.desktop/java.awt.Window.addNotify(Window.java:787)
    [19]: java.desktop/java.awt.Frame.addNotify(Frame.java:493)
    [20]: java.desktop/java.awt.Window.show(Window.java:1049)
    [21]: java.desktop/java.awt.Component.show(Component.java:1720)
    [22]: java.desktop/java.awt.Component.setVisible(Component.java:1667)
    [23]: java.desktop/java.awt.Window.setVisible(Window.java:1032)
    [24]: javax.media.j3d.JoglPipeline.getBestConfiguration(JoglPipeline.java:8379)
    [25]: javax.media.j3d.Renderer.doWork(Renderer.java:496)
    [26]: javax.media.j3d.J3dThread.run(J3dThread.java:271)
Exception in thread "main" java.lang.reflect.InvocationTargetException
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:78)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:567)
	at org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader.main(JarRsrcLoader.java:61)
Caused by: java.lang.RuntimeException: java.lang.IllegalAccessException: class javax.media.j3d.JoglPipeline cannot access class sun.awt.X11GraphicsDevice (in module java.desktop) because module java.desktop does not export sun.awt to unnamed module @6c80d78a
	at javax.media.j3d.JoglPipeline.getScreen(JoglPipeline.java:8553)
	at javax.media.j3d.Screen3D.<init>(Screen3D.java:354)
	at javax.media.j3d.Canvas3D.<init>(Canvas3D.java:1124)
	at javax.media.j3d.Canvas3D.<init>(Canvas3D.java:1026)
	at javax.media.j3d.Canvas3D.<init>(Canvas3D.java:990)
	at me.drton.jmavsim.Visualizer3D$CustomCanvas3D.<init>(Visualizer3D.java:909)
	at me.drton.jmavsim.Visualizer3D.<init>(Visualizer3D.java:196)
	at me.drton.jmavsim.Simulator.<init>(Simulator.java:192)
	at me.drton.jmavsim.Simulator.main(Simulator.java:941)
	... 5 more
Caused by: java.lang.IllegalAccessException: class javax.media.j3d.JoglPipeline cannot access class sun.awt.X11GraphicsDevice (in module java.desktop) because module java.desktop does not export sun.awt to unnamed module @6c80d78a
	at java.base/jdk.internal.reflect.Reflection.newIllegalAccessException(Reflection.java:385)
	at java.base/java.lang.reflect.AccessibleObject.checkAccess(AccessibleObject.java:687)
	at java.base/java.lang.reflect.Method.invoke(Method.java:559)
	at javax.media.j3d.JoglPipeline.getScreen(JoglPipeline.java:8551)
	... 13 more

Any help to resolve the issue would be appreciated.

Pre flight checks required

Hey! Currently I am running jMAVSim with the PX4 serially following instructions mentioned in jMAVSim/HIL.

My team and I are interested in verifying a quadcopter mathematical model written in Modelica by connecting it to PX4 via serial MAVLink and viewing the same in QGCS. We could send data using HIL_SENSOR, HIL_GPS and receive controller output using HIL_ACTUATOR_CONTROLS, but the controller output we are receiving is an array of zeros. We think pre-flight checks are not being satisfied for the PX4 in order for it to return proper control output data. I looked into the jMAVSim code to identify these checks, unfortunately I couldn't find something concrete w.r.t the checks.

Please let me know what these pre-flight checks are or where I could find them or the variable values that need to set in order for the receive valid actuator values.

Problem with OpenGL version. JMAVSim (from Windows Cygwin Toolchain) on Windows 10

I download Windows Cygwin Toolchain, clone px4 repository and build JMAVSim simulation (command make px4_sitl jmavsim).
But have error with OpenGL verison (on run).

javax.media.j3d.IllegalRenderingStateException: Java 3D ERROR : OpenGL 1.2 or better is required (GL_VERSION=1.1)
        at javax.media.j3d.JoglPipeline.setupCanvasProperties(JoglPipeline.java:8083)
        at javax.media.j3d.JoglPipeline.access$600(JoglPipeline.java:89)
        at javax.media.j3d.JoglPipeline$ContextQuerier.init(JoglPipeline.java:8711)
        at javax.media.j3d.JoglPipeline$QueryCanvas.doQuery(JoglPipeline.java:8618)
        at javax.media.j3d.JoglPipeline$QueryCanvas.access$100(JoglPipeline.java:8566)
        at javax.media.j3d.JoglPipeline.createQueryContext(JoglPipeline.java:6562)
        at javax.media.j3d.Canvas3D.createQueryContext(Canvas3D.java:4609)
        at javax.media.j3d.Canvas3D.createQueryContext(Canvas3D.java:3606)
        at javax.media.j3d.Renderer.doWork(Renderer.java:461)
        at javax.media.j3d.J3dThread.run(J3dThread.java:271)

DefaultRenderingErrorListener.errorOccurred:
CONTEXT_CREATION_ERROR: Renderer: Error creating Canvas3D graphics context for queryProperties()
Exception in thread "main" graphicsDevice = Win32GraphicsDevice[screen=0]
java.lang.reflect.InvocationTargetException
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader.main(JarRsrcLoader.java:61)
Caused by: java.lang.IllegalStateException: Canvas3D: Non-recoverable graphics configuration error
        at javax.media.j3d.Canvas3D.queryProperties(Canvas3D.java:3595)
        at me.drton.jmavsim.Visualizer3D.createEnvironment(Visualizer3D.java:215)
        at me.drton.jmavsim.Visualizer3D.<init>(Visualizer3D.java:176)
        at me.drton.jmavsim.Simulator.<init>(Simulator.java:170)
        at me.drton.jmavsim.Simulator.main(Simulator.java:793)
        ... 5 more

But real version on OpenGL

Cannot build udp connection with sitl!

In my machine, jmavsim cannot build udp connection with sitl, how to solve this problem? The sitl always stays in "waiting for initial data on UDP"! I have tried sending a UDP message in the terminal, sitl can receive it.

Besides, in sitl mode, jmavsim indicate "/dev/ttyACM0" port not found. My OS is ubuntu14.04.
Thanks very much.

Timing glitch in jMAVSim can cause wild vibration in SITL

@molecule @mcharleb I'm not sure if you have observed this as well, but if I switch away from the jMAVSim window I sometimes get a timing glitch which subsequently ends up in wild oscillations. I'm not sure yet if the simulator is at fault or if the control system gets an invalid timestamp resulting in some NaN propagation.

"Can't load library: /home/pi/src/Firmware/Tools/jMAVSim/out/production/libgluegen-rt.so"

I followed these instructions:
https://github.com/PX4/jMAVSim/blob/master/README.md

On running it with
java -djava.ext.dirs= -jar jmavsim_run.jar

I get the following error:

Options parsed, starting Sim.
Starting GUI...
3D [dev] 1.6.0-pre12-daily-experimental daily

Exception in thread "main" java.lang.reflect.InvocationTargetException
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader.main(JarRsrcLoader.java:61)
Caused by: java.lang.UnsatisfiedLinkError: Can't load library: /home/pi/src/Firmware/jMAVSim/out/production/libgluegen-rt.so
	at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1827)
	at java.lang.Runtime.load0(Runtime.java:809)
	at java.lang.System.load(System.java:1086)
	at com.jogamp.common.jvm.JNILibLoaderBase.loadLibraryInternal(JNILibLoaderBase.java:596)
	at com.jogamp.common.jvm.JNILibLoaderBase.access$000(JNILibLoaderBase.java:63)
	at com.jogamp.common.jvm.JNILibLoaderBase$DefaultAction.loadLibrary(JNILibLoaderBase.java:95)
	at com.jogamp.common.jvm.JNILibLoaderBase.loadLibrary(JNILibLoaderBase.java:459)
	at com.jogamp.common.os.DynamicLibraryBundle$GlueJNILibLoader.loadLibrary(DynamicLibraryBundle.java:421)
	at com.jogamp.common.os.Platform$1.run(Platform.java:317)
	at java.security.AccessController.doPrivileged(Native Method)
	at com.jogamp.common.os.Platform.<clinit>(Platform.java:287)
	at com.jogamp.opengl.GLProfile.<clinit>(GLProfile.java:146)
	at jogamp.opengl.ThreadingImpl$1.run(ThreadingImpl.java:83)
	at jogamp.opengl.ThreadingImpl$1.run(ThreadingImpl.java:66)
	at java.security.AccessController.doPrivileged(Native Method)
	at jogamp.opengl.ThreadingImpl.<clinit>(ThreadingImpl.java:66)
	at com.jogamp.opengl.Threading.disableSingleThreading(Threading.java:164)
	at javax.media.j3d.JoglPipeline.initialize(JoglPipeline.java:130)
	at javax.media.j3d.Pipeline.createPipeline(Pipeline.java:92)
	at javax.media.j3d.MasterControl.loadLibraries(MasterControl.java:837)
	at javax.media.j3d.VirtualUniverse.<clinit>(VirtualUniverse.java:274)
	at me.drton.jmavsim.Visualizer3D.<init>(Visualizer3D.java:155)
	at me.drton.jmavsim.Simulator.<init>(Simulator.java:170)
	at me.drton.jmavsim.Simulator.main(Simulator.java:793)
	... 5 more

Jmavsim Bind failed

Hi i am trying to do the sitl simulation but when i run make posix_sitl_default jmavsim it shows bind failed and its not connecting with QGC
the complete log is
anuj@anuj-vm:~/src/Firmware$ make posix_sitl_default jmavsim
PX4 CONFIG: /home/anuj/src/Firmware/build_posix_sitl_default
[ 0%] [ 1%] Built target prebuild_targets
Built target git_gencpp
[ 1%] [ 1%] Built target git_genmsg
Built target git_uavcan
[ 1%] Built target git_jmavsim
[ 2%] [ 2%] Built target git_matrix
Built target git_mavlink
[ 4%] Built target df_driver_framework
[ 4%] [ 5%] Built target git_driverframework
Built target xml_gen
[ 5%] Built target git_ecl
[ 5%] Built target git_gazebo
[ 5%] Built target mixer_gen
[ 28%] Built target msg_gen
[ 28%] [ 28%] Built target generate_topic_listener
Built target platforms__common
[ 29%] Built target drivers__boards__sitl
[ 29%] Built target drivers__pwm_out_sim
[ 31%] Built target drivers__device
[ 39%] Built target systemcmds__tests
[ 39%] [ 40%] Built target platforms__posix__drivers__adcsim
Built target platforms__posix__drivers__accelsim
[ 42%] [ 43%] Built target drivers__vmount
Built target drivers__gps
[ 43%] Built target platforms__posix__drivers__barosim
[ 43%] Built target platforms__posix__drivers__airspeedsim
[ 44%] [ 44%] Built target platforms__posix__drivers__gpssim
Built target platforms__posix__drivers__gyrosim
[ 44%] Built target platforms__posix__drivers__ledsim
[ 44%] Built target platforms__posix__drivers__rgbledsim
[ 45%] Built target platforms__posix__drivers__tonealrmsim
[ 46%] Built target platforms__posix__px4_layer
[ 46%] Built target systemcmds__esc_calib
[ 50%] [ 50%] Built target systemcmds__mixer
Built target platforms__posix__work_queue
[ 50%] Built target systemcmds__param
[ 50%] Built target systemcmds__perf
[ 50%] Built target systemcmds__reboot
[ 50%] Built target systemcmds__ver
[ 51%] Built target systemcmds__sd_bench
[ 51%] Built target systemcmds__top
[ 52%] Built target systemcmds__motor_ramp
[ 53%] Built target modules__attitude_estimator_q
[ 54%] Built target systemcmds__topic_listener
[ 54%] Built target modules__dataman
[ 57%] Built target modules__commander
[ 57%] Built target modules__ekf2
[ 57%] Built target lib__external_lgpl
[ 62%] Built target lib__ecl
[ 63%] Built target modules__land_detector
[ 65%] Built target modules__uORB
[ 65%] Built target modules__mc_att_control
[ 67%] Built target modules__mc_pos_control
[ 70%] Built target modules__mavlink
[ 71%] Built target modules__position_estimator_inav
[ 74%] [ 75%] Built target modules__navigator
Built target modules__param
[ 75%] Built target modules__replay
[ 78%] [ 78%] Built target modules__local_position_estimator
[ 79%] Built target modules__sensors
Built target modules__sdlog2
[ 80%] [ 80%] [ 81%] Built target modules__systemlib__mixer
[ 86%] Built target lib__controllib
Built target modules__simulator
Built target modules__systemlib
[ 87%] [ 87%] [ 88%] Built target lib__conversion
Built target lib__DriverFramework__framework
Built target lib__geo
[ 88%] Built target modules__vtol_att_control
[ 88%] [ 88%] [ 89%] Built target lib__mathlib
Built target lib__geo_lookup
Built target lib__launchdetection
[ 90%] Built target lib__mathlib__math__filter
[ 91%] Built target lib__rc
[ 92%] [ 92%] Built target lib__tailsitter_recovery
Built target lib__terrain_estimation
[ 92%] Built target lib__runway_takeoff
[ 92%] Built target examples__px4_simple_app
[ 93%] Built target examples__mc_pos_control_multiplatform
[ 94%] Built target examples__mc_att_control_multiplatform
[ 95%] Built target examples__ekf_att_pos_estimator
[ 95%] Built target examples__attitude_estimator_ekf
[ 95%] [ 96%] Built target lib__rc__rc_tests
Built target drivers__sf0x__sf0x_tests
[ 97%] Built target modules__commander__commander_tests
[ 97%] [ 97%] Built target modules__unit_test
Built target modules__controllib_test
[100%] [ 98%] Built target modules__fw_att_control
Built target modules__uORB__uORB_tests
[100%] [100%] Built target modules__fw_pos_control_l1
Built target modules__logger
[100%] Built target px4
args: /home/anuj/src/Firmware/build_posix_sitl_default/src/firmware/posix/px4 posix-configs/SITL/init/lpe none jmavsim none /home/anuj/src/Firmware /home/anuj/src/Firmware/build_posix_sitl_default
SITL ARGS
sitl_bin: /home/anuj/src/Firmware/build_posix_sitl_default/src/firmware/posix/px4
rcS_dir: posix-configs/SITL/init/lpe
debugger: none
program: jmavsim
model: none
src_path: /home/anuj/src/Firmware
build_path: /home/anuj/src/Firmware/build_posix_sitl_default
empty model, setting iris as default
9772
14117
14812
15607
SITL COMMAND: /home/anuj/src/Firmware/build_posix_sitl_default/src/firmware/posix/px4 /home/anuj/src/Firmware /home/anuj/src/Firmware/posix-configs/SITL/init/lpe/iris
data path: /home/anuj/src/Firmware
commands file: /home/anuj/src/Firmware/posix-configs/SITL/init/lpe/iris


| ___ \ \ \ / / / |
| |/ / \ V / / /| |
| __/ / \ / /
| |
| | / /^\ \ ___ |
| / / |/

px4 starting.

18446744073709551605 WARNING: setRealtimeSched failed (not run as root?)
INFO [dataman] Unkown restart, data manager file 'rootfs/fs/microsd/dataman' size is 103090 bytes
Buildfile: /home/anuj/src/Firmware/Tools/jMAVSim/build.xml

make_dirs:

compile:

create_run_jar:
INFO [platforms__posix__drivers__ledsim] LED::init
INFO [platforms__posix__drivers__ledsim] LED::init
WARN [simulator] bind failed

copy_res:

BUILD SUCCESSFUL
Total time: 0 seconds
Options parsed, starting Sim.
Starting GUI...
3D [dev] 1.6.0-pre12-daily-experimental daily

Thanks

Compile error with openjdk-7

compile:
    [javac] Compiling 58 source files to jMAVSim/out/production/jMAVSim
    [javac] jMAVSim/src/me/drton/jmavsim/SimpleSensors.java:42: error: cannot find symbol
    [javac]         if (java.lang.Double.isFinite(n)) {
    [javac]                             ^
    [javac]   symbol:   method isFinite(double)
    [javac]   location: class Double
    [javac] 1 error

"getting required buffer size failed" on jmavsim simulation on Windows 10

Hello, dear friends!
I derscribed problem and solution I found here: PX4/PX4-Autopilot#11030

But nobody replied me yet, I am not sure if this problem of jmavsim or PX4 Firmware, but file I corrected is in Firmware repository.

Description of the bug
On Windows 10 jmavsim simulation trying to broadcast mavlink (in jmavsim console):
param set MAV_BROADCAST 1
leading system to reproduce error message in endless cycle:
WARN [mavlink] getting required buffer size failed

To Reproduce
I need to connect external ROS system to jmavsim simulation via mavros, to write/test simple python programms for autonomous flight. I do the following steps:

Start simulator:
make px4_sitl jmavsim
In simulator - allow external broadcast of mavlink:
param set MAV_BROADCAST 1
Start mavros on external ros machine to connect to my simulation:
roslaunch mavros px4.launch fcu_url:="udp://@192.168.1.36:14557"
Test the mavros connection to fcu:
rostopic echo /mavros/state

On Linux Ubuntu it works OK, on 4th step I see continious mavlink heartbeat messages.
But when I try to do the same on Windows 10 simulation - on step 2 I have endless cycle of messages in jmavsim console:
WARN [mavlink] getting required buffer size failed
This cycle restarts even when I stop and restart simulation. It ends only after I switch off MAV_BROADCAST=0 on Windows machine via QGroundControl.

Expected behavior
Same good as on Linux.

Additional context
It seems the problem is in https://github.com/PX4/Firmware/blob/master/src/modules/mavlink/mavlink_main.cpp , lines 1029-1046. It has an option for Mac:
ifconf.ifc_len = 1024;
but on Windows program thinks it runs on Linux and because of this misbehaves.

I created Pull request PX4/PX4-Autopilot#11037, but yet there was also no comments.

Proposal: Replacing ExecutorService to achieve more stable timing in the update loop

The update loop is currently scheduled by an ExecutorService, which is known to be not very precise in its cyclic timing.

Therefore I would like to propose another solution for scheduling, which I currently use to avoid or at least reduce issues like polling errors or timeouts e.g. mentioned in this discussion.

Scheduling is implemented like this:

    long sleep_interval_ns;
    if (LOCKSTEP_ENABLED) {`
    	sleep_interval_ns = (long)(sleepInterval / speedFactor / checkFactor)*1000;
    } else {
    	sleep_interval_ns = sleepInterval*1000;
    }
    Thread loop = new Thread(() -> {
		long  wait;
		while(!shutdown) {
			wait = System.nanoTime();
			this.run();
			LockSupport.parkNanos(sleep_interval_ns - (System.nanoTime() - wait));    
		}
	});
    loop.setPriority(Thread.MAX_PRIORITY);
    loop.start();

On OSX this turned out to be much more stable although it is not solving the problem completely.

fields_updated is always 0 for HIL_SENSOR message

It seems that all HIL_SENSOR sent by jMavSim has fields_updated set to 0. According to MavLink specs, this should mean that all fields other than linear acceleration should be ignored. Is this correct interpretation and behaviour? If so then gyro fields in HIL_SENSOR should not be having any effect...

Hexacopter simulation problem in jMAVSim w/ Pixhawk

Hello group members,
I am trying to carry the flight simulation in jMAVSim using Pixhawk controller,
but i have some problem
I want to hexacopter simulation in jMAVSim and edited the 'Simulator.java'
There is a hexacopter code in vehicle folder, and i applied in Simulator.java source code.
But when i shoot the flight simulation in jmavsim, it cannot maneuver well
(altitude change works, but heading change does not work)
did i miss some steps ?
I didnot changed anything in QGC (including frame setting as 'HIL quadroter x')
Actually it worked well w/ the quadcopter code
The only thing i have changed is the Simulator.java code
If someone has some clue for this, I really appreciate it
Thank you :)

ps. Firmware PX4 1.4.4 is used

Compile error with Mac (UDPMavLinkPort.java:107: cannot find symbol)

Hi, I'm trying to compile the project on my Macbook Pro (Mavericks) and I got this compilation error:

carmix$ ant
Buildfile: /Users/carmix/Documents/jMAVSim/build.xml

make_dirs:

compile:
[javac] Compiling 23 source files to /Users/carmix/Documents/jMAVSim/out/production/jMAVSim
[javac] /Users/carmix/Documents/jMAVSim/src/me/drton/jmavsim/UDPMavLinkPort.java:107: cannot find symbol
[javac] symbol : method getLoopbackAddress()
[javac] location: class java.net.InetAddress
[javac] possibleAddress = InetAddress.getLoopbackAddress();
[javac] ^
[javac] /Users/carmix/Documents/jMAVSim/src/me/drton/jmavsim/UDPMavLinkPort.java:137: cannot find symbol
[javac] symbol : method getRemoteAddress()
[javac] location: class java.nio.channels.DatagramChannel
[javac] SocketAddress remote = channel.getRemoteAddress();
[javac] ^
[javac] 2 errors

BUILD FAILED
/Users/carmix/Documents/jMAVSim/build.xml:20: Compile failed; see the compiler error output for details.

Could you help me?

Crash with macOS and Java 9

On macOS with Java 9 we get the follow segfault:

WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by javax.media.j3d.JoglPipeline (rsrc:j3dcore.jar) to method sun.awt.AppContext.getAppContext()
WARNING: Please consider reporting this to the maintainers of javax.media.j3d.JoglPipeline
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
#
# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGSEGV (0xb) at pc=0x00000001096ac0cc, pid=62391, tid=775
#
# JRE version: Java(TM) SE Runtime Environment (9.0+11) (build 9.0.4+11)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (9.0.4+11, mixed mode, tiered, compressed oops, g1 gc, bsd-amd64)
# Problematic frame:
# C  [libosxapp.dylib+0x20cc]  -[NSApplicationAWT sendEvent:]+0x179
#
# No core dump will be written. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
#
# An error report file with more information is saved as:
# /Users/julianoes/src/Firmware/Tools/jMAVSim/out/production/hs_err_pid62391.log
#
# If you would like to submit a bug report, please visit:
#   http://bugreport.java.com/bugreport/crash.jsp
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#
/Users/julianoes/src/Firmware/Tools/jmavsim_run.sh: line 47: 62391 Abort trap: 6           java -XX:GCTimeRatio=20 -Djava.ext.dirs= -jar jmavsim_run.jar $device $extra_args
Options parsed, starting Sim.
Starting GUI...
3D [dev] 1.6.0-pre12-daily-experimental daily

WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by javax.media.j3d.JoglPipeline (rsrc:j3dcore.jar) to method sun.awt.AppContext.getAppContext()
WARNING: Please consider reporting this to the maintainers of javax.media.j3d.JoglPipeline
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
#
# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGSEGV (0xb) at pc=0x000000010f8730cc, pid=62393, tid=775
#
# JRE version: Java(TM) SE Runtime Environment (9.0+11) (build 9.0.4+11)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (9.0.4+11, mixed mode, tiered, compressed oops, g1 gc, bsd-amd64)
# Problematic frame:
# C  [libosxapp.dylib+0x20cc]  -[NSApplicationAWT sendEvent:]+0x179
#
# No core dump will be written. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
#
# An error report file with more information is saved as:
# /Users/julianoes/src/Firmware/Tools/jMAVSim/out/production/hs_err_pid62393.log
#
# If you would like to submit a bug report, please visit:
#   http://bugreport.java.com/bugreport/crash.jsp
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#
---------------  S U M M A R Y ------------

Command Line: -XX:GCTimeRatio=20 -Djava.ext.dirs= jmavsim_run.jar -udp 127.0.0.1:14560 -r 500

Host: MacBookPro12,1 x86_64 2700 MHz, 4 cores, 8G, Darwin 17.7.0
Time: Thu Sep 13 11:18:10 2018 CEST elapsed time: 6 seconds (0d 0h 0m 6s)

---------------  T H R E A D  ---------------

Current thread (0x00007f838098e800):  JavaThread "AppKit Thread" daemon [_thread_in_native, id=775, stack(0x00007ffee61b5000,0x00007ffeea1b4000)]

Stack: [0x00007ffee61b5000,0x00007ffeea1b4000],  sp=0x00007ffeea1b1430,  free space=65521k
Native frames: (J=compiled Java code, A=aot compiled Java code, j=interpreted, Vv=VM code, C=native code)
C  [libosxapp.dylib+0x20cc]  -[NSApplicationAWT sendEvent:]+0x179
C  [AppKit+0x368b5]  -[NSApplication run]+0x32c
C  [libosxapp.dylib+0x1d3a]  +[NSApplicationAWT runAWTLoopWithApp:]+0x9d
C  [libawt_lwawt.dylib+0x3a544]  +[AWTStarter starter:headless:]+0x342
C  [JavaNativeFoundation+0x6f4a]  +[JNFRunLoop _performCopiedBlock:]+0x11
C  [Foundation+0x682b5]  __NSThreadPerformPerform+0x14e
C  [CoreFoundation+0xa3a11]  __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__+0x11
C  [CoreFoundation+0x15d42c]  __CFRunLoopDoSource0+0x6c
C  [CoreFoundation+0x86470]  __CFRunLoopDoSources0+0xd0
C  [CoreFoundation+0x858ed]  __CFRunLoopRun+0x50d
C  [CoreFoundation+0x85153]  CFRunLoopRunSpecific+0x1e3
C  [java+0x6b2e]  CreateExecutionEnvironment+0x35c
C  [java+0x2c65]  JLI_Launch+0x5a9
C  [java+0x1b62]  main+0x186
C  [java+0x19d4]  start+0x34
C  0x0000000000000009


siginfo: si_signo: 11 (SIGSEGV), si_code: 1 (SEGV_MAPERR), si_addr: 0x0000000000000010

Register to memory mapping:

RAX=0x0000000000000000 is an unknown value
RBX=0x0000000000000000 is an unknown value
RCX=0x000000000021e000 is an unknown value
RDX=0x000000000021e000 is an unknown value
RSP=0x00007ffeea1b1430 is pointing into the stack for thread: 0x00007f838098e800
RBP=0x00007ffeea1b1460 is pointing into the stack for thread: 0x00007f838098e800
RSI=0x00007fff2d51d1e5: .str.41.llvm.C4DC25C8+0x4a728 in /System/Library/Frameworks/AppKit.framework/Versions/C/AppKit at 0x00007fff2c83c000
RDI=0x0000000000000000 is an unknown value
R8 =0x00000000000000ff is an unknown value
R9 =0x00007f8384944d00 is an unknown value
R10=0x00efdc0100ef4600 is an unknown value
R11=0x00007fff2c9e8817: -[NSEvent data1]+0 in /System/Library/Frameworks/AppKit.framework/Versions/C/AppKit at 0x00007fff2c83c000
R12=0x00007f8384944d00 is an unknown value
R13=0x00007f83807e82c0 is an unknown value
R14=0x00007fff564fbe80: objc_msgSend+0 in /usr/lib/libobjc.A.dylib at 0x00007fff564f5000
R15=0x00007f8380538520 is an unknown value


Registers:
RAX=0x0000000000000000, RBX=0x0000000000000000, RCX=0x000000000021e000, RDX=0x000000000021e000
RSP=0x00007ffeea1b1430, RBP=0x00007ffeea1b1460, RSI=0x00007fff2d51d1e5, RDI=0x0000000000000000
R8 =0x00000000000000ff, R9 =0x00007f8384944d00, R10=0x00efdc0100ef4600, R11=0x00007fff2c9e8817
R12=0x00007f8384944d00, R13=0x00007f83807e82c0, R14=0x00007fff564fbe80, R15=0x00007f8380538520
RIP=0x00000001096ac0cc, EFLAGS=0x0000000000010246, ERR=0x0000000000000004
  TRAPNO=0x000000000000000e

Top of Stack: (sp=0x00007ffeea1b1430)
0x00007ffeea1b1430:   00007ffeea1b1450 ffff807c7b6bb300
0x00007ffeea1b1440:   00007fff564fbe80 00007fff564fbe80
0x00007ffeea1b1450:   0000000000000001 00007f8380538520
0x00007ffeea1b1460:   00007ffeea1b1510 00007fff2c8728b5
0x00007ffeea1b1470:   00007fff2d516211 00007f8380538520
0x00007ffeea1b1480:   00007fff2d50eee0 00007fff2d5170fe
0x00007ffeea1b1490:   00007fff893f9178 00007fff2d50db3d
0x00007ffeea1b14a0:   00007fff2d50d813 0000000000000010
0x00007ffeea1b14b0:   00007fff2d50d003 00007fff2d51d1eb
0x00007ffeea1b14c0:   00007fff2d50ce91 00007fff2d50d82d
0x00007ffeea1b14d0:   00007fff2d50d859 0000000000000062
0x00007ffeea1b14e0:   00007fff2d50d937 00007f8380538520
0x00007ffeea1b14f0:   00007fff564fbe80 00000001096b0690
0x00007ffeea1b1500:   00007fff2d516211 00000001096b06b0
0x00007ffeea1b1510:   00007ffeea1b1550 00000001096abd3a
0x00007ffeea1b1520:   0000000000000000 00007f838062a7b0
0x00007ffeea1b1530:   00007fff564fbe80 00007f8380538520
0x00007ffeea1b1540:   00007f83804462a0 0000000000000000
0x00007ffeea1b1550:   00007ffeea1b15a0 0000000109624544
0x00007ffeea1b1560:   00007f8380538520 0000000000000000
0x00007ffeea1b1570:   00007f83804462a0 00007f838061dc20
0x00007ffeea1b1580:   00007f83804041a0 00007fff2d50ce91
0x00007ffeea1b1590:   00007f838061de50 0000000000000000
0x00007ffeea1b15a0:   00007ffeea1b15c0 00007fff3301ef4a
0x00007ffeea1b15b0:   0000000000000018 0000000000000001
0x00007ffeea1b15c0:   00007ffeea1b1640 00007fff314262b5
0x00007ffeea1b15d0:   0000000000000001 00007fff2d50cf70
0x00007ffeea1b15e0:   00007f83804041a0 00007f838061b850
0x00007ffeea1b15f0:   00007fff2d514372 00007fff2d5673b7
0x00007ffeea1b1600:   00007fff2d514377 00007fff2d50d003
0x00007ffeea1b1610:   00007ffeea1b1650 00007fff31426167
0x00007ffeea1b1620:   0000000300002e88 0000000000000000 

Instructions: (pc=0x00000001096ac0cc)
0x00000001096ac0ac:   41 5f 5d c3 48 8b 35 51 58 00 00 4c 8b 35 ca 3f
0x00000001096ac0bc:   00 00 48 89 df 41 ff d6 48 89 c3 31 c0 48 89 df
0x00000001096ac0cc:   ff 53 10 48 8b 35 1a 56 00 00 48 89 df 4c 89 f0
0x00000001096ac0dc:   48 83 c4 18 5b 41 5e 41 5f 5d ff e0 55 48 89 e5 


---------------  P R O C E S S  ---------------

Java Threads: ( => current thread )
  0x00007f8381bd4000 JavaThread "J3D-Renderer-1" [_thread_blocked, id=72451, stack(0x000070000bb92000,0x000070000bc92000)]
  0x00007f83814ae000 JavaThread "J3D-MasterControl-1" [_thread_blocked, id=72707, stack(0x000070000ba8f000,0x000070000bb8f000)]
  0x00007f8381de2000 JavaThread "J3D-NotificationThread" [_thread_blocked, id=57603, stack(0x000070000b98c000,0x000070000ba8c000)]
  0x00007f8381c2a000 JavaThread "J3D-TimerThread" [_thread_blocked, id=73223, stack(0x000070000b889000,0x000070000b989000)]
  0x00007f8381df7800 JavaThread "J3D-RenderingAttributesStructureUpdateThread" [_thread_blocked, id=73747, stack(0x000070000b786000,0x000070000b886000)]
  0x00007f8381cdc000 JavaThread "AWT-EventQueue-0" [_thread_blocked, id=76051, stack(0x000070000b683000,0x000070000b783000)]
  0x00007f8381519800 JavaThread "Java2D Disposer" daemon [_thread_blocked, id=56079, stack(0x000070000b580000,0x000070000b680000)]
  0x00007f8381bf1800 JavaThread "Java2D Queue Flusher" daemon [_thread_blocked, id=83111, stack(0x000070000b47d000,0x000070000b57d000)]
  0x00007f8380c77800 JavaThread "AWT-Shutdown" [_thread_blocked, id=35115, stack(0x000070000b16e000,0x000070000b26e000)]
=>0x00007f838098e800 JavaThread "AppKit Thread" daemon [_thread_in_native, id=775, stack(0x00007ffee61b5000,0x00007ffeea1b4000)]
  0x00007f83818c9000 JavaThread "Service Thread" daemon [_thread_blocked, id=41219, stack(0x000070000af68000,0x000070000b068000)]
  0x00007f8382006000 JavaThread "Common-Cleaner" daemon [_thread_blocked, id=41475, stack(0x000070000ae65000,0x000070000af65000)]
  0x00007f8382000000 JavaThread "Sweeper thread" daemon [_thread_blocked, id=41987, stack(0x000070000ad62000,0x000070000ae62000)]
  0x00007f8381890800 JavaThread "C1 CompilerThread2" daemon [_thread_blocked, id=42499, stack(0x000070000ac5f000,0x000070000ad5f000)]
  0x00007f838188f800 JavaThread "C2 CompilerThread1" daemon [_thread_in_native, id=43011, stack(0x000070000ab5c000,0x000070000ac5c000)]
  0x00007f8381091000 JavaThread "C2 CompilerThread0" daemon [_thread_in_native, id=43267, stack(0x000070000aa59000,0x000070000ab59000)]
  0x00007f838188f000 JavaThread "Signal Dispatcher" daemon [_thread_blocked, id=16395, stack(0x000070000a956000,0x000070000aa56000)]
  0x00007f8380803800 JavaThread "Finalizer" daemon [_thread_blocked, id=18435, stack(0x000070000a853000,0x000070000a953000)]
  0x00007f8381864000 JavaThread "Reference Handler" daemon [_thread_blocked, id=14595, stack(0x000070000a750000,0x000070000a850000)]
  0x00007f8381017800 JavaThread "main" [_thread_blocked, id=6403, stack(0x0000700009a29000,0x0000700009b29000)]

Other Threads:
  0x00007f8381873000 VMThread "VM Thread" [stack: 0x000070000a64d000,0x000070000a74d000] [id=14083]
  0x00007f83810e3800 WatcherThread [stack: 0x000070000b06b000,0x000070000b16b000] [id=22531]
  0x00007f8381020000 GCTaskThread "GC Thread#0" [stack: 0x0000700009b2c000,0x0000700009c2c000] [id=11011]
  0x00007f8381020800 GCTaskThread "GC Thread#1" [stack: 0x0000700009c2f000,0x0000700009d2f000] [id=21507]
  0x00007f8381021800 GCTaskThread "GC Thread#2" [stack: 0x0000700009d32000,0x0000700009e32000] [id=21251]
  0x00007f8381812000 GCTaskThread "GC Thread#3" [stack: 0x0000700009e35000,0x0000700009f35000] [id=12035]
  0x00007f8381838000 ConcurrentGCThread "G1 Main Marker" [stack: 0x000070000a447000,0x000070000a547000] [id=19203]
  0x00007f8381838800 ConcurrentGCThread "G1 Marker#0" [stack: 0x000070000a54a000,0x000070000a64a000] [id=13571]
  0x00007f8381008800 ConcurrentGCThread "G1 Refine#0" [stack: 0x000070000a241000,0x000070000a341000] [id=19715]
  0x00007f8381008000 ConcurrentGCThread "G1 Refine#1" [stack: 0x000070000a13e000,0x000070000a23e000] [id=19971]
  0x00007f8380803000 ConcurrentGCThread "G1 Refine#2" [stack: 0x000070000a03b000,0x000070000a13b000] [id=20483]
  0x00007f8381812800 ConcurrentGCThread "G1 Refine#3" [stack: 0x0000700009f38000,0x000070000a038000] [id=12291]
  0x00007f8381009800 ConcurrentGCThread "G1 Young RemSet Sampling" [stack: 0x000070000a344000,0x000070000a444000] [id=19459]

Threads with active compile tasks:
C2 CompilerThread11799       4       java.lang.invoke.InvokerBytecodeGenerator::emitImplicitConversion (159 bytes)
C2 CompilerThread01837       4       java.util.jar.JarFile::getEntry (60 bytes)

VM state:not at safepoint (normal execution)

VM Mutex/Monitor currently owned by a thread: None

Heap address: 0x0000000740000000, size: 2048 MB, Compressed Oops mode: Zero based, Oop shift amount: 3
Narrow klass base: 0x0000000000000000, Narrow klass shift: 3
Compressed class space size: 1073741824 Address: 0x00000007c0000000

Looks the same as this:
https://bugs.openjdk.java.net/browse/JDK-8197910

More workarounds and tries that didn't work for me:
http://forum.jogamp.org/Jogl-Jogamp-on-Java-9-tt4038012.html

Pixhawk won't take off...

I'm trying to do hardware in the loop simulation with Pixhawk and JMAVSim but take off command is doing nothing. I can arm the pixhawk, and send take off commands, and Pixhawk is processing them (mc_att_control is generating thrust) but it seems the actuator_controls never turns into actuator_outputs which means it never shows up in mavlink HIL_CONTROLS message.

Is there some additional setup I'm missing? I've tried playing with pwm_out_sim with no luck... seems to me in HITL mode someone should intercept actuator_control and turn around and publish it as actuator_output, and pwm_out_sim seems to be doing that, but it does other stuff trying to drive the actual /dev/pwm_output0 which fails because that driver already exists.

So is there some setup I'm missing here? How to get px4io to pipe PX4IO_PAGE_CONTROLS right back in PX4IO_PAGE_SERVOS so that it gets picked up and published as ORB_ID(actuator_outputs) ?

PS : I want to do it with no motors actually attached to the Pixhawk of course. Just bare Pixhawk on my desk.

Communication unexpectedly lost in both the terminal and while using QGroundControl

Hello, I have been working with jMavSim and when I first load it, everything works fine and I am able to run commander commands to have the drone arm, takeoff, land, and disarm. However, after a few minutes, the simulator will announce "communication lost" and all following commands will not work. How do I ensure that this does not happen, or at least that I can regain connection without having to leave the program and rerun it?

Similarly, while using QGroundControl I am able to connect the simulator, upload a mission and run it, however sometimes in the middle of the mission the simulator will disconnect and I will be unable to reconnect it to QGroundControl without rerunning the program.

New PX4 firmware + jMAVSim fails to build on Windows 10

Installed new Windows Toolchain 0.9 on Windows 10 Professional x64, then, as usial:

git clone --recursive -j8 https://github.com/PX4/Firmware.git
cd Firmware
make px4_sitl jmavsim

fails with compilation error:

$ make px4_sitl jmavsim
-- PX4 version: v1.11.0-rc3-727-g0db70ea475
-- PX4 config file: /cygdrive/c/PX4/home/Firmware/boards/px4/sitl/default.cmake
-- PX4 config: px4_sitl_default
-- PX4 platform: posix
-- PX4 lockstep: enabled
-- cmake build type: RelWithDebInfo
-- The CXX compiler identification is GNU 9.3.0
-- The C compiler identification is GNU 9.3.0
-- The ASM compiler identification is GNU
-- Found assembler: /usr/bin/cc
-- Check for working CXX compiler: /usr/bin/c++.exe
-- Check for working CXX compiler: /usr/bin/c++.exe -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Building for code coverage
-- Found PythonInterp: /usr/bin/python3 (found suitable version "3.6.9", minimum required is "3")
-- build type is RelWithDebInfo
-- PX4 ECL: Very lightweight Estimation & Control Library v1.9.0-rc1-470-gda9f314
-- ROMFS: px4fmu_common
-- Configuring done
-- Generating done
-- Build files have been written to: /cygdrive/c/PX4/home/Firmware/build/px4_sitl_default
[0/761] git submodule src/drivers/gps/devices
[6/761] git submodule src/lib/ecl
[11/761] git submodule mavlink/include/mavlink/v2.0
[13/761] git submodule Tools/jMAVSim
[16/761] Generating ../romfs_files.tar
FAILED: romfs_files.tar
cd /cygdrive/c/PX4/home/Firmware/ROMFS/px4fmu_common && /usr/bin/cmake.exe -E tar cf /cygdrive/c/PX4/home/Firmware/build/px4_sitl_default/romfs_files.tar init.d/airframes/1000_rc_fw_easystar.hil init.d/airframes/1001_rc_quad_x.hil init.d/airframes/1002_standard_vtol.hil init.d/airframes/1100_rc_quad_x_sih.hil init.d/airframes/2100_standard_plane init.d/airframes/2105_maja init.d/airframes/2106_albatross init.d/airframes/2200_mini_talon init.d/airframes/2507_cloudship init.d/airframes/3000_generic_wing init.d/airframes/3030_io_camflyer init.d/airframes/3031_phantom init.d/airframes/3032_skywalker_x5 init.d/airframes/3033_wingwing init.d/airframes/3034_fx79 init.d/airframes/3035_viper init.d/airframes/3036_pigeon init.d/airframes/3037_parrot_disco_mod init.d/airframes/3100_tbs_caipirinha init.d/airframes/4001_quad_x init.d/airframes/4003_qavr5 init.d/airframes/4009_qav250 init.d/airframes/4010_dji_f330 init.d/airframes/4011_dji_f450 init.d/airframes/4014_s500 init.d/airframes/4015_holybro_s500 init.d/airframes/4016_holybro_px4vision init.d/airframes/4017_nxp_hovergames init.d/airframes/4020_hk_micro_pcb init.d/airframes/4030_3dr_solo init.d/airframes/4031_3dr_quad init.d/airframes/4040_reaper init.d/airframes/4041_beta75x init.d/airframes/4050_generic_250 init.d/airframes/4051_s250aq init.d/airframes/4052_holybro_qav250 init.d/airframes/4053_holybro_kopis2 init.d/airframes/4060_dji_matrice_100 init.d/airframes/4070_aerofc init.d/airframes/4071_ifo init.d/airframes/4072_draco init.d/airframes/4073_ifo-s init.d/airframes/4080_zmr250 init.d/airframes/4090_nanomind init.d/airframes/4100_tiltquadrotor init.d/airframes/4250_teal init.d/airframes/4500_clover4 init.d/airframes/4900_crazyflie init.d/airframes/5001_quad_+ init.d/airframes/6001_hexa_x init.d/airframes/6002_draco_r init.d/airframes/7001_hexa_+ init.d/airframes/8001_octo_x init.d/airframes/9001_octo_+ init.d/airframes/10015_tbs_discovery init.d/airframes/10016_3dr_iris init.d/airframes/10017_steadidrone_qu4d init.d/airframes/10018_tbs_endurance init.d/airframes/11001_hexa_cox init.d/airframes/12001_octo_cox init.d/airframes/12002_steadidrone_mavrik init.d/airframes/13000_generic_vtol_standard init.d/airframes/13001_caipirinha_vtol init.d/airframes/13002_firefly6 init.d/airframes/13003_quad_tailsitter init.d/airframes/13004_quad+_tailsitter init.d/airframes/13005_vtol_AAERT_quad init.d/airframes/13006_vtol_standard_delta init.d/airframes/13007_vtol_AAVVT_quad init.d/airframes/13008_QuadRanger init.d/airframes/13009_vtol_spt_ranger init.d/airframes/13010_claire init.d/airframes/13012_convergence init.d/airframes/13013_deltaquad init.d/airframes/13014_vtol_babyshark init.d/airframes/13050_generic_vtol_octo init.d/airframes/13200_generic_vtol_tailsitter init.d/airframes/14001_tri_y_yaw+ init.d/airframes/14002_tri_y_yaw- init.d/airframes/15001_coax_heli init.d/airframes/16001_helicopter init.d/airframes/17002_TF-AutoG2 init.d/airframes/24001_dodeca_cox init.d/airframes/50000_generic_ground_vehicle init.d/airframes/50001_axialracing_ax10 init.d/airframes/50002_traxxas_stampede_2wd init.d/airframes/50003_aion_robotics_r1_rover init.d/airframes/50004_nxpcup_car_dfrobot_gpx init.d/airframes/60000_uuv_generic init.d/airframes/60001_uuv_hippocampus init.d/airframes/60002_uuv_bluerov2_heavy init.d/rc.airship_apps init.d/rc.airship_defaults init.d/rc.boat_defaults init.d/rc.fw_apps init.d/rc.fw_defaults init.d/rc.interface init.d/rc.io init.d/rc.logging init.d/rc.mc_apps init.d/rc.mc_defaults init.d/rcS init.d/rc.sensors init.d/rc.thermal_cal init.d/rc.rover_apps init.d/rc.rover_defaults init.d/rc.uuv_apps init.d/rc.uuv_defaults init.d/rc.vehicle_setup init.d/rc.vtol_apps init.d/rc.vtol_defaults mixers/AAERTWF.main.mix mixers/AAVVTWFF.main.mix mixers/AAVVTWFF_vtail.main.mix mixers/AERT.main.mix mixers/AETRFG.main.mix mixers/babyshark.main.mix mixers/blade130.main.mix mixers/caipi.main.mix mixers/CCPM.main.mix mixers/claire.aux.mix mixers/claire.main.mix mixers/cloudship.main.mix mixers/coax.main.mix mixers/delta.main.mix mixers/deltaquad.main.mix mixers/dodeca_bottom_cox.aux.mix mixers/dodeca_top_cox.main.mix mixers/firefly6.aux.mix mixers/firefly6.main.mix mixers/fw_generic_wing.main.mix mixers/FX79.main.mix mixers/generic_diff_rover.main.mix mixers/hexa_cox.main.mix mixers/hexa_+.main.mix mixers/hexa_x.main.mix mixers/IO_pass.main.mix mixers/mount.aux.mix mixers/mount_legs.aux.mix mixers/octo_cox.main.mix mixers/octo_cox_w.main.mix mixers/octo_+.main.mix mixers/octo_x.main.mix mixers/pass.aux.mix mixers/phantom.main.mix mixers/quad_dc.main.mix mixers/quad_h.main.mix mixers/quad_+.main.mix mixers/quad_s250aq.main.mix mixers/quad_+_vtol.main.mix mixers/quad_w.main.mix mixers/quad_x_cw.main.mix mixers/quad_x.main.mix mixers/quad_x_vtol.main.mix mixers/rover_diff_and_servo.main.mix mixers/rover_generic.main.mix mixers/stampede.main.mix mixers/standard_vtol_hitl.main.mix mixers/TF-AutoG2.main.mix mixers/tilt_quad.aux.mix mixers/tilt_quad.main.mix mixers/tri_y_yaw+.main.mix mixers/tri_y_yaw-.main.mix mixers/uuv_x.main.mix mixers/vectored6dof.main.mix mixers/Viper.main.mix mixers/vtol_AAERT.aux.mix mixers/vtol_AAVVT.aux.mix mixers/vtol_convergence.main.mix mixers/vtol_delta.aux.mix mixers/vtol_tailsitter_duo.main.mix mixers/wingwing.main.mix mixers-sitl/autogyro_sitl.main.mix mixers-sitl/boat_sitl.main.mix mixers-sitl/delta_wing_sitl.main.mix mixers-sitl/plane_sitl.main.mix mixers-sitl/quad_x_vtol.main.mix mixers-sitl/rover_ackermann_sitl.main.mix mixers-sitl/rover_diff_sitl.main.mix mixers-sitl/standard_vtol_sitl.main.mix mixers-sitl/tiltrotor_sitl.main.mix mixers-sitl/uuv_x_sitl.main.mix mixers-sitl/vectored6dof_sitl.main.mix init.d-posix/airframes/10016_iris init.d-posix/airframes/10020_if750a init.d-posix/airframes/10030_px4vision init.d-posix/airframes/1010_iris_opt_flow init.d-posix/airframes/1010_iris_opt_flow.post init.d-posix/airframes/1011_iris_irlock init.d-posix/airframes/1012_iris_rplidar init.d-posix/airframes/1013_iris_vision init.d-posix/airframes/1013_iris_vision.post init.d-posix/airframes/1014_solo init.d-posix/airframes/1015_iris_obs_avoid init.d-posix/airframes/1015_iris_obs_avoid.post init.d-posix/airframes/1016_iris_rtps init.d-posix/airframes/1016_iris_rtps.post init.d-posix/airframes/1017_iris_opt_flow_mockup init.d-posix/airframes/1018_iris_vision_velocity init.d-posix/airframes/1019_iris_dual_gps init.d-posix/airframes/1020_uuv_generic init.d-posix/airframes/1021_uuv_hippocampus init.d-posix/airframes/1022_uuv_bluerov2_heavy init.d-posix/airframes/1030_plane init.d-posix/airframes/1031_plane_cam init.d-posix/airframes/1032_plane_catapult init.d-posix/airframes/1033_plane_lidar init.d-posix/airframes/1033_rascal init.d-posix/airframes/1034_rascal-electric init.d-posix/airframes/1035_techpod init.d-posix/airframes/1036_malolo init.d-posix/airframes/1040_standard_vtol init.d-posix/airframes/1041_tailsitter init.d-posix/airframes/1042_tiltrotor init.d-posix/airframes/1060_rover init.d-posix/airframes/1061_r1_rover init.d-posix/airframes/1062_tf-r1 init.d-posix/airframes/1070_boat init.d-posix/airframes/3010_quadrotor_x init.d-posix/airframes/3011_hexarotor_x init.d-posix/airframes/17001_tf-g1 init.d-posix/airframes/2507_cloudship init.d-posix/airframes/6011_typhoon_h480 init.d-posix/airframes/6011_typhoon_h480.post init.d-posix/rc.replay init.d-posix/rcS
CMake Error: archive_write_header: archive_write_pax_header: 'x' header failed?!  This can't happen.

CMake Error: Problem creating tar: /cygdrive/c/PX4/home/Firmware/build/px4_sitl_default/romfs_files.tar
[18/761] Generating git version header
ninja: build stopped: subcommand failed.
make: *** [Makefile:226: px4_sitl] Error 1

Tried to checkout to previous releases (1.10, 1.09) - it did not help, same error.
How to repair it?...

Can't get jMAVSim to work

Hi guys,
I've been literally trying the whole weekend to get jMAVSim to work but it's been imposible (probably because of my very basic knowledge). When I try to execute the comand:
make px4_sitl jmavsim
I get px4 to start but then (if i'm not mistaken) it tries to open jMAVSim but this error occurs:
Starting GUI...
Exception in thread "main" java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader.main(JarRsrcLoader.java:61)
Caused by: java.awt.AWTError: Assistive Technology not found: org.GNOME.Accessibility.AtkWrapper
at java.awt.Toolkit.loadAssistiveTechnologies(Toolkit.java:807)
at java.awt.Toolkit.getDefaultToolkit(Toolkit.java:886)
at java.awt.Window.getToolkit(Window.java:1358)
at java.awt.Window.init(Window.java:506)
at java.awt.Window.<init>(Window.java:537)
at java.awt.Frame.<init>(Frame.java:420)
at java.awt.Frame.<init>(Frame.java:385)
at javax.swing.JFrame.<init>(JFrame.java:189)
at me.drton.jmavsim.Visualizer3D.<init>(Visualizer3D.java:104)
at me.drton.jmavsim.Simulator.<init>(Simulator.java:157)
at me.drton.jmavsim.Simulator.main(Simulator.java:678)
... 5 more

Does anyone know how to fix this? I've tried so hard but I can't seem to get it working. Thanks in advanced

Still crash on load due to missing image file

@mpaperno @LorenzMeier
I have a problem in anting the project jmavsim. I also get a crash on boot because the image is not found:

Exception in thread "main" java.lang.IllegalArgumentException: input == null!
at javax.imageio.ImageIO.read(ImageIO.java:1388)
at me.drton.jmavsim.Visualizer3D$CustomCanvas3D.(Visualizer3D.java:707)
at me.drton.jmavsim.Visualizer3D.(Visualizer3D.java:114)
at me.drton.jmavsim.Simulator.(Simulator.java:209)
at me.drton.jmavsim.Simulator.main(Simulator.java:611)
I also used followed code, but it still report this errors.
java -Djava.ext.dirs= -cp lib/*:out/production/jmavsim.jar me.drton.jmavsim.Simulator

In aternate build method. the terminal report that the error is followed:

  • BUILD FAILED
    Target "creat_run_jar" does not exist in the project "jMAVSim".

OS:Ubuntu 14.04 64bit
FIle:/home/user

Is HIL_STATE_QUATERNION missing in MAVLinkHILSystem.java ?

The PX4 stack seems to expect HIL_STATE_QUATERNION and this is the only way the global_position gets set. The HITL simulation doesn't work without that. Would this be the right code to add ?

    GNSSReport gnss = sensors.getGNSS();
    if (gnss != null) {
        MAVLinkMessage msg_quaternion = new MAVLinkMessage(schema, "HIL_STATE_QUATERNION", sysId, componentId);
        msg_quaternion.set("time_usec", tu);
        Quat4d quaternion = new Quat4d();
        quaternion.set(vehicle.getRotation());
        Object[] quat = new Object[4];
        quat[0] = (float) quaternion.getW();
        quat[1] = (float) quaternion.getX();
        quat[2] = (float) quaternion.getY();
        quat[3] = (float) quaternion.getZ();
        msg_quaternion.set("attitude_quaternion", quat);
        Vector3d rotationRate = vehicle.getRotationRate();
        msg_quaternion.set("rollspeed", (float) rotationRate.getX());
        msg_quaternion.set("pitchspeed", (float) rotationRate.getY());
        msg_quaternion.set("yawspeed", (float) rotationRate.getZ());
        msg_quaternion.set("lat", (long) (gnss.position.lat * 1e7));
        msg_quaternion.set("lon", (long) (gnss.position.lon * 1e7));
        msg_quaternion.set("alt", (long) (gnss.position.alt * 1e3));
        msg_quaternion.set("vx", (int) (gnss.velocity.x * 100));
        msg_quaternion.set("vy", (int) (gnss.velocity.y * 100));
        msg_quaternion.set("vz", (int) (gnss.velocity.z * 100));
        tv = sensors.getAcc();
        msg_quaternion.set("xacc", tv.x);
        msg_quaternion.set("yacc", tv.y);
        msg_quaternion.set("zacc", tv.z);
        sendMessage(msg_quaternion);
    }

I've tried it, and the drone now takes off when I type "commander takeoff", but it flips over...

Not compatible with PX4 v1.7.3

I tried HITL with PX4 v1.7.3 stable which flashed on my Pixhawk2.
But I can't take off or control due to consist MANUAL CONTROL LOST, REGAIN warning.
please help me about this. Is it fixing or new bug?
Regards.

Intel Aero RTF HITL -SYS_HITL mode jMavSim - WARN [commander] rejecting takeoff, no position lock yet.

Hello. I am about to run HITL (Hardware In The Loop simulation). I am about to use jMavSim. But it seems, that QGround Control and jMavsim are not talking to each other. Or JMAVSim is not sending position lock info to Aero FC. Below are the steps I have done recently

1.Trough Nuttx Shell I set param set SYS_HITL 1 and SYS_AUTOSTART to 1001

2.But after reboot SYS_AUTOSTART keeps changing to 4070 (Aero RTF Frame) as I can see from Nuttx SyS console during boot + SYS_AUTOSTART: curr: 1001 -> new: 4070

  1. Running JMAVSim in UDP mode connecting to wifi of Aero Board ./jmavsim_run.sh -i 192.168.8.1 -r 250 on Ubuntu. As per sh script default port is 14560 and it writes Init MAVlink to terminal

4.Than I run QGround connected trough UDP - default configuration. Port 14550

  1. I can arm and disarm trough QGC. But no MAV messages are visible in JMAVSim terminal. When I try take off in QGC. Nuttx console writes WARN [commander] rejecting takeoff, no position lock yet.

  2. When I try the same by running commander takeoff in Nuttx console. Result is the same WARN [commander] rejecting takeoff, no position lock yet.

I guess WARN [commander] rejecting takeoff, no position lock yet. Please retry.. is because JMavsim is not sending message to Aero FC.....because SYS_AUTOSTART can not be set permanently to 1001?And also when I run gps status on NSH console. lat,lon values are not provided from jMAVSIM

INFO [gps] Main GPS
INFO [gps] protocol: UBX
INFO [gps] port: /dev/ttyS5, baudrate: 38400, status: OK
INFO [gps] sat info: disabled, noise: 95, jamming detected: NO
INFO [gps] position lock: 0, satellites: 0, last update: 78.8240ms ago
INFO [gps] lat: 0, lon: 0, alt: -17000
INFO [gps] vel: 0.00m/s, 0.00m/s, 0.00m/s
INFO [gps] hdop: 99.99, vdop: 99.99
INFO [gps] eph: 4294967.50m, epv: 3750725.00m
INFO [gps] rate position: 0.00 Hz
INFO [gps] rate velocity: 0.00 Hz
INFO [gps] rate publication: 0.00 Hz
INFO [gps] rate RTCM injection: 0.00 Hz

Any suggestions please?

Restore serial port functionality

@mcharleb @molecule The serial port functionality in this port seems problematic, I couldn't get normal HIL to work. Is this something you're interested to maintain / have a look or should I add this to my list? I would have a slight preference for our Java guru @molecule to own this part of the project, but I do realize that HIL is out of your area of focus.

make px4_sitl jmavsim misbehaving. (OSX)

When you run this from the PX4 repo following all the directions it comes up ok, BUT the moment you arm the drone just ascends without bound.
I have joystick hooked up and I can yaw and but it just keeps climbing.
I've tried everything I can think of but no matter what it just climbs.

I started this because I am attempting to help others on the discussion forum but now I am stumped.
I think it's because the baro sim is off but I have no idea how to solve that.
WARN [ecl/EKF] baro hgt timeout - reset to gps

It doesn't work on RX560

Here is the output:

Options parsed, starting Sim.
Starting GUI...
3D [dev] 1.6.0-pre12-daily-experimental daily

com.jogamp.opengl.GLException: X11GLXDrawableFactory - Could not initialize shared resources for X11GraphicsDevice[type .x11, connection :0, unitID 0, handle 0x0, owner false, ResourceToolkitLock[obj 0x2ddc6a04, isOwner false, <542867c8, 75028136>[count 0, qsz 0, owner <NULL>]]]
        at jogamp.opengl.x11.glx.X11GLXDrawableFactory$SharedResourceImplementation.createSharedResource(X11GLXDrawableFactory.java:326)
        at jogamp.opengl.SharedResourceRunner.run(SharedResourceRunner.java:297)
        at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.NullPointerException
        at jogamp.opengl.GLContextImpl.makeCurrent(GLContextImpl.java:688)
        at jogamp.opengl.GLContextImpl.makeCurrent(GLContextImpl.java:580)
        at jogamp.opengl.x11.glx.X11GLXDrawableFactory$SharedResourceImplementation.createSharedResource(X11GLXDrawableFactory.java:297)
        ... 2 more
Exception in thread "main" java.lang.reflect.InvocationTargetException
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader.main(JarRsrcLoader.java:58)
Caused by: java.lang.InternalError: XXX0 profile[1]: GL3bc -> profileImpl GL4bc !!! not mapped 
        at com.jogamp.opengl.GLProfile.computeProfileMap(GLProfile.java:2047)
        at com.jogamp.opengl.GLProfile.initProfilesForDeviceCritical(GLProfile.java:1917)
        at com.jogamp.opengl.GLProfile.initProfilesForDevice(GLProfile.java:1866)
        at com.jogamp.opengl.GLProfile.initProfilesForDefaultDevices(GLProfile.java:1835)
        at com.jogamp.opengl.GLProfile.access$000(GLProfile.java:79)
        at com.jogamp.opengl.GLProfile$1.run(GLProfile.java:229)
        at java.security.AccessController.doPrivileged(Native Method)
        at com.jogamp.opengl.GLProfile.initSingleton(GLProfile.java:215)
        at com.jogamp.opengl.GLProfile.getProfileMap(GLProfile.java:2272)
        at com.jogamp.opengl.GLProfile.get(GLProfile.java:1020)
        at com.jogamp.opengl.GLProfile.get(GLProfile.java:1049)
        at com.jogamp.opengl.GLProfile.getMaxFixedFunc(GLProfile.java:802)
        at javax.media.j3d.JoglPipeline.initialize(JoglPipeline.java:132)
        at javax.media.j3d.Pipeline.createPipeline(Pipeline.java:92)
        at javax.media.j3d.MasterControl.loadLibraries(MasterControl.java:837)
        at javax.media.j3d.VirtualUniverse.<clinit>(VirtualUniverse.java:274)
        at me.drton.jmavsim.Visualizer3D.<init>(Visualizer3D.java:154)
        at me.drton.jmavsim.Simulator.<init>(Simulator.java:157)
        at me.drton.jmavsim.Simulator.main(Simulator.java:678)
        ... 5 more
X11Util.Display: Shutdown (JVM shutdown: true, open (no close attempt): 1/1, reusable (open, marked uncloseable): 0, pending (open in creation order): 1)
X11Util: Open X11 Display Connections: 1
X11Util: Open[0]: NamedX11Display[:0, 0x7fb424001550, refCount 1, unCloseable false]

Yuneec 520: HITL simulator keep crashing into land after takeoff

HITL simulator would work but after taking off it immediately crash into land. It start wobbling as soon as it take off and then crash into land.

I'm following instructions from here: https://developer.yuneec.com/documentation/121/HITL-Testing-for-Mac

I've made sure the QGC HITL is enabled and closing it before running the simulator.

I'm currently using:
java version "1.8.0_202"
Java(TM) SE Runtime Environment (build 1.8.0_202-b08)
Java HotSpot(TM) 64-Bit Server VM (build 25.202-b08, mixed mode)

Greatly appreciated if someone can help me figure out why the Yuneec 520 drone simulator keeps on crashing after taking off.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.