Robofun 機器人論壇

 找回密碼
 申請會員
搜索
熱搜: 活動 交友 discuz
樓主: nichal
打印 上一主題 下一主題

PID控制說明

[複製鏈接]
1#
發表於 2012-5-30 19:26:19 | 顯示全部樓層
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-5-4 06:09 , Processed in 0.156195 second(s), 7 queries , Apc On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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