PID调参避坑手册:用APM/PX4飞控让无人机稳如老狗

无人机/飞控--ArduPilot、PX4学习历程记录(1) PX4支持全球导航卫星系统(GNSS)接收器 和 罗盘(磁力计),实时动态(RTK)GPS接收器。的高级飞行状态和飞行准备提示。例如,这些提示表明飞行器是否正确校准,是否有SD卡,是否有位置锁定,是否可以安全起飞,是否解锁等。根据up主的讲解,我进行整理。飞控是最底层的控制器,直接对无人机进行控制,其他的控制系统充当高级控制器,对飞控进行控制。PX4将光流传感器输出 与 来自其他定位源(例如GPS)的信息融合,以提供更准确的位置。飞行器状态包括:位置/高度,航向,速度,空速,方向(姿态),电池电量等。 阅读详情

PID调参避坑手册:用APM/PX4飞控让无人机稳如老狗

刚拿到开源飞控,看着满屏的参数列表,是不是感觉头都大了?尤其是PID控制器,P、I、D三个字母背后,藏着决定无人机是“稳如磐石”还是“疯如野马”的关键。很多新手朋友一上来就对着默认参数一顿乱改,结果不是高频振荡就是反应迟钝,甚至直接“炸机”收场。其实,PID调参并非玄学,它更像是一门结合了系统动力学直觉和科学调试方法的艺术。无论是APM(ArduPilot)还是PX4,其核心的飞行控制逻辑都构建在PID框架之上,理解这套框架的运作机制,掌握一套行之有效的调参流程,你就能让手中的无人机从“飘忽不定”变得“指哪打哪”。这篇文章,我们就抛开复杂的理论推导,直接从实战出发,结合具体的飞行日志分析,为你梳理出一条清晰、可复现的PID调参路径,并避开那些常见的“坑”。

1. 理解PID:不只是三个字母

在动手调参之前,我们必须先搞清楚,我们调的到底是什么。PID控制器是一个在工程领域应用了上百年的经典反馈控制算法,它的目标很简单:让被控对象(比如无人机的姿态角)快速、平稳、准确地达到我们期望的值(设定点)。

PID 是三个独立作用项的缩写:

  • P - 比例项: 这是最“直观”的一项。它产生的控制力与当前误差(期望值减去当前值)成正比。误差越大,修正力度就越大。你可以把它想象成开车时,发现偏离了车道中心,你立刻向中心方向打方向盘,偏离越远,打得越急。P值过小,无人机反应迟钝,会有静差(始终无法精确到达目标点);P值过大,则会产生剧烈振荡,甚至发散。
  • I - 积分项: 这一项负责消除静差。它累积历史误差的总和。如果系统因为某些原因(如风扰、电机推力微小差异)存在一个持续的微小误差,比例项可能无力完全纠正,这时积分项就会逐渐“发力”,直到误差被完全消除。但I值过大,会导致系统反应“迟钝”,出现超调,并在调整后期产生低频振荡。
  • D - 微分项: 这一项具有“预见性”。它关注误差变化的速度(微分)。当误差快速增大时,微分项会产生一个反向的控制力,试图“刹车”,抑制变化趋势。它能有效增加系统阻尼,抑制振荡,提高稳定性。但D值对传感器噪声极其敏感,设置过大会放大噪声,导致电机高频率抽搐。

在APM/PX4中,PID控制器并非只有一个,而是层层嵌套,构成了一个级联控制回路。理解这个结构是有效调参的前提。

注意:级联控制的核心思想是“内环稳,外环才准”。内环(速率环)负责快速响应,外环(角度环)负责精确跟踪。

典型的控制结构如下表所示:

控制层级 被控量 控制器输出 主要作用 调参响应速度
外环 (角度环) 飞行器姿态角(Roll, Pitch, Yaw) 期望的角速度 控制无人机达到并保持指定角度。响应较慢,要求平稳。 慢
无人机飞控PID调参原理与APM/PX4实战指南 PID控制是无人机姿态与位置稳定的核心基础,其本质是对误差信号在时间域上的比例、积分、微分运算,分别对应系统刚度、记忆能力与阻尼特性。在实际飞控中,PID并非独立参数调节,而是深度耦合于硬件平台(如APM的Arduino生态与PX4的Nuttx实时OS)、传感器动态(IMU延迟、GPS跳变)及气动模型(高原空气密度变化、载荷转动惯量)。理解P项的位置误差放大、I项的抗扰累积、D项的变化率抑制,并结合前馈补偿(FF)、抗饱和机制与分层闭环设计,才能实现从室内悬停到高原测绘的鲁棒飞行。本文聚焦APM与PX4两大 阅读详情

相关推荐

adb 通信协议分析以及实现 (三) (Adb 网络通信部分解析)

