Reads the current value of the HiTechnic Gyro sensor
angularVelocity = GetGyro(port)
angularVelocity = GetGyro(port, handle)
angularVelocity = GetGyro(port) returns the current rotational speed detected by the HiTechnic Gyroscopic sensor. Maximum range is from -360 to 360 degrees per second (according to HiTechnic documentation), however greater values have been observed. Returned values are accurate to +/- 1 degree.
Integration over time gives the rotational position (in degrees). Tests give quite good results. 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.
Before using this function, the gyro sensor must be initialized using OpenGyro and calibrated using CalibrateGyro.
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).
OpenGyro(SENSOR_2); CalibrateGyro(SENSOR_2, 'AUTO'); speed = GetGyro(SENSOR_2); CloseSensor(SENSOR_2);
- Author: Linus Atorf, Rainer Schnitzler (see AUTHORS)
- Date: 2010/09/14
- Copyright: 2007-2010, RWTH Aachen University