Module SCA_ISensor
[hide private]
[frames] | no frames]

Source Code for Module SCA_ISensor

 1  # $Id: SCA_ISensor.py 16236 2008-08-23 11:54:27Z ben2610 $ 
 2  # Documentation for SCA_ISensor 
 3  from SCA_ILogicBrick import * 
 4   
5 -class SCA_ISensor(SCA_ILogicBrick):
6 """ 7 Base class for all sensor logic bricks. 8 """ 9
10 - def isPositive():
11 """ 12 True if this sensor brick is in a positive state. 13 """
14
15 - def isTriggered():
16 """ 17 True if this sensor brick has triggered the current controller. 18 """
19
21 """ 22 True if the sensor is in positive pulse mode. 23 """
24 - def setUsePosPulseMode(pulse):
25 """ 26 Sets positive pulse mode. 27 28 @type pulse: boolean 29 @param pulse: If True, will activate positive pulse mode for this sensor. 30 """
31 - def getFrequency():
32 """ 33 The frequency for pulse mode sensors. 34 35 @rtype: integer 36 @return: the pulse frequency in 1/50 sec. 37 """
38 - def setFrequency(freq):
39 """ 40 Sets the frequency for pulse mode sensors. 41 42 @type freq: integer 43 @return: the pulse frequency in 1/50 sec. 44 """
46 """ 47 True if the sensor is in negative pulse mode. 48 """
49 - def setUseNegPulseMode(pulse):
50 """ 51 Sets negative pulse mode. 52 53 @type pulse: boolean 54 @param pulse: If True, will activate negative pulse mode for this sensor. 55 """
56 - def getInvert():
57 """ 58 True if this sensor activates on negative events. 59 """
60 - def setInvert(invert):
61 """ 62 Sets if this sensor activates on positive or negative events. 63 64 @type invert: boolean 65 @param invert: true if activates on negative events; false if activates on positive events. 66 """
67 - def getLevel():
68 """ 69 Returns whether this sensor is a level detector or a edge detector. 70 It makes a difference only in case of logic state transition (state actuator). 71 A level detector will immediately generate a pulse, negative or positive 72 depending on the sensor condition, as soon as the state is activated. 73 A edge detector will wait for a state change before generating a pulse. 74 75 @rtype: boolean 76 @return: true if sensor is level sensitive, false if it is edge sensitive 77 """
78 - def setLevel(level):
79 """ 80 Set whether to detect level or edge transition when entering a state. 81 82 @param level: Detect level instead of edge? (KX_TRUE, KX_FALSE) 83 @type level: boolean 84 """
85 - def reset():
86 """ 87 Reset sensor internal state, effect depends on the type of sensor and settings. 88 89 The sensor is put in its initial state as if it was just activated. 90 """
91