From: Stef M. <s.m...@ru...> - 2008-11-01 20:26:35
|
hi Jasper, TUE ? Jasper Stolte wrote: > Hi Stef, > > > Now an interesting extension of your program would be to introduce a > disturbance, > simply by pressing a button, > but even nicer by shaking the VPython window ;-) > > We just ran it on another computer windows/linux: > Fedora 9.0, 200 fps ==> 50% processor time (dual core) , > winXP-SP2, 200 fps ==> processor use 20% (time between frames > 0,0,0,15, > , so indeed an average of 5 msec) > > > Indeed, I was thinking of reading the acceleration sensor of my > notebook and using that to generate a disturbance in the simulation. > Didn't get around to that though, so now it just has a random disturbance. Perfect, but please also add a button, for those who don't have such a notebook. I thought you added the random, just as a small noise signal. It would be nice to give it big sweeper, after it has reached is equilibrium. BTW, why do you run your control machine on a higher frequency than the framerate ? > > Nice to see it runs elsewhere without too much trouble. Quite strange > that the processor load varies, as since I use a fixed time step ODE > solver, the calculations are identical each timestep. I'm interested > to find out how you know the timing between frames. How do you know it > was at 0,0,0,15 ms? just a simple print statement: import time self.ABS_TIME = time.time() def update(self, evt=None): #for n in range(10): for n in range(int(ceil(fs/fps))): self.controller.input = -self.pendulum.output() + .05*rand(2,1) self.pendulum.input = self.controller.output() + 1*rand() self.controller.timestep(1/fs) self.pendulum.timestep(1/fs) self.visualization.update() print ( int ( 1000 * ( time.time() - self.ABS_TIME ) ) ) self.ABS_TIME = time.time() I also tried to remove the wx.Timer, and binded the update method to the idle event, then testing the elapsed time to decide if the calculations should be done or not. The effects are the same: steps of 15 msec :-( Another option would be to implement your own main GUI-loop. cheers, Stef > > Greetz, > Jasper > ------------------------------------------------------------------------ > > ------------------------------------------------------------------------- > This SF.Net email is sponsored by the Moblin Your Move Developer's challenge > Build the coolest Linux based applications with Moblin SDK & win great prizes > Grand prize is a trip for two to an Open Source event anywhere in the world > http://moblin-contest.org/redirect.php?banner_id=100&url=/ > ------------------------------------------------------------------------ > > _______________________________________________ > Visualpython-users mailing list > Vis...@li... > https://lists.sourceforge.net/lists/listinfo/visualpython-users > |