View Single Post
  #1  
Old 08-25-2016, 06:47 PM
Vaquero Vaquero is offline
Member
 
Join Date: Nov 2015
Posts: 62
Question saving proximity events (onEnter,onExit) to file

Hey!
I've scripted an experiment based on the experiment framework in the examples. I have set up my sensor and targets and added them to the manager. Now I want to save the onEnter and onExit events to a file only when the experiment is in the testphase , but I'm lost on how to do that.

Code:
def EnterSensor(e):
    print 'Enter',e.sensor.name, contactManager.getActiveTargets(sensor=e.sensor) #DEBUG

def ExitSensor(e):
    print 'Exit',e.sensor.name, contactManager.getActiveTargets(sensor=e.sensor) #DEBUG
    
manager.onEnter(sensor, EnterSensor)
manager.onExit(sensor, ExitSensor)
Can I just move this code inside the experiment definition ( def experiment(): ) just before yielding the testphase? And instead of printing to console saving to a file that I opened in the experiment function before? I can only test it when I'm back in the lab and on a tight schedule.
Reply With Quote