HITL for Pilot Pi

I’m trying to make PilotPi work with HITL(using jmavsim as simulator). I’m 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’m also trying to run HITL, but on BeagleBoneBlue. There’s no px4_hitl.config for BBB so I’m 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’m not receiving Preflight Fails, but still I don’t see the sensors messages. I wonder if it’s my wrong connection setting or something else?

Please let me know if that helps.

Regards,

BTW In QGC I’m 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’re missing.

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

I’ve 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’t 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’ve got error “some components doesn’t setup”, such as sensors, radio and Flight modes. when I tried “takeoff” in QGC, it said “vehicle position not known”. Only “Arm” in QGC seems to work.


When I typed “cammander takeoff” in the PX4 shell again, it still didn’t 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’m 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’ll 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’s 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 (Hardware in the Loop Simulation \(HITL\) | PX4 User Guide)

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’ve managed to run HITL in jMAVSim, but still can’t achieve stable take off in Gazebo