Hey there! Can anyone tell me what's the best way to check, if a specified number of targets are inside a proximity sensor?
I have an experiment in which a person is required to move a specified number of targets into a proximity sensor in order to continue. On top of that, this should be done within a specified time, e.g. 5 seconds.
I tried something like:
Code:
...
...
def task1(numActiveTargets):
import random
numTrials = 100
for trial in xrange(numTrials):
targetSensor = random.choice(sensors) #a list of sensors
activeTargets = manager.getActiveTargets(sensor=targetSensor)
if len(activeTargets) < numActiveTargets:
yield vizproximity.waitEnter(sensor = targetSensor, target = targets) #seems to be activated by any target in list of targets
yield viztask.waitTime(5)
def experiment():
yield task1(2)
yield task1(3)
viztask.schedule(experiment)
...but it wouldn't work. Like, I'd have to check for 5 seconds if my chosen sensor contains at least 3 targets, for example.