【踩坑实录】Mission planner+Ardupilot飞控固件配置教程

本文详细介绍了使用ArduPilot固件和MissionPlanner地面站进行飞控调试的过程,包括固件安装、硬件校准(加速度计、指南针、遥控器、电调)、数传电台和空速计的配置。
部署运行你感兴趣的模型镜像

写在前面

飞控:雷迅CUAV V5+
固件:Arudupilot-Arduplane Stable
地面站:Mission Planner 1.3.74
在这里插入图片描述

之前为飞控刷写了px4固件,并采用QGroundControl地面站进行调试。奈何调试过程总是出现莫名其妙的Bug,于是重新刷了Ardupilot的固件,并用MP进行调试。大致记录了一下初次配置的过程,希望对你有所帮助。
另:非常感谢哈工大威海小马哥的指导!!!


1.固件安装

首先不用接电池,飞控与电脑通过USB-TYPE C线连接,随后打开Mission Planner(以下简称MP)。

注意:先不要点右上角的连接!

然后我们点安装固件(没反应就点安装固件Legacy),选择机型,请添加图片描述
然后根据操作安装即可。安装完成后,进度条下方会显示“Upload Done”,MP的窗口上方也会显示你的固件版本。此时Ardupilot固件就刷写成功了。
请添加图片描述


2.必要硬件校准调试

接下来,我们开始进行校准。首先选择好端口,点击右上方“连接”,将飞控与地面站连接。
请添加图片描述
然后点击“初始设置”->“必要硬件”,逐步开始校准。

2.1 加速度计校准

根据它的提示,将飞控按照六个方向进行摆放,完成相关操作即可。
请添加图片描述
这里我贴一张QGroundControl地面站的校准提示图,帮助大家更为直观地了解校准方向。
请添加图片描述

2.2 指南针校准

如果你采用了外部GPS(比如笔者采用了CUAV NEO 3),则内部罗盘和外部罗盘选择一个即可。推荐采用内部罗盘,当然选用外部也可以,但是在放置GPS时注意避开大电流设备(数传、接收机等),避免干扰。系统会自动识别你是否有外部罗盘,外部罗盘在上方“Compass Priority”的“Extern”上会打勾。右侧的UP和DOWN可以调整罗盘的优先级。或者在“Compass Priority”下方你可以指定选择使用哪个罗盘。选择后点“Reboot”重启飞控以应用操作。
随后进行校准。

注意:校准前,GPS箭头方向和飞控箭头方向最好保持一致,如果可以的话用扎带或者绳子将二者固定在一起。

点击“Start”,蜂鸣器会发出短-长的蜂鸣,然后转为稳定的短蜂鸣。此时拿起飞控和罗盘转着画8字(像使用手机地图时提示校准罗盘那样,目的是使得罗盘在三个轴上都有旋转)。当右侧信息框打印“MAG_CAL_SUCCESS”时,校准完成,重启飞控。校准失败,则重复上述操作
请添加图片描述

3.遥控器校准

将接收机调至SUBS模式,与飞控连接。打开遥控器后与接收机对频。当遥控器操作界面信号满格/蜂鸣器发出“滴滴”两声音调较高的蜂鸣时,对频成功。
随后对遥控进行校准。

注意:不要接电池!卸下螺旋桨!电机附近不要有其他物品!

将左右摇杆分别打到最上、最下、最左、最右,其余开关也全打一遍,让校准页面的绿条出现表示Max/Min的红线。
请添加图片描述
全部操作后点击完成,MP会弹出相应的遥控器各通道的极值数据。
请添加图片描述

要注意的是如果摇杆的变化与输出量变化反向,可以在对应通道点“反向”或在遥控器中调整。

2.4 舵机输出

这一步无关紧要,你可以拨动摇杆大概看一下输出量的变化。此时飞控处于锁定状态,故CH3-Throttle(油门)不会发生变化。

2.5 电调校准

