public class HiTechnicAngleSensor extends I2CSensor
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
Modifier and Type | Field and Description |
---|---|
protected static int |
HTANGLE_MODE_CALIBRATE |
protected static int |
HTANGLE_MODE_RESET |
protected static int |
REG_ACCUMULATED_ANGLE |
protected static int |
REG_ANGLE |
protected static int |
REG_SPEED |
address, DEFAULT_I2C_ADDRESS, port, REG_PRODUCT_ID, REG_VENDOR_ID, REG_VERSION, retryCount
currentMode, modes
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 and Description |
---|
HiTechnicAngleSensor(I2CPort port) |
HiTechnicAngleSensor(Port port) |
Modifier and Type | Method and Description |
---|---|
void |
calibrateAngle()
Calibrate the zero position of angle.
|
SensorMode |
getAccumulatedAngleMode()
HiTechnic angle sensor, Accumulated angle mode
Measures the accumulated number of degrees an axle has rotated. |
SensorMode |
getAngleMode()
HiTechnic angle sensor, Angle mode
Measures the rotation position of a rotating axle. |
SensorMode |
getAngularVelocityMode()
HiTechnic angle sensor, Angular velocity mode
Measures the rotational speed of an axle. |
protected void |
init() |
void |
resetAccumulatedAngle()
Reset the rotation count of accumulated angle to zero.
|
fetchString, getAddress, getData, getData, getPort, getProductID, getRetryCount, getVendorID, getVersion, sendData, sendData, sendData, setAddress, setRetryCount
fetchSample, getAvailableModes, getCurrentMode, getMode, getMode, getModeCount, getName, sampleSize, setCurrentMode, setCurrentMode, setModes
close, releaseOnClose
protected static final int REG_ANGLE
protected static final int REG_ACCUMULATED_ANGLE
protected static final int REG_SPEED
protected static final int HTANGLE_MODE_CALIBRATE
protected static final int HTANGLE_MODE_RESET
public HiTechnicAngleSensor(I2CPort port)
public HiTechnicAngleSensor(Port port)
protected void init()
public void resetAccumulatedAngle()
public void calibrateAngle()
public SensorMode getAngleMode()
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.
public SensorMode getAccumulatedAngleMode()
Size and content of the sample
The sample contains one elements containing the accumulated rotation (in degrees) of the axle.
public SensorMode getAngularVelocityMode()
Size and content of the sample
The sample contains one elements containing the angular velocity (in degrees) of the axle.