![]() |
|
#1
|
|||
|
|||
Ok. So what I originally had was:
movetime = [1,2,3,4,5,6] sequences = [] for time in movetime: MoveRoom = vizact.sequence(vizact.move(0,0,(0.5/time),time), vizact.move(0,0,(-0.5/time),time), (30/time)) sequences.append(MoveRoom) sequences.append( vizact.call( WriteFlag ) ) MovingRoom = vizact.sequence(sequences, 1) This made it so that the picture moved .5m/s forward for 1 second and .5m/s backward for 1 second (it did that a total of 30 times which added up to 60 seconds). The second iteration it moved .25m/s (.5/2) for 2 seconds forward and backward and it did that 15 times (30/2) for a total of 60 seconds. The third iteration it moved .167m/s (.5/3) forward and backward for 3 seconds and it did this 10 times (30/3) for a total of 60 seconds. ETC ETC ETC ETC In each case it was moving a total of .5 meters forward and backward it was just doing it at a slower velocity over a longer period of time. Now I need to keep it semi-proportional to that. Namely, I need it to move .12m forward for .05 seconds and .12m backward for .05 seconds and to do that for a minute. (Just like above I need it to move a total of .12 meters (in this case) forward and backward and do it at a faster velocity over a shorter period of time. So I need my movetime list to be like: movetime = [.05, .25, .75, 1, 2]. So it should start off moving very fast over a short distance and then gradually move slower over that same short distance. And each "iteration" needs to be a minute long. I know I'm missing something/my formula/equation is off/wrong, but I can't figure it out. If I'm dividing 30 by .05 that equals 600. So it should do that iteration 600 times which would end up being 60 seconds long. But it doesn't. It only does it a couple of times (which ends up being 2.4 seconds long). Does that make sense? |
#2
|
|||
|
|||
I think the problem in this case is that you need to convert the repeat count to an integer when passing it to the vizact.sequence command. Try the following instead:
MoveRoom = vizact.sequence(vizact.move(0,0,(0.5/time),time), vizact.move(0,0,(-0.5/time),time), int(30/time)) |
#3
|
|||
|
|||
and would that work if I change .5 to .12???
MoveRoom = vizact.sequence(vizact.move(0,0,(0.12/time),time), vizact.move(0,0,(-0.12/time),time), int(30/time)) Would it then run each iteration for a minute? |
#4
|
|||
|
|||
When I added "int" before (30/time) it made it run longer than 2 seconds, but each iteration was running for approximately 90 seconds instead of 60. Am I making a mathematical error? Or am I missing something else?
|
#5
|
|||
|
|||
Which values are you using? I tested it out and it ran for exactly 60 seconds, as long as the number is a multiple of 30.
|
#6
|
|||
|
|||
Here's my movetime list:
movetime = [1/20.0, 1/4.0, 1/2.0, 1, 2] and the code: MoveRoom = vizact.sequence(vizact.move(0,0,((3/25.0)/time),time), vizact.move(0,0,((-3/25.0)/time),time), int(30/time)) or I could convert those fractions to floating points so it looks like: movetime = [.05, .25, .5, 1, 2] MoveRoom = vizact.sequence(vizact.move(0,0,(0.12/time),time), vizact.move(0,0,(0.12/time),time), int(30/time)) Either way it should work. But I have a timer set up to tell me every 60 seconds that 60 seconds had elapsed. And another timer to indicate when a movement transition has occured (i.e. when it shifts between interations--.05-->.25-->.5-->etc.) Those should line up identically but they weren't for some reason. |
#7
|
|||
|
|||
Here's the printed output from running it for a bit:
Elapsed time: 60.0057702864 seconds Movement Transition Made Elapsed time: 60.0058499055 seconds Movement Transition Made Elapsed time: 60.0067419183 seconds Movement Transition Made Elapsed time: 60.0055750102 seconds Movement Transition Made The time between elapsed time 1 and Movement transition made 1 is about 20 seconds. The time between ET2 and MTM2 is about 25 seconds. The time between ET3 and MTM3 is about 30 seconds. And time between ET4 and MTM4 is about 35 seconds. Granted I'm using a stopwatch so of course there is a little human error delay, but nonetheless it's not even close to being the same. |
![]() |
Thread Tools | |
Display Modes | Rate This Thread |
|
|