public class HiTechnicNxtGyroSensor
extends LegacyModulePortDeviceImpl
HiTechnicNxtGyroSensor
supports the legacy HiTechnic gyro sensor. This sensor
is an analog sensor that must be connected using a Core Legacy Module.
"The NXT Gyro Sensor contains a single axis gyroscopic sensor that detects rotation and returns a value representing the number of degrees per second of rotation. The Gyro Sensor can measure up to +/- 360° per second of rotation."
"The rotation rate can be read up to approximately 300 times per second"
Note that the value coming out of the sensor is the rotation rate in the clockwise direction.
Modifier and Type | Field and Description |
---|---|
protected double |
biasVoltage
The voltage indicting zero angular rotation
|
protected double |
degreesPerSecondPerVolt
The conversion factor between voltage and angular rotation rate
|
protected boolean |
isCalibrating
whether or not the gyroscope is currently calibrating
|
static java.lang.String |
TAG |
Constructor and Description |
---|
HiTechnicNxtGyroSensor(LegacyModule legacyModule,
int physicalPort) |
Modifier and Type | Method and Description |
---|---|
void |
calibrate()
Calibrates the HiTechnic gyroscope attempting to establish a reasonable value for
its internal bias using default calibration parameters.
|
void |
calibrate(int msCalibrationDuration,
int msCalibrationInterval)
Calibrates the HiTechnic gyroscope attempting to establish a reasonable value for
its internal bias using specified calibration parameters
|
void |
calibrate(int msCalibrationDuration,
int msCalibrationInterval,
int msSettlingTime)
Calibrates the HiTechnic gyroscope attempting to establish a reasonable value for
its internal bias using specified calibration parameters
|
void |
close() |
AngularVelocity |
getAngularVelocity(AngleUnit unit) |
java.util.Set<Axis> |
getAngularVelocityAxes() |
protected float |
getAngularZVelocity(AngleUnit unit) |
double |
getBiasVoltage() |
java.lang.String |
getConnectionInfo() |
double |
getDefaultBiasVoltage() |
double |
getDefaultDegreesPerSecondPerVolt() |
double |
getDegreesPerSecondPerVolt() |
java.lang.String |
getDeviceName() |
int |
getHeading()
Method not supported by hardware.
|
Manufacturer |
getManufacturer() |
double |
getMaxVoltage() |
double |
getRotationFraction() |
int |
getVersion() |
boolean |
isCalibrating()
Returns whether or not the gyro is currently calibrating
|
protected void |
moduleNowArmedOrPretending() |
protected void |
notSupported() |
int |
rawX()
Method not supported by hardware.
|
int |
rawY()
Method not supported by hardware.
|
int |
rawZ()
Method not supported by hardware.
|
double |
readRawVoltage() |
void |
resetDeviceConfigurationForOpMode() |
void |
resetZAxisIntegrator()
Method not supported by hardware.
|
void |
setBiasVoltage(double biasVoltage) |
void |
setDegreesPerSecondPerVolt(double degreesPerSecondPerVolt) |
protected void |
sleep(int ms) |
java.lang.String |
status() |
java.lang.String |
toString() |
public static final java.lang.String TAG
protected double biasVoltage
protected double degreesPerSecondPerVolt
protected boolean isCalibrating
public HiTechnicNxtGyroSensor(LegacyModule legacyModule, int physicalPort)
protected void moduleNowArmedOrPretending()
public double getBiasVoltage()
public void setBiasVoltage(double biasVoltage)
public double getDegreesPerSecondPerVolt()
public void setDegreesPerSecondPerVolt(double degreesPerSecondPerVolt)
public double getDefaultDegreesPerSecondPerVolt()
public double getDefaultBiasVoltage()
public java.util.Set<Axis> getAngularVelocityAxes()
public AngularVelocity getAngularVelocity(AngleUnit unit)
protected float getAngularZVelocity(AngleUnit unit)
public java.lang.String toString()
public void calibrate()
public void calibrate(int msCalibrationDuration, int msCalibrationInterval)
msCalibrationDuration
- the amount of time to spend on calibrationmsCalibrationInterval
- the interval, in ms, to pause between eachpublic void calibrate(int msCalibrationDuration, int msCalibrationInterval, int msSettlingTime)
msCalibrationDuration
- the amount of time to spend on calibrationmsCalibrationInterval
- the interval, in ms, to pause between eachmsSettlingTime
- the initial duration, in ms, to allow the gyro to settleprotected void sleep(int ms)
public boolean isCalibrating()
public double getRotationFraction()
public double readRawVoltage()
public double getMaxVoltage()
public int getHeading()
java.lang.UnsupportedOperationException
public int rawX()
java.lang.UnsupportedOperationException
public int rawY()
java.lang.UnsupportedOperationException
public int rawZ()
java.lang.UnsupportedOperationException
public void resetZAxisIntegrator()
java.lang.UnsupportedOperationException
public java.lang.String status()
public Manufacturer getManufacturer()
public java.lang.String getDeviceName()
public java.lang.String getConnectionInfo()
public int getVersion()
public void resetDeviceConfigurationForOpMode()
public void close()
protected void notSupported()