2004-05-30 11:09:46 +00:00
|
|
|
# $Id$
|
2004-05-24 07:49:50 +00:00
|
|
|
# Documentation for SCA_ISensor
|
|
|
|
from SCA_ILogicBrick import *
|
|
|
|
|
|
|
|
class SCA_ISensor(SCA_ILogicBrick):
|
|
|
|
"""
|
|
|
|
Base class for all sensor logic bricks.
|
|
|
|
"""
|
|
|
|
|
|
|
|
def isPositive():
|
|
|
|
"""
|
2008-08-23 11:54:27 +00:00
|
|
|
True if this sensor brick is in a positive state.
|
|
|
|
"""
|
|
|
|
|
|
|
|
def isTriggered():
|
|
|
|
"""
|
|
|
|
True if this sensor brick has triggered the current controller.
|
2004-05-24 07:49:50 +00:00
|
|
|
"""
|
|
|
|
|
|
|
|
def getUsePosPulseMode():
|
|
|
|
"""
|
|
|
|
True if the sensor is in positive pulse mode.
|
|
|
|
"""
|
|
|
|
def setUsePosPulseMode(pulse):
|
|
|
|
"""
|
|
|
|
Sets positive pulse mode.
|
|
|
|
|
|
|
|
@type pulse: boolean
|
|
|
|
@param pulse: If True, will activate positive pulse mode for this sensor.
|
|
|
|
"""
|
|
|
|
def getFrequency():
|
|
|
|
"""
|
|
|
|
The frequency for pulse mode sensors.
|
|
|
|
|
2004-05-31 13:06:04 +00:00
|
|
|
@rtype: integer
|
|
|
|
@return: the pulse frequency in 1/50 sec.
|
2004-05-24 07:49:50 +00:00
|
|
|
"""
|
|
|
|
def setFrequency(freq):
|
|
|
|
"""
|
|
|
|
Sets the frequency for pulse mode sensors.
|
|
|
|
|
|
|
|
@type freq: integer
|
2004-05-31 13:06:04 +00:00
|
|
|
@return: the pulse frequency in 1/50 sec.
|
2004-05-24 07:49:50 +00:00
|
|
|
"""
|
|
|
|
def getUseNegPulseMode():
|
|
|
|
"""
|
|
|
|
True if the sensor is in negative pulse mode.
|
|
|
|
"""
|
|
|
|
def setUseNegPulseMode(pulse):
|
|
|
|
"""
|
|
|
|
Sets negative pulse mode.
|
|
|
|
|
|
|
|
@type pulse: boolean
|
|
|
|
@param pulse: If True, will activate negative pulse mode for this sensor.
|
|
|
|
"""
|
|
|
|
def getInvert():
|
|
|
|
"""
|
|
|
|
True if this sensor activates on negative events.
|
|
|
|
"""
|
|
|
|
def setInvert(invert):
|
|
|
|
"""
|
|
|
|
Sets if this sensor activates on positive or negative events.
|
|
|
|
|
|
|
|
@type invert: boolean
|
|
|
|
@param invert: true if activates on negative events; false if activates on positive events.
|
|
|
|
"""
|
2008-07-23 21:37:37 +00:00
|
|
|
def getLevel():
|
|
|
|
"""
|
|
|
|
Returns whether this sensor is a level detector or a edge detector.
|
|
|
|
It makes a difference only in case of logic state transition (state actuator).
|
|
|
|
A level detector will immediately generate a pulse, negative or positive
|
|
|
|
depending on the sensor condition, as soon as the state is activated.
|
|
|
|
A edge detector will wait for a state change before generating a pulse.
|
|
|
|
|
|
|
|
@rtype: boolean
|
|
|
|
@return: true if sensor is level sensitive, false if it is edge sensitive
|
|
|
|
"""
|
|
|
|
def setLevel(level):
|
|
|
|
"""
|
|
|
|
Set whether to detect level or edge transition when entering a state.
|
|
|
|
|
|
|
|
@param level: Detect level instead of edge? (KX_TRUE, KX_FALSE)
|
|
|
|
@type level: boolean
|
|
|
|
"""
|
2008-08-16 20:45:37 +00:00
|
|
|
def reset():
|
|
|
|
"""
|
|
|
|
Reset sensor internal state, effect depends on the type of sensor and settings.
|
|
|
|
|
|
|
|
The sensor is put in its initial state as if it was just activated.
|
|
|
|
"""
|
2004-05-24 07:49:50 +00:00
|
|
|
|