sketchucation logo sketchucation
    • Login
    ℹ️ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info

    Frame-cycle

    Scheduled Pinned Locked Moved SketchyPhysics
    6 Posts 3 Posters 681 Views 3 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • H Offline
      hpnisse
      last edited by

      "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...

      ` /hpnisse`
      ` Windows 7 U -Sketchup 8 -SketchyPhysics 3.2-Dec2 - from Sweden`

      1 Reply Last reply Reply Quote 0
      • W Offline
        Wacov
        last edited by

        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.

        http://sketchup.google.com/3dwarehouse/cldetails?mid=3096a836877fb9af6cd8ad826e9017b8&prevstart=0

        1 Reply Last reply Reply Quote 0
        • H Offline
          hpnisse
          last edited by

          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!

          ` /hpnisse`
          ` Windows 7 U -Sketchup 8 -SketchyPhysics 3.2-Dec2 - from Sweden`

          1 Reply Last reply Reply Quote 0
          • W Offline
            Wacov
            last edited by

            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.

            http://sketchup.google.com/3dwarehouse/cldetails?mid=3096a836877fb9af6cd8ad826e9017b8&prevstart=0

            1 Reply Last reply Reply Quote 0
            • H Offline
              hpnisse
              last edited by

              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...

              ` /hpnisse`
              ` Windows 7 U -Sketchup 8 -SketchyPhysics 3.2-Dec2 - from Sweden`

              1 Reply Last reply Reply Quote 0
              • C Offline
                CPhillips
                last edited by

                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.

                1 Reply Last reply Reply Quote 0
                • 1 / 1
                • First post
                  Last post
                Buy SketchPlus
                Buy SUbD
                Buy WrapR
                Buy eBook
                Buy Modelur
                Buy Vertex Tools
                Buy SketchCuisine
                Buy FormFonts

                Advertisement