WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Reply
 
Thread Tools Rating: Thread Rating: 2 votes, 5.00 average. Display Modes
  #1  
Old 02-08-2010, 06:00 PM
ursi ursi is offline
Member
 
Join Date: Dec 2009
Posts: 11
scheduled animation paths: jumps

Hi

Three animation paths should be scheduled one after another.

The path speed should be 100 steps/sec
Code:
pathFW.speed(100) # default: 1/sec?
I thought the waiting time should be devided by 100 as well>
Code:
yield viztask.waitTime(len(BW_Pos)/100)
My schedule looks like that, but in the animation there is a jump at the end of the first animation path... I guess, there is a timing problem and the system starts with the second path (pathStopp) before the 1st path (pathFW) is finished.

Code:
def onkeydown(key):
	PATH()
	if key == 't':
		###+++++++++++++++++++++++++++
		### SCHEDULE the room movement, sound and the output voltage
		def ScheduleOutputs():
				song.play()
				d.eAnalogOut(3.0, 0.0) #(AO0, AO1)
				pathFW.play()
				yield viztask.waitTime(((len(FW_Pos))/100))
				d.eAnalogOut(1.0, 0.0)
				pathStopp.play()
				yield viztask.waitTime(((len(Stopp_Pos))/100))
				d.eAnalogOut(3.0, 0.0)
				pathBW.play()
				yield viztask.waitTime(((len(BW_Pos))/100))
				d.eAnalogOut(1.0, 0.0)
				song.stop()
				
		viztask.schedule(ScheduleOutputs())		
###+++++++++++++++++++++++++++
viz.callback(viz.KEYDOWN_EVENT,onkeydown)
So, how can I manage that timing problem?
Attached Files
File Type: txt SledMotionBW.txt (3.8 KB, 1351 views)
File Type: txt SledMotionFW.txt (3.3 KB, 1340 views)
File Type: txt SledMotionStopp.txt (886 Bytes, 1419 views)
Reply With Quote
  #2  
Old 03-11-2010, 03:51 PM
bloswald bloswald is offline
Member
 
Join Date: Jan 2010
Posts: 7
viztask.schedule only once?

I think I have a similar problem. Maybe I just don't understand viztask very well, but it seems that you are unable to schedule a function more than once. Can I have someone with authority agree or disagree with this? Here is some code demonstrating what I am talking about.

Code:
def print_this():
	print "this"
	yield viztask.waitTime( 0.1 )
vizact.onkeydown( 'p', viztask.schedule, print_this() )
If I wanted to call print_this() multiple times, how would I go about doing that?

In my application I am assembling/disassembling a model (also with animation paths). When I typed vizact.onkeydown( viz.KEY_DOWN, disassemble_all ), my program would only call the function the first time I pressed the key. I want the parts to disassemble one at a time rather than all at once.

-
bloswald

Last edited by bloswald; 03-11-2010 at 04:00 PM. Reason: Adding signature and smiley :)
Reply With Quote
  #3  
Old 03-11-2010, 04:03 PM
bloswald bloswald is offline
Member
 
Join Date: Jan 2010
Posts: 7
Oops. I meant to say: vizact.onkeydown( viz.KEY_DOWN, viztask.schedule, disassemble_all() )

-
bloswald

Last edited by bloswald; 03-11-2010 at 04:04 PM. Reason: signature
Reply With Quote
  #4  
Old 04-27-2010, 01:12 PM
bloswald bloswald is offline
Member
 
Join Date: Jan 2010
Posts: 7
Talking Solved

Since my last post, I have learned that tasks require a different way of thinking.

The following code worked for my purposes, and viztask.schedule is only called once.

Code:
def print_this():
    while True:
        yield viztask.waitKeyDown( 'p' )

        print "this"
        yield viztask.waitTime( 1 )

viztask.schedule( print_this() )
Sometimes you have to forget about the problem for a while, then the solution shows itself.

-
bloswald
Reply With Quote
  #5  
Old 06-17-2010, 12:17 PM
bloswald bloswald is offline
Member
 
Join Date: Jan 2010
Posts: 7
Smile Better solution

Here is an even better solution.

Code:
import viztask
import vizact
import viz
viz.go()

def print_this():
	yield viztask.waitTime( 0.1 )
	print "this"

def intermediate_function():
	viztask.schedule(print_this())

vizact.onkeydown( 'p', intermediate_function )

-
bloswald
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
speed on animation path whj Vizard 8 11-17-2008 08:41 PM
Animation Tracks.... k_iwan Vizard 2 03-26-2007 06:52 PM
Jumpy animation Elizabeth S Vizard 1 11-08-2006 03:11 PM
animation sequence pkhoosh Vizard 2 01-23-2006 09:03 AM
avatar animation problems jrodman Vizard 1 01-18-2006 10:12 AM


All times are GMT -7. The time now is 08:16 AM.


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