Class HiTechnicAngleSensor
- java.lang.Object
-
- lejos.hardware.Device
-
- lejos.hardware.sensor.BaseSensor
-
- lejos.hardware.sensor.I2CSensor
-
- lejos.hardware.sensor.HiTechnicAngleSensor
-
- All Implemented Interfaces:
java.io.Closeable,java.lang.AutoCloseable,SensorConstants,SensorMode,SensorModes,SampleProvider
public class HiTechnicAngleSensor extends I2CSensor
Hitechnic Angle sensor
The Angle sensor measures axle rotation position and rotation speed.The code for this sensor has not been tested. Please report test results to the leJOS forum.
Supported modes Mode name Description unit(s) Getter Absolute angle Measures the rotation position of a rotating axle Degrees (0-359) getAngleMode()Accumulated angle Measures the accumulated number of degrees an axle has rotated Degrees getAccumulatedAngleMode()Angular velocity the speed of the axle rotation rotations / second getAngularVelocityMode()Sensor configuration
The zero position of the sensor can be set and stored in the sensors memory using the calibrateAngle method. The accumulated angle can be set to zero using the resetAccumulatedAngle method. The accumulated angle is not stored in memory.See Sensor Product page See The leJOS sensor framework See
leJOS conventions for SampleProviders
-
-
Field Summary
Fields Modifier and Type Field Description protected static intHTANGLE_MODE_CALIBRATEprotected static intHTANGLE_MODE_RESETprotected static intREG_ACCUMULATED_ANGLEprotected static intREG_ANGLEprotected static intREG_SPEED-
Fields inherited from class lejos.hardware.sensor.I2CSensor
address, DEFAULT_I2C_ADDRESS, port, REG_PRODUCT_ID, REG_VENDOR_ID, REG_VERSION, retryCount
-
Fields inherited from class lejos.hardware.sensor.BaseSensor
currentMode, modes
-
Fields inherited from interface lejos.hardware.sensor.SensorConstants
BLACK, BLANK_INDEX, BLUE, BLUE_INDEX, BROWN, GREEN, GREEN_INDEX, MAX_TYPE, MIN_TYPE, MODE_RAW, NXT_ADC_RES, RED, RED_INDEX, TYPE_ANGLE, TYPE_COLORBLUE, TYPE_COLORFULL, TYPE_COLORGREEN, TYPE_COLORNONE, TYPE_COLORRED, TYPE_CUSTOM, TYPE_HIGHSPEED, TYPE_HIGHSPEED_9V, TYPE_HISPEED, TYPE_LIGHT_ACTIVE, TYPE_LIGHT_INACTIVE, TYPE_LOWSPEED, TYPE_LOWSPEED_9V, TYPE_NO_SENSOR, TYPE_REFLECTION, TYPE_SOUND_DB, TYPE_SOUND_DBA, TYPE_SWITCH, TYPE_TEMPERATURE, WHITE, YELLOW
-
-
Constructor Summary
Constructors Constructor Description HiTechnicAngleSensor(I2CPort port)HiTechnicAngleSensor(Port port)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcalibrateAngle()Calibrate the zero position of angle.SensorModegetAccumulatedAngleMode()HiTechnic angle sensor, Accumulated angle mode
Measures the accumulated number of degrees an axle has rotated.SensorModegetAngleMode()HiTechnic angle sensor, Angle mode
Measures the rotation position of a rotating axle.SensorModegetAngularVelocityMode()HiTechnic angle sensor, Angular velocity mode
Measures the rotational speed of an axle.protected voidinit()voidresetAccumulatedAngle()Reset the rotation count of accumulated angle to zero.-
Methods inherited from class lejos.hardware.sensor.I2CSensor
fetchString, getAddress, getData, getData, getPort, getProductID, getRetryCount, getVendorID, getVersion, sendData, sendData, sendData, setAddress, setRetryCount
-
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
-
-
-
-
Field Detail
-
REG_ANGLE
protected static final int REG_ANGLE
- See Also:
- Constant Field Values
-
REG_ACCUMULATED_ANGLE
protected static final int REG_ACCUMULATED_ANGLE
- See Also:
- Constant Field Values
-
REG_SPEED
protected static final int REG_SPEED
- See Also:
- Constant Field Values
-
HTANGLE_MODE_CALIBRATE
protected static final int HTANGLE_MODE_CALIBRATE
- See Also:
- Constant Field Values
-
HTANGLE_MODE_RESET
protected static final int HTANGLE_MODE_RESET
- See Also:
- Constant Field Values
-
-
Method Detail
-
init
protected void init()
-
resetAccumulatedAngle
public void resetAccumulatedAngle()
Reset the rotation count of accumulated angle to zero. Not saved in EEPORM.
-
calibrateAngle
public void calibrateAngle()
Calibrate the zero position of angle. Zero position is saved in EEPROM on sensor. Thread sleeps for 50ms while that is done.
-
getAngleMode
public SensorMode getAngleMode()
HiTechnic angle sensor, Angle mode
Measures the rotation position of a rotating axle.Size and content of the sample
The sample contains one elements containing the angle of the sensor in the range of 0 to 359 degrees.
-
getAccumulatedAngleMode
public SensorMode getAccumulatedAngleMode()
HiTechnic angle sensor, Accumulated angle mode
Measures the accumulated number of degrees an axle has rotated.Size and content of the sample
The sample contains one elements containing the accumulated rotation (in degrees) of the axle.
-
getAngularVelocityMode
public SensorMode getAngularVelocityMode()
HiTechnic angle sensor, Angular velocity mode
Measures the rotational speed of an axle.Size and content of the sample
The sample contains one elements containing the angular velocity (in degrees) of the axle.
-
-