Robofun 機器人論壇

 找回密碼
 申請會員
搜索
熱搜: 活動 交友 discuz
查看: 3522|回復: 0
打印 上一主題 下一主題

PID 公式

[複製鏈接]
跳轉到指定樓層
1#
發表於 2012-5-30 22:47:31 | 只看該作者 回帖獎勵 |倒序瀏覽 |閱讀模式
error = setpoint - actual_position;

if(error > 0.01 || error < -0.01)
        {
                integral = integral + error*dt;
        }

derivative = (error - pre_error)/dt;

output = (Kp*error) + (Ki*integral) + (Kd*derivative);

if(output > 30000)
        {
                output = 30000;
        }
        else if(output < -30000)
        {
                output = -30000;
        }

return output;

請問公式是這樣嗎
我想要把它轉成c檔
我已經把輸出+給pwm了
可是誤差還是有10啪ㄟ怎麼回事= =
條kp kd ki 直看不太出來= =
您需要登錄後才可以回帖 登錄 | 申請會員

本版積分規則

小黑屋|手機版|Archiver|機器人論壇 from 2005.07

GMT+8, 2024-4-29 04:45 , Processed in 0.165231 second(s), 7 queries , Apc On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

快速回復 返回頂部 返回列表