将速度增量转换为占空比的增量
时间: 2024-04-24 09:24:32 浏览: 20
根据引用\[1\]中的代码,将速度增量转换为占空比的增量的公式如下:
int incPIDcalc(PIDtypedef *PIDx,u16 nextpoint){
int iError,iincpid;
iError=PIDx->setpoint-nextpoint; // 当前误差
iincpid=PIDx->proportion*(iError-PIDx->last_error)+PIDx->integral*iError+PIDx->derivative*(iError-2*PIDx->last_error+PIDx->prev_error);
PIDx->prev_error=PIDx->last_error; // 存储误差,便于下次计算
PIDx->last_error=iError;
return(iincpid);
}
其中,iincpid表示占空比的增量。这个公式中包含了比例项、积分项和微分项。具体来说,比例项是PIDx->proportion乘以当前误差iError,积分项是PIDx->integral乘以误差的累积值iError,微分项是PIDx->derivative乘以误差的变化率(iError-2*PIDx->last_error+PIDx->prev_error)。这些项的加权和就是占空比的增量。
因此,通过调用incPIDcalc函数,可以将速度增量转换为占空比的增量。
#### 引用[.reference_title]
- *1* *2* *3* [增量式 PID 算法的 STM32 实现](https://blog.csdn.net/qq_25814297/article/details/117021587)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insert_down1,239^v3^insert_chatgpt"}} ] [.reference_item]
[ .reference_list ]
相关推荐
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)