Class EV3GyroSensor
- java.lang.Object
-
- lejos.hardware.Device
-
- lejos.hardware.sensor.BaseSensor
-
- lejos.hardware.sensor.UARTSensor
-
- lejos.hardware.sensor.EV3GyroSensor
-
- All Implemented Interfaces:
java.io.Closeable,java.lang.AutoCloseable,SensorMode,SensorModes,SampleProvider
public class EV3GyroSensor extends UARTSensor
EV3 Gyro sensor
The digital EV3 Gyro Sensor measures the sensors rotational motion and changes in its orientation.Supported modes Mode name Description unit(s) Getter Angle Measures the orientation of the sensor Degrees getAngleMode()Rate Measures the angular velocity of the sensor Degrees / second getRateMode()Rate and Angle Measures both angle and angular velocity Degrees, Degrees / second getAngleAndRateMode()Sensor configuration
Usereset()to recalibrate the sensor and to reset accumulated angle to zero. Keep the sensor motionless during a reset. The sensor shuld also be motionless during initialization.See Sensor Product page See The leJOS sensor framework See
leJOS conventions for SampleProviders- Author:
- Andy, Aswin Bouwmeester
-
-
Field Summary
-
Fields inherited from class lejos.hardware.sensor.UARTSensor
currentMode, port
-
Fields inherited from class lejos.hardware.sensor.BaseSensor
modes
-
-
Constructor Summary
Constructors Constructor Description EV3GyroSensor(Port port)EV3GyroSensor(UARTPort port)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description SampleProvidergetAngleAndRateMode()EV3 Gyro sensor, Rate mode
Measures both angle and angular velocity of the sensor.SampleProvidergetAngleMode()EV3 Gyro sensor, Angle mode
Measures the orientation of the sensor in respect to its start orientation.SampleProvidergetRateMode()EV3 Gyro sensor, Rate mode
Measures angular velocity of the sensor.voidreset()Hardware calibration of the Gyro sensor and reset off accumulated angle to zero.-
Methods inherited from class lejos.hardware.sensor.UARTSensor
switchMode
-
Methods inherited from class lejos.hardware.sensor.BaseSensor
fetchSample, getAvailableModes, getCurrentMode, getMode, getMode, getModeCount, getName, sampleSize, setCurrentMode, setCurrentMode, setModes
-
Methods inherited from class lejos.hardware.Device
close, releaseOnClose
-
-
-
-
Method Detail
-
getAngleMode
public SampleProvider getAngleMode()
EV3 Gyro sensor, Angle mode
Measures the orientation of the sensor in respect to its start orientation.Size and content of the sample
The sample contains one elements representing the orientation (in Degrees) of the sensor in respect to its start position.Configuration
The start position can be set to the current position using the reset method of the sensor.- Returns:
- A sampleProvider
See
leJOS conventions for SampleProviders
-
getRateMode
public SampleProvider getRateMode()
EV3 Gyro sensor, Rate mode
Measures angular velocity of the sensor.Size and content of the sample
The sample contains one elements representing the angular velocity (in Degrees / second) of the sensor.Configuration
The sensor can be recalibrated using the reset method of the sensor.- Returns:
- A sampleProvider
See
leJOS conventions for SampleProviders
-
getAngleAndRateMode
public SampleProvider getAngleAndRateMode()
EV3 Gyro sensor, Rate mode
Measures both angle and angular velocity of the sensor.Size and content of the sample
The sample contains two elements. The first element contains angular velocity (in degrees / second). The second element contain angle (in degrees).Configuration
The sensor can be recalibrated using the reset method of the sensor.- Returns:
- A sampleProvider
See
leJOS conventions for SampleProviders
-
reset
public void reset()
Hardware calibration of the Gyro sensor and reset off accumulated angle to zero.
The sensor should be motionless during calibration.
-
-