HITL for Pilot Pi

I鈥檓 trying to make PilotPi work with HITL(using jmavsim as simulator). I鈥檓 doing as the following steps.

  1. compile px4 for raspi. PilotPi
  2. start jmavsim and set correct udp port for mavlink.(udp 14550 for receiving PilotPi mavlink message)
# The following is part of Tools/jmavsim_run.sh
java -XX:GCTimeRatio=20 -Djava.ext.dirs= -jar jmavsim_run.jar -udp 14550 $extra_args -qgc 192.168.3.165:14550
  1. use px4_hil.confg as startup script to start px4 on raspi. PX4-Autopilot/px4_hil.config at master 路 PX4/PX4-Autopilot (github.com)
    路路路
    pi@navio:~/px4 $ ./bin/px4 -s px4_hil.config
    路路路
  2. jmavsim showed that it received mavlink message from raspi. However, px4 running on raspi got no sensor data and ekf2 failed to start.

Anybody knows How can I run HITL simulation for Pilot Pi(or navio2)? many thanks.


Hi @january147 , I鈥檓 also trying to run HITL, but on BeagleBoneBlue. There鈥檚 no px4_hitl.config for BBB so I鈥檓 trying to adapt the one for Pi. What I found and it might help you is that actual flag should be -h not -hil according to doc (System 路 PX4 Developer Guide)
Please try to change to:

sensors start -h
commander start -h

When I changed this I鈥檓 not receiving Preflight Fails, but still I don鈥檛 see the sensors messages. I wonder if it鈥檚 my wrong connection setting or something else?

Please let me know if that helps.

Regards,

BTW In QGC I鈥檓 having problems with missing parameters, like mentioned in this post. I wonder if you observe the same. When I do

param show sys_*

from console indeed I see that they鈥檙e missing.

    SYS_AUTOCONFIG [-1,1384] : 0
x + SYS_AUTOSTART [614,1385] : 4011

I鈥檝e used your jmavsim -udp 14550 setting and now I see sensor topics!

Thanks, it works using 鈥-h鈥 instead of 鈥-hil鈥. PX4 runing on rpi now received sensor data from jmavsim. However, The drone still won鈥檛 take off.
When I inputed commander take off in the px4 shell, it said

pxh> commander takeoff
pxh> WARN  [commander] Takeoff denied! Please disarm and retry
INFO  [commander] Armed by internal command
WARN  [commander] Failsafe enabled: No manual control stick input
INFO  [commander] Failsafe mode activated

Then I connected QGC to PX4 through jMAVsim. I鈥檝e got error 鈥渟ome components doesn鈥檛 setup鈥, such as sensors, radio and Flight modes. when I tried 鈥渢akeoff鈥 in QGC, it said 鈥渧ehicle position not known鈥. Only 鈥淎rm鈥 in QGC seems to work.


When I typed 鈥渃ammander takeoff鈥 in the PX4 shell again, it still didn鈥檛 work but gave no reason.
Snipaste_2022-01-13_21-01-28

Yes, I added those params to 鈥*.config鈥 file using the following commands.

param set SYS_AUTOCONFIG 1
param set SDLOG_MODE 0

It seems working.

Hi, I鈥檓 also getting various failsafe warnings/errors, e.g

ERROR [commander] Remaining flight time low, returning to land
WARN  [commander] Failsafe enabled: no datalink
WARN  [commander] Failsafe enabled: No manual control stick input

This is strange because e.g. I disabled last two:

param set NAV_DLL_ACT 0
param set NAV_RCL_ACT 0

Have you made any progress?

I鈥檒l try to switch to gazebo hitl

BTW if I set jMAVSim udp port to 14550 then QGroundControl complains that the port is already in use


It鈥檚 not clear to me if I should better change this in mavlink module and jMAVSim and leave this number to QGC or I should change the default port for QGC or do something else. The default scheme assumes serial communication between the board and simulator (Redirecting to latest version of document (main))

Hey man you made any progress, i am trying to use a custom flight controller and gazebo and having similar errors. My main issue is trying to get the hil sensors to start

I鈥檝e managed to run HITL in jMAVSim, but still can鈥檛 achieve stable take off in Gazebo

Hi, I modified px4_hil.config as discussed and used . /px4 -s px4_hil.config to start the flight control, and I found that px4 gets stuck when executing ekf2 start.
Have you encountered such a problem please? Or maybe my px4 version (1.14.0) is not right .