跳转到主要内容

模拟引脚

除了数字输入和输出披针外,自动驾驶还有模拟输入披针,可以精确测量电压. 这些通常用于电源显示器电压和电流感知输入,但有时会提供其他的针头:

  • RSSI( 收到信号强度输入)
  • 类似速度传感器输入 50.
  • 类似燃料级传感器输入
  • 类似声纳/ 光谱输入
  • 类似温度传感器输入

说明

所有披针都可以接受0-3.3v输入. 除非文档(所开展的OEM 86. 或 Wiki)具体规定了6.6V输入范围,否则只能应用最大3.3!

如果这些投入中的任何一种是通过适当的传感器类型选择而允许的,a输入( P)需要输入参数来指定使用自动驾驶器上的哪个“pin”。 通常,自动驾驶员模拟输入的正确针号会被记录在此处的Wiki页面,或者OEM的文档中.

如果没有,然后检查自动驾驶的hwdef玲珑 file here can provide the information. The process is a bit difficult but manageable.

For example, the CUAV-X7 autopilot hwdef.dat has a section designating its internal A-to-D converters:

# analog in
PA0 BATT_VOLTAGE_SENS ADC1 SCALE(1)
PA1 BATT_CURRENT_SENS ADC1 SCALE(1)

# ADC3.3/ADC6.6
PC4 SPARE1_ADC1 ADC1 SCALE(1)

# Note that this should be SCALE(2), but we don't want to break existing setups
# See: https://github.com/ArduPilot/ardupilot/pull/22831
PA4 SPARE2_ADC1 ADC1 SCALE(1)

PF12 RSSI_IN ADC1 SCALE(1)

PC5 VDD_5V_SENS ADC1 SCALE(2)
PC1 SCALED_V3V3 ADC1 SCALE(2)

PB1 FMU_SERVORAIL_VCC_SENS ADC1 SCALE(3)

The last three lines define inputs used internally on the board to monitor various board supply voltages. The first two lines define the voltage and current sense inputs, the next define user analog inputs and the RSSI input. In order to determine which pins numbers are used in ArduPilot parameters, one more lookup step is required:

  • After determining which cpu is used in the autopilot, the pin numbers corresponding to the cpu pins can be determined from the cpu's definition table here. In the above example, the cpu is STM32H743, and looking at the bottom of its definition file, you can find its cpu to ardupilot pin tables:
ADC1_map = {
# format is PIN : ADC1_CHAN
"PF11"  :   2,
"PA6"   :   3,
"PC4"   :   4,
"PB1"   :   5,
"PF12"  :   6,
"PA7"   :   7,
"PC5"   :   8,
"PB0"   :   9,
"PC0"   :   10,
"PC1"   :   11,
"PC2"   :   12,
"PC3"   :   13,
"PA2"   :   14,
"PA3"   :   15,
"PA0"   :   16,
"PA1"   :   17,
"PA4"   :   18,
"PA5"   :   19,
}

and for ADC1, the power monitor voltage input, PA0, would be ArduPilot pin "16", the RSSI input, PF12, would correspond to ArduPilot pin "6", etc. and these pin values would be used in the appropriate _PIN parameter.

【本页后半部分仍为英文原文摘录,补译中。】


译自 ArduPilot Copter「Analog Input Pins」· 查看原文 · CC BY-SA 3.0