Unable to takeoff in jMAVSim

Hello,

I’m trying to simulate PX4 on jMAVSim running Ubuntu 20.04 LTS.
Can’t get it to work out of the box. Followed the steps on dev.px4.io (clone git repo, run ubuntu script etc.) but still the drone doesn’t takeoff and I’m not familiar with all these errors.

Here is a print of the console output:

thomas@thomas-ubuntu:~/Projects/PX4-Autopilot$ make px4_sitl jmavsim
– PX4 version: v1.11.0-rc3-1761-g0ba1bc0ce1
– PX4 config file: /home/thomas/Projects/PX4-Autopilot/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++
– Check for working CXX compiler: /usr/bin/c++ – 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
– ccache enabled (export CCACHE_DISABLE=1 to disable)
– Found PythonInterp: /usr/bin/python3 (found suitable version “3.8.5”, minimum required is “3”)
– build type is RelWithDebInfo
– PX4 ECL: Very lightweight Estimation & Control Library v1.9.0-rc1-532-g098d5ce
– ROMFS: px4fmu_common
– Configuring done
– Generating done
– Build files have been written to: /home/thomas/Projects/PX4-Autopilot/build/px4_sitl_default
[2/796] git submodule src/drivers/gps/devices
[9/796] git submodule src/lib/ecl
[13/796] git submodule mavlink/include/mavlink/v2.0
[16/796] git submodule Tools/jMAVSim
[795/796] cd /home/thomas/Projects/PX4…s/PX4-Autopilot/build/px4_sitl_default
SITL ARGS
sitl_bin: /home/thomas/Projects/PX4-Autopilot/build/px4_sitl_default/bin/px4
debugger: none
program: jmavsim
model: none
world: none
src_path: /home/thomas/Projects/PX4-Autopilot
build_path: /home/thomas/Projects/PX4-Autopilot/build/px4_sitl_default
empty model, setting iris as default
SITL COMMAND: “/home/thomas/Projects/PX4-Autopilot/build/px4_sitl_default/bin/px4” “/home/thomas/Projects/PX4-Autopilot/build/px4_sitl_default”/etc -s etc/init.d-posix/rcS -t “/home/thomas/Projects/PX4-Autopilot”/test_data
INFO [px4] Creating symlink /home/thomas/Projects/PX4-Autopilot/build/px4_sitl_default/etc -> /home/thomas/Projects/PX4-Autopilot/build/px4_sitl_default/tmp/rootfs/etc


