|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--de.jaetzold.art.RawSensor | +--de.jaetzold.art.StateSensor | +--de.jaetzold.art.CountSensor | +--de.jaetzold.art.AngleSensor
A class for measuring an angle. This angle can be greater than 360 degree and is typically used for measuring the rotation-position of an axle. Negative Values are also possible.
The method getValue()
returns the angle measured in whole turns.
For standard Fischertechnik and Lego an AngleSensor usually gets connected with a CountSensor because angles are measured by counting state-changes.
Inner classes inherited from class de.jaetzold.art.CountSensor |
CountSensor.AbsoluteStateDifferenceStateDecider, CountSensor.CountSensorPort |
Inner classes inherited from class de.jaetzold.art.RawSensor |
RawSensor.ValueSensorPort |
Field Summary | |
protected double |
angleUnits
The count-value is multiplied by angleUnits/angleUnitsFraction when computing the angle in whole turns. |
protected double |
angleUnitsFraction
The count-value is multiplied by angleUnits/angleUnitsFraction when computing the angle in whole turns. |
Fields inherited from class de.jaetzold.art.StateSensor |
stateDecider |
Fields inherited from class de.jaetzold.art.RawSensor |
changes, precision, precisionSet, propertyChangeEventDescriptor |
Constructor Summary | |
AngleSensor()
Constructs an AngleSensor whithone count being one revolution. |
|
AngleSensor(double unitsPerTurn)
Constructs an AngleSensor whith a scale. |
|
AngleSensor(double unitsPerTurn,
double fraction)
Constructs an AngleSensor whith a scale. |
Method Summary | |
int |
convertAngleToUnits(double angle)
Converts an angle to a count-value according to its scale. |
protected double |
convertToOutgoing(double value)
This is a Template-Method for subclasses. |
double |
convertUnitsToAngle(double units)
Converts a count-value to an angle according to its scale. |
double |
getAngleDegree()
Returns the angle relative to the starting-position. |
double |
getAngleRadians()
Returns the angle relative to the starting-position. |
double |
getAngleTurns()
Returns the angle relative to the starting-position. |
boolean |
getDeliversFloatingPoint()
Tells whether this Sensor delivers discrete values or not. |
double |
getPrecision()
Returns the maximum of the expectable error in the value. |
double |
getUnitsPerTurn()
Returns the count-units that make one revolution. |
double[] |
getUnitsPerTurnFraction()
Returns the count-units that make one revolution. |
void |
setAngle(double angle)
Calibrates this Sensor to be at the given angle. |
void |
setUnitsPerTurn(double unitsPerTurn)
Sets the Units in which this AngleSensor measures one turn. |
void |
setUnitsPerTurnFraction(double numerator,
double denominator)
Sets the Units in which this AngleSensor measures one turn. |
Methods inherited from class de.jaetzold.art.CountSensor |
connectWith, convertToIncoming, disconnect, getCountSensorPort, getCountValue, isIncomingConversionCacheable, resetCount, setCount, setCountDecider |
Methods inherited from class de.jaetzold.art.StateSensor |
getStateDecider, setStateDecider |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected double angleUnits
angleUnits/angleUnitsFraction
when computing the angle in whole turns.protected double angleUnitsFraction
angleUnits/angleUnitsFraction
when computing the angle in whole turns.Constructor Detail |
public AngleSensor()
public AngleSensor(double unitsPerTurn)
unitsPerTurn
counts making up one revolution.public AngleSensor(double unitsPerTurn, double fraction)
unitsPerTurn/fraction
counts making up one revolution.Method Detail |
public double convertUnitsToAngle(double units)
public int convertAngleToUnits(double angle)
protected double convertToOutgoing(double value)
RawSensor
super
.convertToOutgoing
in class RawSensor
de.jaetzold.art.RawSensor
RawSensor.convertToIncoming(double)
,
RawSensor.isOutgoingConversionCacheable()
public void setAngle(double angle)
CountSensor.setCount(double)
public double getAngleTurns()
public double getAngleRadians()
public double getAngleDegree()
public void setUnitsPerTurn(double unitsPerTurn)
setCountsPerTurnFraction(double, double)
.
It is actually possible to set countsPerTurn
to a negative value, but that would have the same effect as reversing the sensors value and is therefore not encouraged.RawSensor.setReversed(boolean)
,
setUnitsPerTurnFraction(double,double)
public double getUnitsPerTurn()
setUnitsPerTurn(double)
public void setUnitsPerTurnFraction(double numerator, double denominator)
setUnitsPerTurn(double)
public double[] getUnitsPerTurnFraction()
getUnitsPerTurn()
public double getPrecision()
Sensor
getPrecision
in class RawSensor
public boolean getDeliversFloatingPoint()
RawSensor
getDeliversFloatingPoint
in class CountSensor
de.jaetzold.art.RawSensor
RawSensor.convertToIncoming(double)
,
RawSensor.setIncomingConversionDelegate(Conversion)
,
RawSensor.setOutgoingConversionDelegate(Conversion)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |