![]() |
#1
|
|||
|
|||
![]()
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) |
#2
|
|||
|
|||
You could add a global variable that keeps track of which phase is currently active and check against that. Or you could create two proximity managers and enable one during the initial phases and the other during the test phase:
Code:
manager1.setEnabled(viz.OFF) manager2.setEnabled(viz.ON) |
#3
|
|||
|
|||
Thanks, Jeff, I'll try the second approach. I have another question:
Is there a way to give targets a custom name and retrieve this name with manager.getActiveTargets(sensor=e.sensor)? Right now this gives me a list like this: Code:
[Target(source=LinkableSource(linkable=__builtin__._VrpnTracker(2), flag=0)), Target(source=LinkableSource(linkable=__builtin__._VrpnTracker(1), flag=0))] |
#4
|
|||
|
|||
You can add a custom name attribute to the node:
Code:
target.name = 'right_hand' Code:
e.target.name |
![]() |
Tags |
proximity sensor |
Thread Tools | |
Display Modes | Rate This Thread |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Fade in and fade out an audio file | helena35 | Vizard | 5 | 05-30-2016 07:04 AM |
Closing of an imported .py file | Uttama_vizard | Vizard | 2 | 05-04-2010 07:18 AM |
IVEx file extenstion unrecognised. | sindi | Vizard | 2 | 12-10-2009 02:20 AM |
Read file....many issues | Uttama_vizard | Vizard | 9 | 07-08-2008 03:16 PM |
File Management | Uttama_vizard | Vizard | 2 | 07-01-2008 10:44 AM |