WorldViz User Forum

WorldViz User Forum (https://forum.worldviz.com/index.php)
-   Vizard (https://forum.worldviz.com/forumdisplay.php?f=17)
-   -   Default Splashscreen Image Remains with Continuous Sampling (Must Finite Sample) (https://forum.worldviz.com/showthread.php?t=4365)

mhead10 09-19-2012 09:10 AM

Default Splashscreen Image Remains with Continuous Sampling (Must Finite Sample)
 
I'm currently obtaining continuous data from my USB DAQ. My splashscreen will not show the background I have prepared for it until all of my DAQ data has loaded (ie- I haven't figured out how to load my graphics if I use continuous sampling. If I have finite sampling, then the graphics will load after all samples have been taken).

How can I have continuous sampling with what I programmed into the viz.go window? I put viz.go() at the beginning of my program, so obviously there is something else that needs to occur before I can actually start viewing and interacting with the window.

I will attach relevant code below.

Thanks

Code:

import ctypes
import numpy
import viztask
nidaq = ctypes.windll.nicaiu # load the DLL
viz.go()

# constant and variables left out for simplicity

def CHK(err):
    if err < 0:
        buf_size = 100
        buf = ctypes.create_string_buffer('\000' * buf_size)
        nidaq.DAQmxGetErrorString(err,ctypes.byref(buf),buf_size)
        raise RuntimeError('nidaq call failed with error %d: %s'%(err,repr(buf.value)))

#Main Program
CHK(nidaq.DAQmxCreateTask("",ctypes.byref(taskHandle)))
CHK(nidaq.DAQmxCreateAIVoltageChan(taskHandle,"Dev2/ai0:1","",DAQmx_Val_Cfg_Default,float64(-13.0),float64(13.0),DAQmx_Val_Volts,None))
CHK(nidaq.DAQmxCfgSampClkTiming(taskHandle,"",float64(1),DAQmx_Val_Rising,DAQmx_Val_ContSamps,uInt64(max_num_samples)));
CHK(nidaq.DAQmxStartTask(taskHandle))

def obtain_value():
    CHK(nidaq.DAQmxReadAnalogF64(taskHandle,1,float64(-1),DAQmx_Val_GroupByChannel,data.ctypes.data,max_num_samples,ctypes.byref(read),None))
    print '    after read'
    print data

i = 0
while i < 10:
    i += 1        # IF I COMMENT THIS LINE OUT, MY SPLASHSCREEN WILL NOT LOAD :(
    obtain_value()

if taskHandle.value != 0:
    CHK(nidaq.DAQmxStopTask(taskHandle))
    CHK(nidaq.DAQmxClearTask(taskHandle))


mhead10 09-20-2012 01:48 PM

Code:

viz.directormode(viz.DIRECTOR_FAST)
did not seem to change anything either yet...

mhead10 09-21-2012 07:11 AM

HTML Code:

viz.director()
solved the problem


All times are GMT -7. The time now is 05:38 PM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Copyright 2002-2023 WorldViz LLC