| ___ \ \ \ / / / |
| |/ / \ V / / /| |
| __/ / \ / /
| |
| | / /^\ \ ___ |
_| / / |_/
px4 starting.
INFO [px4] Calling startup script: /bin/sh etc/init.d-posix/rcS 0
Info: found model autostart file as SYS_AUTOSTART=10016
INFO [param] selected parameter default file eeprom/parameters_10016
[param] parameter file not found, creating eeprom/parameters_10016
SYS_AUTOCONFIG: curr: 0 -> new: 1
SYS_AUTOSTART: curr: 0 -> new: 10016
BAT_N_CELLS: curr: 0 -> new: 4
CAL_ACC0_ID: curr: 0 -> new: 1310988
CAL_ACC1_ID: curr: 0 -> new: 1310996
CAL_ACC2_ID: curr: 0 -> new: 1311004
CAL_GYRO0_ID: curr: 0 -> new: 1310988
CAL_GYRO1_ID: curr: 0 -> new: 1310996
CAL_GYRO2_ID: curr: 0 -> new: 1311004
CAL_MAG0_ID: curr: 0 -> new: 197388
CAL_MAG1_ID: curr: 0 -> new: 197644
CBRK_SUPPLY_CHK: curr: 0 -> new: 894281
COM_RC_IN_MODE: curr: 0 -> new: 1
EKF2_REQ_GPS_H: curr: 10.0000 -> new: 0.5000
EKF2_MULTI_IMU: curr: 0 -> new: 3
SENS_IMU_MODE: curr: 1 -> new: 0
EKF2_MULTI_MAG: curr: 0 -> new: 2
SENS_MAG_MODE: curr: 1 -> new: 0
SDLOG_MODE: curr: 0 -> new: 1
SDLOG_PROFILE: curr: 1 -> new: 131
SDLOG_DIRS_MAX: curr: 0 -> new: 7
SENS_BOARD_X_OFF: curr: 0.0000 -> new: 0.0000
SENS_DPRES_OFF: curr: 0.0000 -> new: 0.0010
TRIG_INTERFACE: curr: 4 -> new: 3
COM_CPU_MAX: curr: 90.0000 -> new: -1.0000
IMU_INTEG_RATE: curr: 200 -> new: 250
parameter default: NAV_ACC_RAD 10.00 -> 2.00
parameter default: RTL_RETURN_ALT 60.00 -> 30.00
parameter default: RTL_DESCEND_ALT 30.00 -> 10.00
parameter default: PWM_MAIN_MAX 2000 -> 1950
parameter default: PWM_MAIN_MIN 1000 -> 1075
parameter default: GPS_UBX_DYNMODEL 7 -> 6

  • SYS_AUTOCONFIG: curr: 1 -> new: 0
    INFO [dataman] Unknown restart, data manager file ‘./dataman’ size is 11798680 bytes
    INFO [simulator] Waiting for simulator to accept connection on TCP port 4560
    Buildfile: /home/thomas/Projects/PX4-Autopilot/Tools/jMAVSim/build.xml
    make_dirs:
    [mkdir] Created dir: /home/thomas/Projects/PX4-Autopilot/Tools/jMAVSim/out/production/jMAVSim
    compile:
    [javac] Compiling 76 source files to /home/thomas/Projects/PX4-Autopilot/Tools/jMAVSim/out/production/jMAVSim
    create_run_jar:
    [jar] Building jar: /home/thomas/Projects/PX4-Autopilot/Tools/jMAVSim/out/production/jmavsim_run.jar
    copy_res:
    [copy] Copying 17 files to /home/thomas/Projects/PX4-Autopilot/Tools/jMAVSim/out/production
    BUILD SUCCESSFUL
    Total time: 3 seconds
    Options parsed, starting Sim.
    Starting GUI…
    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
    libEGL warning: DRI2: failed to authenticate
    INFO [simulator] Simulator connected on TCP port 4560.
    Init MAVLink
    INFO [commander] LED: open /dev/led0 failed (22)
    INFO [init] Mixer: etc/mixers/quad_w.main.mix on /dev/pwm_output0
    INFO [ekf2] starting instance 0, IMU:0 (1310988), MAG:0 (197388)
    INFO [ekf2] starting instance 1, IMU:1 (1310996), MAG:0 (197388)
    INFO [ekf2] starting instance 2, IMU:2 (1311004), MAG:0 (197388)
    INFO [ekf2] starting instance 3, IMU:0 (1310988), MAG:1 (197644)
    INFO [ekf2] starting instance 4, IMU:1 (1310996), MAG:1 (197644)
    INFO [ekf2] starting instance 5, IMU:2 (1311004), MAG:1 (197644)
    INFO [mavlink] mode: Normal, data rate: 4000000 B/s on udp port 18570 remote port 14550
    INFO [mavlink] mode: Onboard, data rate: 4000000 B/s on udp port 14580 remote port 14540
    INFO [mavlink] mode: Onboard, data rate: 4000 B/s on udp port 14280 remote port 14030
    INFO [mavlink] mode: Gimbal, data rate: 400000 B/s on udp port 13030 remote port 13280
    INFO [logger] logger started (mode=all)
    INFO [logger] Start file log (type: full)
    INFO [logger] [logger] ./log/2021-03-01/11_18_37.ulg
    INFO [logger] Opened full log file: ./log/2021-03-01/11_18_37.ulg
    INFO [px4] Startup script returned successfully
    pxh> INFO [mavlink] using network interface enp0s3, IP: 10.0.2.15
    INFO [mavlink] with netmask: 255.255.255.0
    INFO [mavlink] and broadcast IP: 10.0.2.255
    INFO [ecl/EKF] 736000: reset position to last known position
    INFO [ecl/EKF] INFO [ecl/EKF] 736000: reset position to last known position
    INFO [ecl/EKF] 736000: reset velocity to zero
    INFO [ecl/EKF] 736000: reset position to last known position
    INFO [ecl/EKF] 736000: reset velocity to zero
    INFO [ecl/EKF] 736000: reset position to last known position
    INFO [ecl/EKF] 736000: reset velocity to zero
    INFO [ecl/EKF] 736000: reset position to last known position
    INFO [ecl/EKF] 736000: reset velocity to zero
    736000: reset velocity to zero
    INFO [ecl/EKF] 736000: reset position to last known position
    INFO [ecl/EKF] 736000: reset velocity to zero
    INFO [mavlink] using network interface enp0s3, IP: 10.0.2.15
    INFO [mavlink] with netmask: 255.255.255.0
    INFO [mavlink] and broadcast IP: 10.0.2.255
    INFO [ecl/EKF] 6836000: EKF aligned, (baro hgt, IMU buf: 12, OBS buf: 9)
    INFO [ecl/EKF] 6836000: EKF aligned, (baro hgt, IMU buf: 12, OBS buf: 9)
    INFO [ecl/EKF] 6836000: EKF aligned, (baro hgt, IMU buf: 12, OBS buf: 9)
    INFO [ecl/EKF] 6836000: EKF aligned, (baro hgt, IMU buf: 12, OBS buf: 9)
    INFO [ecl/EKF] 6836000: EKF aligned, (baro hgt, IMU buf: 12, OBS buf: 9)
    INFO [ecl/EKF] 6836000: EKF aligned, (baro hgt, IMU buf: 12, OBS buf: 9)
    INFO [ecl/EKF] 9944000: GPS checks passed
    INFO [ecl/EKF] 9944000: GPS checks passed
    INFO [ecl/EKF] 9944000: GPS checks passed
    INFO [ecl/EKF] 9944000: GPS checks passed
    INFO [ecl/EKF] 9944000: GPS checks passed
    INFO [ecl/EKF] 9944000: GPS checks passed
    INFO [ecl/EKF] 14476000: reset position to GPS
    INFO [ecl/EKF] 14476000: reset velocity to GPS
    INFO [ecl/EKF] 14476000: starting GPS fusion
    INFO [ecl/EKF] 14476000: reset position to GPS
    INFO [ecl/EKF] 14476000: reset velocity to GPS
    INFO [ecl/EKF] 14476000: starting GPS fusion
    INFO [ecl/EKF] 14476000: reset position to GPS
    INFO [ecl/EKF] 14476000: reset velocity to GPS
    INFO [ecl/EKF] 14476000: starting GPS fusion
    INFO [ecl/EKF] 14476000: reset position to GPS
    INFO [ecl/EKF] 14476000: reset velocity to GPS
    INFO [ecl/EKF] 14476000: starting GPS fusion
    INFO [ecl/EKF] 14476000: reset position to GPS
    INFO [ecl/EKF] 14476000: reset velocity to GPS
    INFO [ecl/EKF] 14476000: starting GPS fusion
    INFO [ecl/EKF] 14476000: reset position to GPS
    INFO [ecl/EKF] 14476000: reset velocity to GPS
    INFO [ecl/EKF] 14476000: starting GPS fusion
    INFO [tone_alarm] home set
    INFO [tone_alarm] notify negative
    pxh> commander takeoff
    pxh> INFO [commander] Armed by internal command
    WARN [commander] Failsafe enabled: No manual control stick input
    INFO [commander] Failsafe mode activated
    INFO [navigator] RTL HOME activated
    INFO [navigator] RTL: landing at home position.
    INFO [tone_alarm] battery warning (fast)
    INFO [commander] Failsafe mode deactivated
    INFO [commander] Disarmed by auto preflight disarming
    INFO [logger] closed logfile, bytes written: 2784359
    pxh> commander takeoff
    pxh> INFO [commander] Armed by internal command
    INFO [logger] Start file log (type: full)
    INFO [logger] [logger] ./log/2021-03-01/11_19_26.ulg
    INFO [navigator] Using minimum takeoff altitude: 2.50 m
    INFO [logger] Opened full log file: ./log/2021-03-01/11_19_26.ulg
    INFO [commander] Takeoff detected
    WARN [commander] Failsafe enabled: No manual control stick input
    INFO [commander] Failsafe mode activated
    INFO [navigator] RTL HOME activated
    INFO [navigator] RTL: landing at home position.
    INFO [navigator] RTL: climb to 490 m (2 m above destination)
    INFO [tone_alarm] battery warning (fast)
    INFO [commander] Failsafe mode deactivated
    INFO [navigator] RTL: return at 490 m (2 m above destination)
    INFO [navigator] RTL: land at destination
    INFO [commander] Landing detected
    INFO [commander] Disarmed by landing
    INFO [logger] closed logfile, bytes written: 1105166

EDIT: It doesn’t takeoff the first time I run “commander takeoff”. Second time it does but decides to land itself while halfway up without giving any commands.

You are losing RC.
put your COM_RC_IN_MODE to 1 and try again.

Did you connect QGC to the simulation? If not, you can get it here: http://qgroundcontrol.com/downloads/

2 Likes

Setting COM_RC_IN_MODE to 1 disables RC checks but required me to connect a joystick, which I don’t have. Changing parameter NAV_RCL_ACT to 0 solved my problem.

1 Like