Enables calibration mode of the HiTechnic compass sensor
CalibrateCompass(port, f_start, handle)
Calibrate the compass to reduce influence of metallic objects, especially of the NXT motor and brick on compass values. You have to calibrate a roboter only once until the design changes. During calibration the compass should make two full rotations very slowly. The compass sensor has to be opened (using OpenCompass) before execution.
Set f_start = true to start calibration mode, and f_start = false to stop it. In between those commands, the calibration (compass rotation) should occur.
The given port number specifies the connection port. The value port can be addressed by the symbolic constants SENSOR_1 , SENSOR_2, SENSOR_3 and SENSOR_4 analog to the labeling on the NXT Brick.
The last optional argument can be a valid NXT handle. If none is specified, the default handle will be used (call COM_SetDefaultNXT to set one).
% compass must be open for calibration OpenCompass(SENSOR_2); % enable calibration mode CalibrateCompass(SENSOR_2, true); % compass is attached to motor A, rotate 2 full turns m = NXTMotor('A', 'Power', 5, 'TachoLimit', 720) m.SendToNXT(); m.WaitFor(); % calibration should now be complete! CalibrateCompass(SENSOR_2, false);
- Author: Rainer Schnitzler, Linus Atorf (see AUTHORS)
- Date: 2008/08/01
- Copyright: 2007-2010, RWTH Aachen University