public interface ISensorListener
ISensor.setListener(ISensorListener)
,
ISensor.clearListener()
Modifier and Type | Method and Description |
---|---|
void |
manageEvent(ISensor sensor,
float oldValue,
float newValue,
float oldRate,
float newRate)
• This method will be invoked when there is a relevant change
of the measurand or the corresponding change rate of an observed sensor.
|
void manageEvent(ISensor sensor, float oldValue, float newValue, float oldRate, float newRate)
ISensor.setListener(ISensorListener)
).
The settings of the event filter tolerances will determine if a change of
the measurand or its change rate is being considered as relevant or not
(see ISensor.setFilterTolerances(float,float)
).
Change events will be handled within a special event handling thread.
Special care is necessary in this situation to avoid severe problems at runtime:
The execution of the method manageEvent needs to be VERY FAST.
The real handling of the event should be done within the main thread of the robot program.
The method manageEvent should simply collect all data necessary
for the main thread to react to sensor events in an appropriate manner.
In particular, do not make calls to methods manipulating motors or sensors from the method manageEvent.
It will not only take too much time but will easily mess with the main threads business.
Reading of values from motors and sensors will in general be OK.
In turn, the main thread should not manipulate data that the method manageEvent
is responsible for when monitoring sensors.sensor
- calling sensoroldValue
- old measurandnewValue
- new measurandoldRate
- old change ratenewRate
- new change rateISensor.setListener(ISensorListener)
,
ISensor.clearListener()
,
ISensor.setFilterTolerances(float,float)
,
ISensor.getFilterToleranceValue()
,
ISensor.getFilterToleranceRate()
,
ISensor.checkForEventOverflow()