docker px4配置软仿UE

发布时间 2023-05-26 08:15:26作者: 李悠然

1. clone源代码

git clone https://github.com/PX4/PX4-Autopilot.git

2. 编译

make px4_sitl_default none_iris

编译成功

配置PX4的相关命令

pxh> commander arm
pxh> INFO  [commander] Armed by internal command    
INFO  [tone_alarm] arming warning

pxh>
pxh> commander disarm
pxh> INFO  [commander] Disarmed by internal command    
INFO  [tone_alarm] notify neutral
INFO  [logger] closed logfile, bytes written: 7319850

pxh> commander mode posctl
pxh> commander status
INFO  [commander] arming: STANDBY
INFO  [commander] navigation: POSCTL

pxh> param set COM_RC_IN_MODE 1 //不适用qgc启动
pxh> commander mode auto:mission //配置自动任务模式
pxh> commander arm

3. 配置UE

nano ./ROMFS/px4fmu_common/init.d-posix/px4-rc.simulator

//端口号:4560

//ip:172.16.52.3

#!/bin/sh
# shellcheck disable=SC2154

simulator_tcp_port=$((4560+px4_instance))

# Check if PX4_SIM_HOSTNAME environment variable is empty
# If empty check if PX4_SIM_HOST_ADDR environment variable is empty
# If both are empty use localhost for simulator
set PX4_SIM_HOST_ADDR "172.16.52.3"
if [ -z "${PX4_SIM_HOSTNAME}" ]; then
  if [ -z "${PX4_SIM_HOST_ADDR}" ]; then
    echo "PX4 SIM HOST: localhost"
    simulator start -c $simulator_tcp_port
  else
    echo "PX4 SIM HOST: $PX4_SIM_HOST_ADDR"
    simulator start -t $PX4_SIM_HOST_ADDR $simulator_tcp_port
  fi
else
  echo "PX4 SIM HOST: $PX4_SIM_HOSTNAME"
  simulator start -h $PX4_SIM_HOSTNAME $simulator_tcp_port
fi