Frame-cycle
-
"How to get a robot with a "frame-cycle program" start on a getVar('XXX') command?"
That I look for is a way to start ,for example this robot in the link, when a "getVar('XXX')" command is 1...
...and when the program is finish should it wait for a new signal from "getVar('XXX')".Sorry for my bad english...
Hope that someone understand
orginal link.... !!!NOT MY!!!
http://sketchup.google.com/3dwarehouse/details?mid=75a79036beeacdfcd66cb8a09369e9b&prevstart=0
Edited by me, but NOT created...
Easier to change the program... -
Hmm... this;
if getVar("XXX")==1; [1,2,3,4,5,setVar("XXX",0)][(frame/50)%6]; else; 0; end
Doesn't work, I can't see why though. This:
if getVar("XXX")==1; [1,2,3,4,5,6][(frame/50)%6]; else; 0; end
Does work, but can't reset the variable at the end, to stop repetition; but it will only start, and continue to work, when 'XXX' is 1.. Chris knows about this stuff; as far as I can tell, in the first one 'XXX' is being reset every frame, instead of just at the end. Why is this??
EDIT:
BTW, the:[1,2,3,4,5][(frame/50)%5]
Is much easier to use that the long, complex if function way. First [] holds the list of values, the number after 'frame' is the number of frames you want between each new value.
-
Thanks for the codes...
But I can't get it work, I don't know if I do right?
How would you do with the program in the skp-file that I had edited?it is the "[1,2,3,4,5,6]" part that I don't understand.
this is an version that I used, but the only thing that happen is that all values in the robot is set to 1 ('one').
if getVar('XXX')==1; [ if((frame%400)>20and(frame%400)<200) setVar('snurr',0) else setVar('snurr',1) end, if((frame%400)>130and(frame%400)<200) setVar('XLLed',0.5) else setVar('XLLed',0.2) end, if((frame%400)>130and(frame%400)<200) setVar('SLed',0.9) elsif((frame%400)>200and(frame%400)<200) setVar('SLed',1.05) else setVar('SLed',0.8) end, if((frame%400)>160and(frame%400)<300) setVar('klo',-1.0) else setVar('klo',0.5) end, setVar("XXX",0) ] [(frame/50)%5]; else; 0; end
I even don't know if I'm on the right way.
Thank's for the help!
-
Huh; my one won't work, because, as I just found out, it doesn't seem to be possible to set varables using it. You could always use mine in the controller fild of each individual joint...
The [1,2,3,4] part holds the list of output numbers. So, in the controller field, the joint would move to 1, then 2, then 3, then 4, then back to 1, etc etc. Phonic's way is very different.
-
Okay!
Now I understand better what [1,2,3,4] part is...
thanks a lot.
So you think that I should do a program for every joint, as it was berfore I edited it.
I would try that and se if I can get it.
But if you came up with something new and "easier" way so share it, thanks for the help.
I love SketchyPhysics3 and wait so much for the SPIV version... -
I would do it by using a variable instead of frame. That way you could control when it plays and be able to reset it when done.
In an OnTick
#only increase "myframe" if "xxx" >0 if(getVar("xxx")>0);setVar("myframe",getVar("myframe")+1);end #if "myframe" is greater than 100 then reset and stop. if(getVar("myframe")>100);setVar("myframe,0);setVar("xxx",0);end
Then in the servo controller use getVar("myframe") instead of frame.
Advertisement