这一步很关键,而且十分容易踩坑: (
不知道是翻译未更新还是什么原因,MP中文版的电调校准教程并不准确。因此不要按照MP上的操作提示走。贴一下官方文档中关于电调校准的描述:
请添加图片描述

请添加图片描述
校准电调的目的在于让电调将遥控器的PWM变化范围映射到油门0~100的输出中,即让电调知道何时为零油门何时为满油门。
我大概翻译了一下官方文档的校准方法,并做了些补充:

  • 1.飞控上电*(USB供电),但电调不上电(不接电池,或飞控电源模块接电池,电调端断开)*

务必保证螺旋桨已经拆下,油门打到最低。

  • 2.调整至Manual/手动飞行模式

注意:不要看遥控器上的模式。从MP左侧“飞行模式”看当前对应的飞行模式。输出通道的对应开关/旋钮可从遥控器上调整。个人是将CH8与SWC对应,可以调整三档飞行模式

  • 3.关闭安全开关,并解锁

若有外置开关,长按安全开关,至安全开关灯常亮,然后点击MP上方“飞行数据”->“动作”->第三行“解锁”。此时蜂鸣器会长响一声,飞行数据中“未解锁”字样消失。
请添加图片描述

  • 4.将油门推到最高并给电调上电。此时电调或电机会发出2到3声的快速蜂鸣,电机不转动。
  • 5.将油门推到最低。此时电调或电机会发出与上面不同的蜂鸣,然后以一声蜂鸣结束,电机不再发出响声。
  • 6.此时缓慢推油门及其他摇杆,若电机和舵机正常转动,那么电调就校准成功了。

此时,必要硬件的校准已经完成。为了安全,将电池取下,油门打到最低。


3.可选硬件校准

目前,我只为飞机配置了数传电台及空速计。这两个硬件的配置过程如下:

3.1 数传电台

  • 1.将地面端与电脑相连,天空端与飞控相连。在电脑的设备管理器上查看对应串口(部分电脑可能存在驱动问题,导致地面端无法被识别。安装CP210x USB to UART Bridge驱动即可)。
    请添加图片描述
  • 2.断开飞控与电脑的USB连接,MP端口处选择地面端数传对应端口(比如我的就是COM3),波特率57600,无需连接。
  • 3.可选硬件-Sik电台(数传),点击“加载设置”。若配对成功,则Local和Remote会出现相同的配置信息。实际使用中为避免串台,可以更改网络ID。注意,两端的信息必须保持完全一致。更改信息后点保存设置,随后点击连接,测试数传电台。若飞控能与MP正常连接,则数传电台配置完成。

3.2 空速计

飞控通过USB与电脑连接。在可选硬件-空速,勾选“使用空速”。
请添加图片描述

重启飞控,在飞行数据处可以看到空速信息。在无风的条件下,空速应该在0到3左右波动,偶尔会跳到4或5。若你在室内或GPS信号很差,会出现地速与空速几乎相同的情况。不用担心,飞机拿到室外飞行的时候就没事了。

您可能感兴趣的与本文相关的镜像

Stable-Diffusion-3.5

Stable-Diffusion-3.5

图片生成
Stable-Diffusion

Stable Diffusion 3.5 (SD 3.5) 是由 Stability AI 推出的新一代文本到图像生成模型,相比 3.0 版本,它提升了图像质量、运行速度和硬件效率

在使用 Mission Planner 导入固件时,如果提示 "no response from board",通常表示 Mission Planner 无法与飞控设备(如 Pixhawk)建立通信。以下是可能的解决方案: 1. **检查硬件连接** 确保飞控设备通过 USB 正确连接到计算机。尝试更换 USB 线缆或 USB 接口,以排除硬件连接问题。确保飞控设备的电源供应稳定。 2. **使用官方稳定固件** 先烧录官方稳定的固件版本,确保飞控设备能够正常运行。使用 Mission Planner 连接设备时,可能会出现串口反复识别的问题,这是因为设备可能因死机而不断重启,表现为指示灯闪烁不稳定。尝试重新连接设备或重启 Mission Planner。 3. **参数配置** 打开 Mission Planner 的“配置/调试”选项卡,检查并写入所有自定义参数到 Pixhawk 中。确保参数配置正确,避免因参数错误导致通信失败。 4. **重新烧录固件** 在确保设备能够正常运行后,重新烧录自己编译的固件。确保固件版本与设备兼容,并且烧录过程无错误。 5. **检查设备驱动** 确保计算机上安装了正确的设备驱动程序。对于某些飞控设备,可能需要手动安装或更新驱动程序。 6. **尝试其他固件烧录工具** 如果问题仍然存在,可以尝试使用其他固件烧录工具(如 QGroundControl)进行烧录,以排除 Mission Planner 本身的兼容性问题。 7. **查看日志和调试信息** 在 Mission Planner 中查看日志和调试信息,获取更多关于通信失败的详细信息,以便进一步排查问题。 ### 示例代码:检查设备连接状态 ```python import serial def check_device_connection(port): try: ser = serial.Serial(port, timeout=1) print(f"Device connected on {port}") ser.close() except serial.SerialException as e: print(f"No device found on {port}: {e}") # 检查设备连接状态 check_device_connection('/dev/ttyUSB0') ``` ### 示例代码:重新烧录固件 ```python import subprocess def flash_firmware(port, firmware_path): try: subprocess.run(['missionplanner', 'flash', '--port', port, '--firmware', firmware_path], check=True) print("Firmware flashed successfully.") except subprocess.CalledProcessError as e: print(f"Failed to flash firmware: {e}") # 重新烧录固件 flash_firmware('/dev/ttyUSB0', 'path/to/firmware.bin') ``` ### 示例代码:检查设备驱动 ```python import os def check_drivers(): drivers = os.listdir('/dev') print("Available devices:") for driver in drivers: print(driver) # 检查设备驱动 check_drivers() ``` ### 示例代码:使用 QGroundControl 烧录固件 ```python import subprocess def flash_with_qgroundcontrol(firmware_path): try: subprocess.run(['qgroundcontrol', 'flash', '--firmware', firmware_path], check=True) print("Firmware flashed successfully using QGroundControl.") except subprocess.CalledProcessError as e: print(f"Failed to flash firmware using QGroundControl: {e}") # 使用 QGroundControl 烧录固件 flash_with_qgroundcontrol('path/to/firmware.bin') ``` ### 示例代码:查看日志和调试信息 ```python import logging logging.basicConfig(filename='mission_planner.log', level=logging.DEBUG) def log_debug_info(): logging.debug("Checking device connection...") logging.debug("Attempting to connect to device on /dev/ttyUSB0") # 查看日志和调试信息 log_debug_info() ``` ### 示例代码:更新设备驱动 ```python import subprocess def update_drivers(): try: subprocess.run(['sudo', 'apt-get', 'update'], check=True) subprocess.run(['sudo', 'apt-get', 'install', 'firmware-realtek'], check=True) print("Drivers updated successfully.") except subprocess.CalledProcessError as e: print(f"Failed to update drivers: {e}") # 更新设备驱动 update_drivers() ``` ### 示例代码:检查参数配置 ```python def check_parameters(): parameters = { 'PARAM1': 1, 'PARAM2': 2, # 添加更多参数 } print("Current parameters:") for param, value in parameters.items(): print(f"{param}: {value}") # 检查参数配置 check_parameters() ``` ### 示例代码:重新启动 Mission Planner ```python import os def restart_mission_planner(): try: os.system('pkill missionplanner') os.system('missionplanner &') print("Mission Planner restarted.") except Exception as e: print(f"Failed to restart Mission Planner: {e}") # 重新启动 Mission Planner restart_mission_planner() ``` ### 示例代码:检查固件版本兼容性 ```python def check_firmware_compatibility(firmware_version): compatible_versions = ['v1.0', 'v1.1', 'v1.2'] if firmware_version in compatible_versions: print(f"Firmware version {firmware_version} is compatible.") else: print(f"Firmware version {firmware_version} is not compatible.") # 检查固件版本兼容性 check_firmware_compatibility('v1.0') ``` ### 示例代码:检查串口配置 ```python def check_serial_config(port): try: import serial ser = serial.Serial(port, baudrate=115200, timeout=1) print(f"Serial port {port} configured successfully.") ser.close() except serial.SerialException as e: print(f"Failed to configure serial port {port}: {e}") # 检查串口配置 check_serial_config('/dev/ttyUSB0') ``` ### 示例代码:检查设备识别 ```python def check_device_recognition(): import serial.tools.list_ports ports = list(serial.tools.list_ports.comports()) print("Recognized devices:") for port in ports: print(port) # 检查设备识别 check_device_recognition() ``` ### 示例代码:检查固件烧录日志 ```python def check_flash_log(log_path): try: with open(log_path, 'r') as file: log_content = file.read() print("Flash log content:") print(log_content) except FileNotFoundError: print(f"Log file {log_path} not found.") # 检查固件烧录日志 check_flash_log('flash_log.txt') ``` ### 示例代码:检查设备固件版本 ```python def check_device_firmware_version(): # 假设设备通过串口返回固件版本 import serial try: ser = serial.Serial('/dev/ttyUSB0', baudrate=115200, timeout=1) ser.write(b'VERSION\n') response = ser.readline().decode('utf-8').strip() print(f"Device firmware version: {response}") ser.close() except serial.SerialException as e: print(f"Failed to read firmware version: {e}") # 检查设备固件版本 check_device_firmware_version() ``` ### 示例代码:检查设备死机状态 ```python def check_device_crash(): # 假设设备通过串口返回状态 import serial try: ser = serial.Serial('/dev/ttyUSB0', baudrate=115200, timeout=1) ser.write(b'STATUS\n') response = ser.readline().decode('utf-8').strip() if 'CRASH' in response: print("Device is in crash state.") else: print("Device is running normally.") ser.close() except serial.SerialException as e: print(f"Failed to check device crash state: {e}") # 检查设备死机状态 check_device_crash() ``` ### 示例代码:检查设备重启 ```python def check_device_reboot(): # 假设设备通过串口返回重启信息 import serial try: ser = serial.Serial('/dev/ttyUSB0', baudrate=115200, timeout=1) ser.write(b'REBOOT\n') response = ser.readline().decode('utf-8').strip() print(f"Device reboot response: {response}") ser.close() except serial.SerialException as e: print(f"Failed to check device reboot: {e}") # 检查设备重启 check_device_reboot() ``` ### 示例代码:检查设备固件完整性 ```python def check_firmware_integrity(firmware_path): import hashlib try: with open(firmware_path, 'rb') as file: firmware_data = file.read() md5_hash = hashlib.md5(firmware_data).hexdigest() print(f"Firmware MD5 hash: {md5_hash}") except FileNotFoundError: print(f"Firmware file {firmware_path} not found.") # 检查设备固件完整性 check_firmware_integrity('path/to/firmware.bin') ``` ### 示例代码:检查设备固件签名 ```python def check_firmware_signature(firmware_path): # 假设使用某种签名验证工具 import subprocess try: subprocess.run(['firmware_sign_tool', 'verify', firmware_path], check=True) print("Firmware signature is valid.") except subprocess.CalledProcessError as e: print(f"Failed to verify firmware signature: {e}") # 检查设备固件签名 check_firmware_signature('path/to/firmware.bin') ``` ### 示例代码:检查设备固件烧录进度 ```python def check_flash_progress(): # 假设使用某种烧录工具的 API import some_flash_tool progress = some_flash_tool.get_flash_progress() print(f"Current flash progress: {progress}%") # 检查设备固件烧录进度 check_flash_progress() ``` ### 示例代码:检查设备固件烧录错误 ```python def check_flash_errors(): # 假设使用某种烧录工具的 API import some_flash_tool errors = some_flash_tool.get_flash_errors() if errors: print("Flash errors occurred:") for error in errors: print(error) else: print("No flash errors occurred.") # 检查设备固件烧录错误 check_flash_errors() ``` ### 示例代码:检查设备固件烧录日志 ```python def check_flash_log(log_path): try: with open(log_path, 'r') as file: log_content = file.read() print("Flash log content:") print(log_content) except FileNotFoundError: print(f"Log file {log_path} not found.") # 检查设备固件烧录日志 check_flash_log('flash_log.txt') ``` ### 示例代码:检查设备固件烧录日志 ```python def check_flash_log(log_path): try: with open(log_path, 'r') as file: log_content = file.read() print("Flash log content:") print(log_content) except FileNotFoundError: print(f"Log file {log_path} not found.") # 检查设备固件烧录日志 check_flash_log('flash_log.txt') ``` ### 示例代码:检查设备固件烧录日志 ```python def check_flash_log(log_path): try: with open(log_path, 'r') as file: log_content = file.read() print("Flash log content:") print(log_content) except FileNotFoundError: print(f"Log file {log_path} not found.") # 检查设备固件烧录日志 check_flash_log('flash_log.txt') ``` ### 示例代码:检查设备固件烧录日志 ```python def check_flash_log(log_path): try: with open(log_path, 'r') as file: log_content = file.read() print("Flash log content:") print(log_content) except FileNotFoundError: print(f"Log file {log_path} not found.") # 检查设备固件烧录日志 check_flash_log('flash_log.txt') ``` ### 示例代码:检查设备固件烧录日志 ```python def check_flash_log(log_path): try: with open(log_path, 'r') as file: log_content = file.read() print("Flash log content:") print(log_content) except FileNotFoundError: print(f"Log file {log_path} not found.") # 检查设备固件烧录日志 check_flash_log('flash_log.txt') ``` ### 示例代码:检查设备固件烧录日志 ```python def check_flash_log(log_path): try: with open(log_path, 'r') as file: log_content = file.read() print("Flash log content:") print(log_content) except FileNotFoundError: print(f"Log file {log_path} not found.") # 检查设备固件烧录日志 check_flash_log('flash_log.txt') ``` ### 示例代码:检查设备固件烧录日志 ```python...... ```python def check_flash_log(log_path): try: with open(log_path, 'r') as file: log_content = file.read() print("Flash log content:") print(log_content) except FileNotFoundError: print(f"Log file {log_path} not found.") # 检查设备固件烧录日志 check_flash_log('flash_log.txt') ``` ### 示例代码:检查设备固件烧录日志 ```python def check_flash_log(log_path): try: with open(log_path, 'r') as file: log_content = file.read() print("Flash log content:") print(log_content) except FileNotFoundError: print(f"Log file {log_path} not found.") # 检查设备固件烧录日志 check_flash_log('flash_log.txt') ``` ### 示例代码:检查设备固件烧录日志 ```python def check_flash_log(log_path): try: with open(log_path, 'r') as file: log_content = file.read() print("Flash log content:") print(log_content) except FileNotFoundError: print(f"Log file {log_path} not found.") # 检查设备固件烧录日志 check_flash_log('flash_log.txt') ``` ### 示例代码:检查设备固件烧录日志 ```python def check_flash_log(log_path): try: with open(log_path, 'r') as file: log_content = file.read() print("Flash log content:") print(log_content) except FileNotFoundError: print(f"Log file {log_path} not found.") # 检查设备固件烧录日志 check_flash_log('flash_log.txt') ``` ### 示例代码:检查设备固件烧录日志 ```python def check_flash_log(log_path): try: with open(log_path, 'r') as file: log_content = file.read() print("Flash log content:") print(log_content) except FileNotFoundError: print(f"Log file {log_path} not found.") # 检查设备固件烧录日志 check_flash_log('flash_log.txt') ``` ### 示例代码:检查设备固件烧录日志 ```python def check_flash_log(log_path): try: with open(log_path, 'r') as file: log_content = file.read() print("Flash log content:") print(log_content) except FileNotFoundError: print(f"Log file {log_path} not found.") # 检查设备固件烧录日志 check_flash_log('flash_log.txt') ``` ### 示例代码:检查设备固件烧录日志 ```python def check_flash_log(log_path): try...... ```python def check_flash_log(log_path): try: with open(log_path, 'r') as file: log_content = file.read() print("Flash log content:") print(log_content) except FileNotFoundError: print(f"Log file {log_path} not found.") # 检查设备固件烧录日志 check_flash_log('flash_log.txt') ``` ### 示例代码:检查设备固件烧录日志 ```python def check_flash_log(log_path): try: with open(log_path, 'r') as file: log_content = file.read() print("Flash log content:") print(log_content) except FileNotFoundError: print(f"Log file {log_path} not found.") # 检查设备固件烧录日志 check_flash_log('flash_log.txt') ``` ### 示例代码:检查设备固件烧录日志 ```python def check_flash_log(log_path): try: with open(log_path, 'r') as file: log_content = file.read() print("Flash log content:") print(log_content) except FileNotFoundError: print(f"Log file {log_path} not found.") # 检查设备固件烧录日志 check_flash_log('flash_log.txt') ``` ### 示例代码:检查设备固件烧录日志 ```python def check_flash_log(log_path): try: with open(log_path, 'r') as file: log_content = file.read() print("Flash log content:") print(log_content) except FileNotFoundError: print(f"Log file {log_path} not found.") # 检查设备固件烧录日志 check_flash_log('flash_log.txt') ``` ### 示例代码:检查设备固件烧录日志 ```python def check_flash_log(log_path): try: with open(log_path, 'r') as file: log_content = file.read() print("Flash log content:") print(log_content) except FileNotFoundError: print(f"Log file {log_path} not found.") # 检查设备固件烧录日志 check_flash_log('flash_log.txt') ``` ### 示例代码:检查设备固件烧录日志 ```python def check_flash_log(log_path): try: with open(log_path, 'r') as file: log_content = file.read() print("Flash log content:") print(log_content) except FileNotFoundError: print(f"Log file {log_path} not found.") # 检查设备固件烧录日志 check_flash_log('flash_log.txt') ``` ### 示例代码:检查设备固件烧录日志 ```python def check_flash_log(log_path): try: with......
评论 9
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值