Calibrate Sensors Icon of block

感應器校準 Calibrate Sensors

環境的條件是會影響光源感應器跟聲控感應器的使用.所以為了讓這些感應器可以在特定的環境下發揮最好的效能,校準感應器就是一項重要的工作.
Ambient (surrounding) conditions can affect the performance of both light and sound sensors. Therefore, it is important to calibrate these sensors for a particular environment so that they perform in an optimal way.

舉例來說, 在一個很亮的房間裡,沒有校準過的感應器只會在很亮的光源刺激下才作用.這樣就會喪失它原有的功能. 也就是說,如果原本在較暗的地點寫好了程式並測試正常,但當你的機器人移動到較亮的地方時,可能就會發生不如預期的反應.校準過感應器是可以在不同的環境下都使用最大的範圍來讀取數據.
For instance, in a very bright room, an un-calibrated light sensor might deliver only deliver high readings, reducing its potential performance. If you created your program in a dimmer location, your robot might react in an unusual ways when it is moved under more intense light. Calibrating the light sensor will allow it to read values over its full range under different conditions.

有兩種方式可以藉由 MINDSTORM NXT 軟體來校準光源跟聲控感應器. 第一種是使用工具選單下的校準感應器功能. 使用這個功能時,在每一個地點只須校準一次感應器,而不用每次在執行程式時校準. 例如,當參加第一屆LEGO機器人大賽時,只須對那個照明很充足的競賽桌校準感應器一次,而無須在每次寫程式時校準.
There are two ways to calibrate light and sound sensors using the MINDSTORMS NXT software. The first is to use the Calibrate Sensors function from the Tools menu. Using this function, you can calibrate a light or sound sensor just once per location (and not every time your program runs). For instance, if you attend a First LEGO League competition with brightly lighted competition tables, you can calibrate your light sensor just once on a table and not have to worry about calibrating each time you run your program.

第二個方式則是在程式中使用校準指令. 那麼每次在執行程式時,這些校準指令就會對當時的環境進行感應器校準功能(請參考教準指令的說明)
The second option for calibration involves using use several Calibration blocks in your program. Each time you run your program, these blocks will calibrate the sensors for current conditions. (See the Calibration block Help entry.)

使用感應器校準功能
Using the Calibrate Sensors function

在使用這個功能前請先確定NXT已經連結到電腦並且是開啟狀態. 接下來,確定要校準的感應器是連結到NXT並注意連結埠是否正常.
To use this function, first make sure that your NXT is connected to your computer and that it is turned on. Also, make sure that the sensors you want to calibrate are connected to the NXT. Pay particular attention to the ports they are connected to.

當準備好後,選取工具選單下的校準感應器功能.此時,校準感應器對話框就會出現. 如果NXT沒有連接到電腦則這個對話框會是沒有作用的狀態.
When you are ready, select the Calibrate Sensors function from the Tools menu. The Calibrate Sensors dialog box will appear. If no NXT is connected to your computer, the dialog box will appear grayed out.

Image of Calibrate Sensors dialog box

光源感應器校準
Calibrating a light sensor

選取光源感應器跟所連結的連接埠,然後按下校準按鍵. 這個動作會下載一個小程式到NXT並自動執行.Select the light sensor and the port the sensor is connected to. Then click the Calibrate button. This will download a small program to the NXT and run it automatically.

在NXT的螢幕上,會看到"最小值"的字樣出現,拿起光源感應器指向必須被偵測為最暗的地點或是物體,然後按下NXT的橘色按鍵.
On the NXT’s screen you will see text that reads “Min Value:”. Point the light sensor towards a material or spot that represents what the light sensor should measure as dark. Press the orange Enter button on the NXT.

接下來會看到"最大值"字樣,同樣地拿起感應器,並指向在程式執行時應該被偵測為最亮的地點或是物體.並再次地按下橘色的按鍵.即完成校準程序
Next you will see text that reads “Max Value:”. Point the light sensor towards a material or spot that represents the brightest location the sensor will encounter during the program. Press the orange Enter button again. Calibration is complete.

聲控感應器校準
Calibrating a sound sensor

選取聲控感應器跟所連結的連接埠,然後按下校準按鍵. 這個動作會下載一個小程式到NXT並自動執行.
Select the sound sensor and the port the sensor is connected to. Then click the Calibrate button. This will download a small program to the NXT and run it automatically.

在NXT的螢幕上,會看到"最小值"的字樣出現,把聲控感應器放在程式執行時的環境中並測得所有的背景噪音,然後按下NXT的橘色按鍵.
On the NXT’s screen you will see text that reads “Min Value:”. Position the sound sensor in the environment it will encounter when the program is running and where any background noise is measurable. Press the orange Select button on the NXT.

接下來會看到"最大值"的字樣.偵測最大的聲音或是發出最大的聲音來測量,再次按下橘色按鍵.即完成教準程序.
Next you will see text that reads “Select Max:”. Measure or make the loudest sound you want to measure and press the Select button again. Calibration is complete.

進階學習
Learning more

如果要學習感應器的功能與測量使用,請參閱隨MINDSTORM NXT產品附贈的使用手冊中"NXT科技"章節.To learn more about the different sensors’ abilities and measurements please see the NXT Technology chapter in the printed User Guide that came with your MINDSTORMS NXT product.

注意: 在校準感應器功能中所得到的校準數值是可以被校準指令所覆寫,反之亦然. 即是最近一次的教準才會發揮作用.而這個校準值會一直使用到下次校準前或是復原預設值時(參閱下方說明).
Note: Calibration values set using the Calibrate Sensors function can be overwritten by Calibration blocks in a program, and vice versa. The most recent calibration event will take precedence. The calibration will stay in effect until you deliberately change the values or and reset them (see below).

注意: 感應器在教準後對所有連結埠都是有效的,不論在教準時是連結到哪個連接埠.假設使用連接埠3來做校準光源感應器,那麼稍後使用連接埠4來連結感應器時,還是會發揮校準作用.
Note:The calibration will work for the specific sensor no matter which port you connect it to after completing the calibration process. If you calibrate the light sensor on port 3, the calibration will still remain in effect if you later connect the light sensor to port 4.

復原預設校準值
Restoring default calibration values

如果想要重頭開始並復原預設的校準值,請依照下列指示.
If you want to start over and restore the factory default calibration values, follow the instructions below.

首先,開啟NXT並連結到電腦.
First, turn on the NXT and connect it to your computer.

從工具選單中選取校準感應器,出現校準感應器對話框.如果NXT沒有連結正確則此對話框會沒有作用.
Select the Calibrate Sensors item from the Tools menu. The Calibrate Sensors dialog box will appear. If no NXT is connected, the dialog box will appear grayed out.

選取想要復原的感應器並按下預設值按鍵.
Select the sensor you want to restore to factory default settings and click Default.