这篇文章说下adb 和adb 服务进程之间通信的socket 协议。  adb 服务进程启动之后,会监视本地的5037 端口,使用的是TCP 协议,所以adb 发送的命令其实就是往本地的5037 端口发送数据,做过网络编程的都知道,本机可以用127.0.0.1 ip地址。 有了ip 地址和端口号socket 通信就没问题 1)  命令发送方式      

inforecovvery的博客 2863

miRNA测序数据生信分析——第一讲,总结概述

这里的miRNA测序指转录水平的测序。这里每一个数据库都可以在线访问,但是如果要本地使用,都需要进行数据库文件下载,整理。

weixin_44616693的博客 4945

Dify DSL文件分享 Dify讨论群 大模型token资源等(持续收集更新)

基于LLMOps平台-Dify的一站式学习平台。包含不限于:Dify案例、DSL文件分享、模型接入、Dify交流讨论等各类资源分享。

同名公众号:dify实验室 3709

RML2016.10a (CNN、LSTM、CNN-LSTM、CNN-LSTM-Multi-head-attention, TensorFlow)

RML2016.10a (CNN、LSTM、CNN-LSTM、CNN-LSTM-Multi-head-attention, TensorFlow) 包含所有数据和代码,支持一键运行(jupyter)

qq_40999533的博客 1472

【超详细】磁力计数据读取--以IST8310为例

第一章讲了IST8310的特性,I2C通信,最高支持400kHz通信速率,14位或者16位自适应数据输出等特性第二章讲了内部结构第三章讲了电气特性第四章讲了如何联系他们然后数据手册就没了。。。在大疆的开发手册中找到了寄存器的手册,如下:点开I2C配置选项, 下图是配好的:观察IST8310的数据手册,发现其支持最大400kHz的I2C通信速率,也就是快速I2C模式,所以第一行I2C Speed Mode我们选Fast Mode同时不要忘记了在C板中I2C3的两个IO口分别是PA8和PC9(一般来说都是这两个

lmh_12138的博客 9997

大数据Alluxio面试题及参考答案

Alluxio 在大数据生态里的定位是作为数据编排层,能在不同计算框架和存储系统之间起到桥梁的作用。它的核心功能在于加速数据访问,让大数据应用能够更高效地使用数据。Alluxio 把数据存储和数据处理分离开来,使计算框架可以在不考虑底层存储细节的情况下访问数据,这样就提高了系统的灵活性和可扩展性。Alluxio 和 HDFS 既存在关联又有区别。从关联方面来看,HDFS 是一种广泛使用的分布式文件系统,很多大数据应用都将其作为主要的数据存储系统。Alluxio 可以和 HDFS 集成,把 HDFS 当作底层

大模型大数据攻城狮的专栏 857

【人工智能】架构演进:基于本体论与 LLM Agent 的供应链备件决策闭环实践

本文探讨了如何将本体论(Ontology)与大语言模型(LLM)Agent结合,构建供应链备件管理的智能决策系统。针对LLM在垂直领域存在的幻觉和逻辑缺陷问题,提出通过本体论建立结构化知识框架,形成四层架构:知识建模、动态感知、深度分析和决策闭环。系统利用图数据库实例化领域本体,融合多源数据实现实时感知,结合图谱推理和时序预测进行确定性分析,最终通过工具调用完成决策执行。技术选型推荐Gemini 1.5 Pro、Neo4j和LangChain等工具,实现从自动化到智能化的升级。该架构为工业领域提供了可解释、

奶爸的编程之路,也就一周冷个三天 158

雨雾天YOLOv8检测拉胯?暗通道去雾+上下文注意力双优化,mAP从58%飙到79%,暴雨也能看清车牌

室外交通监控:高速、省道的雨雾天检测,重点解决小车、货车漏检;车载ADAS系统:雨天行车时的前方车辆、行人识别,需实时性(<40ms);隧道出入口:明暗交界+雾天的复杂场景,暗通道能平衡亮度。

专注于Python爬虫开发,分享爬虫技巧、项目实战与反爬经验,使用Scrapy、BeautifulSoup等工具,解决数据抓取难题。 1377

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

pscad IEEE标准系统搭建说明

pscad IEEE标准系统搭建说明,包含典型的IEEE 9节点、14节点、30节点、39节点和118节点系统。内含标准测试系统的原始数据和潮流结果。

LinePhone3.2.7(android端最新版本) sip客户端

SIP客户端For android:LinePhone3.2.7(最新版本),官网地址:http://www.linphone.org/

WINCC7.3破解文件

WINCC7.3硬件够破解文件,有需要的下载!WINCC7.3硬件够破解文件,有需要的下载!

上一篇: VSCode代码格式化避坑指南:为什么你的大括号内代码总是格式化失败?
下一篇: 星闪OLED显示乱码?手把手教你玩转阴码字模生成与调试
red88
博客等级 码龄18年 526粉丝 1607原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符  | 博主筛选后可见
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值