PX4 VTOL控制逻辑

v1.8.2

@[TOC]PX4的启动控制逻辑:
(1)启动程序分析
启动脚本的位置在Firmware\ROMFS\px4fmu_common\init.d\rcS文件中。打开文件,找到对应的机架模型即可

如果是VTOL模式,则找到对应的这个机架即可

#
	# VTOL setup
	#
	if [ $VEHICLE_TYPE == vtol ]
	then
		if [ $MIXER == none ]
		then
			echo "VTOL mixer undefined"
		fi

		if [ $MAV_TYPE == none ]
		then
			# Use mixer to detect vehicle type
			if [ $MIXER == caipirinha_vtol ]
			then
				set MAV_TYPE 19
			fi
			if [ $MIXER == firefly6 ]
			then
				set MAV_TYPE 21
			fi
			if [ $MIXER == quad_x_pusher_vtol ]
			then
				set MAV_TYPE 22
			fi
		fi

		# Still no MAV_TYPE found
		if [ $MAV_TYPE == none ]
		then
			echo "Unknown MAV_TYPE"
			param set MAV_TYPE 19
		else
			param set MAV_TYPE ${MAV_TYPE}
		fi

		# Load mixer and configure outputs
		sh /etc/init.d/rc.interface

		# Start standard vtol apps
		sh /etc/init.d/rc.vtol_apps
	fi

MIXER为对应的混控器,在\Firmware\ROMFS\px4fmu_common\mixers文件夹中,rc.interface为加载混控器和PWM输出,rc.vtol_app为VTOL模式下运行的程序。在Firmware\ROMFS\px4fmu_common\init.d中找到该文件,看看需要启动哪些程序
在这里插入图片描述

#!nsh
#
# Standard apps for vtol:
# att & pos estimator, att & pos control.
#
#


#---------------------------------------
# Estimator group selction
#
# INAV (deprecated)
if param compare SYS_MC_EST_GROUP 0
then
	echo "ERROR [init] Estimator INAV deprecated. Using EKF2"
	param set SYS_MC_EST_GROUP 2
	param save
fi

# LPE
if param compare SYS_MC_EST_GROUP 1
then
	# Try to start LPE. If it fails, start EKF2 as a default
	# Unfortunately we do not build it on px4fmu-v2 due to a limited flash.
	if attitude_estimator_q start
	then
		local_position_estimator start
	else
		echo "ERROR [init] Estimator LPE not available. Using EKF2"
		param set SYS_MC_EST_GROUP 2
		param save
	fi
fi

# EKF
if param compare SYS_MC_EST_GROUP 2
then
	ekf2 start
fi
#---------------------------------------


vtol_att_control start
mc_att_control start
mc_pos_control start
fw_att_control start
fw_pos_control_l1 start

#
# Start Land Detector
# Multicopter for now until we have something for VTOL
#
land_detector start vtol

#
# Start Wind and Airspeed Scale Estimator
#
#wind_estimator start

其中主要的控制程序文件路径在**\Firmware\src\modules**中,包含以下程序:

vtol_att_control start
mc_att_control start
mc_pos_control start
fw_att_control start
fw_pos_control_l1 start

-------未完待续
参考: PX4启动脚本分析.

  • 0
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值