# 0- 摘要

市售的Arduino機器車，循線前進時會採用具有雙紅外線感測器的循線感測器，本研究運用PID演算法（Proportional–Integral–Derivative algorithm）實作僅需單一紅外線感測器的循線車。

PID演算法利用三種運算—比例、積分、微分，透過與參考值的誤差（以下皆稱為error），計算出新的參考值，這三種運算的權重分別由Kp、Ki、Kd三個參數進行控制。為求PID演算法的較佳結果，需調整這三個參數值，我們得出參數與時間的關係，藉由分析圖表，得到一組表現最佳的Kp、Ki、Kd值。

此外，針對使用單一感應器的循線車，我們另外製作了採用非PID演算法的「邏輯判斷單感測器循線車」。最後比較「傳統雙感測器循線車」、「邏輯判斷單感測器循線車」和「PID演算法單感測器循線車」這三種循線車的運行速率來判斷優劣。

## 研究動機

學校買了一批Arduino循線車，車子具有兩個紅外線循線感測器，有一天一台車的循線感測器因為碰撞，只剩其中一個能運作，導致無法用原來的程式循線。我們想：若紅外線感測器能讀取亮度數值，就能使車沿線的一側前進，再依亮度多寡控制轉向。

## 研究目的

一、運用PID運算實作單感測器循線車

二、調整PID各參數對速度及準確度的影響

三、PID循線車與邏輯判斷循線車、傳統循線車的比較


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://liner.wancat.cc/master.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
