From: Bruce P. <bap...@te...> - 2008-10-30 23:30:46
|
Hi Stef I did this some years ago, but as I recall, the key to using Vpython from Wx python is to create a client-server architecture. Create your Vpython application as a com object with variable parameters expressed as public methods. The server is launched from your Wxpython application. The Wxpython app provides the UI and allows updating the Vpython parameters with each pass through the control loop. Bruce At 03:10 PM 10/30/2008, you wrote: >From: Stef Mientki <s.m...@ru...> >Precedence: list >MIME-Version: 1.0 >To: vis...@li... >Date: Thu, 30 Oct 2008 00:18:31 +0100 >Message-ID: <490...@ru...> >Content-Type: text/plain; charset=ISO-8859-1; format=flowed >Subject: [Visualpython-users] WPython + wxPython possible ? >Message: 5 > >hello, > >now there's some activity on the list, >I (and many other wxPython users) would love to use VPython from a >wxPython application. > >This doesn't seem to be possible at first sight, because both >environments claim the main loop >(but I'm not an expert). > >There's an example on youtube: >http://www.youtube.com/watch?v=nMNzMwDXHLA > >but this could well be 2 separate applications, >communicating in some clever way. >But that's also an acceptable solution. > >Any suggestions / answers / links ? > >thanks, >Stef Mientki |
From: Jose A. M. H <jam...@fd...> - 2008-10-30 23:46:43
|
Hi , >This doesn't seem to be possible at first sight, because both >environments claim the main loop Vpython does not claim a main loop. You can simply create the scene, the objects, etc... And have your Wxpython program running, vpython will continue executing and you can change the objects of vpython from whithin your App directly. Also, you can indeed control the speed at wich the vpython do what it to with the rate() comand, or just ignore it for full speed. Thats all. Hope this help. JAMH. ----- Original Message ----- From: "Bruce Peterson" <bap...@te...> To: <vis...@li...> Sent: Friday, October 31, 2008 12:30 AM Subject: [Visualpython-users] Vpython and wxPython > Hi Stef > I did this some years ago, but as I recall, the key to using > Vpython from Wx python is to create a client-server architecture. > Create your Vpython application as a com object with variable > parameters expressed as public methods. The server is launched from > your Wxpython application. The Wxpython app provides the UI and > allows updating the Vpython parameters with each pass through the control > loop. > > Bruce > > At 03:10 PM 10/30/2008, you wrote: >>From: Stef Mientki <s.m...@ru...> >>Precedence: list >>MIME-Version: 1.0 >>To: vis...@li... >>Date: Thu, 30 Oct 2008 00:18:31 +0100 >>Message-ID: <490...@ru...> >>Content-Type: text/plain; charset=ISO-8859-1; format=flowed >>Subject: [Visualpython-users] WPython + wxPython possible ? >>Message: 5 >> >>hello, >> >>now there's some activity on the list, >>I (and many other wxPython users) would love to use VPython from a >>wxPython application. >> >>This doesn't seem to be possible at first sight, because both >>environments claim the main loop >>(but I'm not an expert). >> >>There's an example on youtube: >>http://www.youtube.com/watch?v=nMNzMwDXHLA >> >>but this could well be 2 separate applications, >>communicating in some clever way. >>But that's also an acceptable solution. >> >>Any suggestions / answers / links ? >> >>thanks, >>Stef Mientki > > > ------------------------------------------------------------------------- > 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 > |
From: Stef M. <s.m...@ru...> - 2008-10-31 00:36:32
|
Jose, Bruce, thanks for your answers.... Jose Antonio Martin H wrote: > Hi , > >> This doesn't seem to be possible at first sight, because both >> environments claim the main loop >> > > Vpython does not claim a main loop. > > You can simply create the scene, the objects, etc... > > And have your Wxpython program running, vpython will continue executing and > you can change the objects of vpython from whithin your App directly. > That sounds really simple. I've to admit, that I never investigated the possibilities, because on the wxPython list, this is the usual answer: "Both wxpython and vpython are great tools, which I'd love to use together for my program. The problem is they each run their own event loop. Now almighty Google taught me there were some ancient threads on the topic stating it would be very hard to combine the two." If I've some more time I'll certainly will try it. btw, does anyone has a (working) example of wxPython + VPython ? thanks again, Stef Mientki > Also, you can indeed control the speed at wich the vpython do what it to > with the rate() comand, or just ignore it for full speed. > > Thats all. > > Hope this help. > JAMH. > ----- Original Message ----- > From: "Bruce Peterson" <bap...@te...> > To: <vis...@li...> > Sent: Friday, October 31, 2008 12:30 AM > Subject: [Visualpython-users] Vpython and wxPython > > > >> Hi Stef >> I did this some years ago, but as I recall, the key to using >> Vpython from Wx python is to create a client-server architecture. >> Create your Vpython application as a com object with variable >> parameters expressed as public methods. The server is launched from >> your Wxpython application. The Wxpython app provides the UI and >> allows updating the Vpython parameters with each pass through the control >> loop. >> >> Bruce >> >> At 03:10 PM 10/30/2008, you wrote: >> >>> From: Stef Mientki <s.m...@ru...> >>> Precedence: list >>> MIME-Version: 1.0 >>> To: vis...@li... >>> Date: Thu, 30 Oct 2008 00:18:31 +0100 >>> Message-ID: <490...@ru...> >>> Content-Type: text/plain; charset=ISO-8859-1; format=flowed >>> Subject: [Visualpython-users] WPython + wxPython possible ? >>> Message: 5 >>> >>> hello, >>> >>> now there's some activity on the list, >>> I (and many other wxPython users) would love to use VPython from a >>> wxPython application. >>> >>> This doesn't seem to be possible at first sight, because both >>> environments claim the main loop >>> (but I'm not an expert). >>> >>> There's an example on youtube: >>> http://www.youtube.com/watch?v=nMNzMwDXHLA >>> >>> but this could well be 2 separate applications, >>> communicating in some clever way. >>> But that's also an acceptable solution. >>> >>> Any suggestions / answers / links ? >>> >>> thanks, >>> Stef Mientki >>> >> ------------------------------------------------------------------------- >> 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 >> >> > > > ------------------------------------------------------------------------- > 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 > > > |
From: Stef M. <s.m...@ru...> - 2008-10-31 21:05:15
|
hi Jasper, Jasper Stolte wrote: > Hi all, > > After very little effort I got them working together a few weeks ago > in my pendulum simulator, which can be downloaded from google code.. I > wanted to post the result to the wx-python list when it is a bit more > mature, as it's not quite finished yet. Anyway, run src/main.py, > screenshot attached. It's got a wxPython part which shows a slider > with which you can influence the pendulum length. Under Linux, this is > a real-time simulation, but under Windows I guess smth is messed up > with the wx.Timer so it is very slow. I tested under winXP-SP2 and it's not slow, but it's not fluently. The wx.Timer has a 15 msec resolution, your demo wants 20 msec, so when you print the elapsed time, you get 15 or 30 mseconds, with probably an average of 20 msec ? Also interesting to know that the processor loads varies a lot, between less than 1% upto 15% (dual core). On the same machine I have Ubuntu in Virtualbox installed. It's funny to see that in Windows/Virtual box/Ubuntu it runs fluently, time varies between 18 .. 22 msec. So I'm very satisfied about the Virtualbox. So the machine is not the problem, but indeed the implementation of wx.Timer under windows. I'll post a question on the wxPython list if it's possible to replace the timer by a high-resolution timer ( I won't mention your application yet ;-), I also need it for 2D simulation. I'm not familiar with VPython, but I guess you can set the antialiazing of the graphics card in there. I did set it manual on my graphics card and it looks much more beautiful. 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) So indeed it's very well possible to make nice applications with wxPython + VPython. thanks very much, cheers, Stef > > >> svn checkout */http > <http://pendulum-cart.googlecode.com/svn/trunk/>/*://pendulum-cart.googlecode.com/svn/trunk/ > > Anyway, the solution really was as simple as mentioned here. You can > just import visual and create a scene. This scene will then be > displayed in a separate window. As long as you keep track of the > visual object in the wxPython framework, you can manipulate it any way > you like from the wxPython program. > > Even nicer would be if somehow the OpenGL canvas would be available in > Python visual object, so you could really draw it to a wxPython > window. Now there's that extra GTK frame hanging around with the 3D > rendering. Not that this is a big issue or anything. Just something to > put on the wishlist for when the important things are already working.. ;) > > Greetz, > Jasper > > > > On Fri, Oct 31, 2008 at 1:36 AM, Stef Mientki <s.m...@ru... > <mailto:s.m...@ru...>> wrote: > > Jose, Bruce, > > thanks for your answers.... > > Jose Antonio Martin H wrote: > > Hi , > > > >> This doesn't seem to be possible at first sight, because both > >> environments claim the main loop > >> > > > > Vpython does not claim a main loop. > > > > You can simply create the scene, the objects, etc... > > > > And have your Wxpython program running, vpython will continue > executing and > > you can change the objects of vpython from whithin your App > directly. > > > That sounds really simple. > I've to admit, that I never investigated the possibilities, > because on the wxPython list, this is the usual answer: > > "Both wxpython and vpython are great tools, which I'd love to use > together for my program. The problem is they each run their own event > loop. Now almighty Google taught me there were some ancient threads on > the topic stating it would be very hard to combine the two." > > If I've some more time I'll certainly will try it. > > btw, does anyone has a (working) example of wxPython + VPython ? > > thanks again, > Stef Mientki > > > Also, you can indeed control the speed at wich the vpython do > what it to > > with the rate() comand, or just ignore it for full speed. > > > > Thats all. > > > > Hope this help. > > JAMH. > > ----- Original Message ----- > > From: "Bruce Peterson" <bap...@te... > <mailto:bap...@te...>> > > To: <vis...@li... > <mailto:vis...@li...>> > > Sent: Friday, October 31, 2008 12:30 AM > > Subject: [Visualpython-users] Vpython and wxPython > > > > > > > >> Hi Stef > >> I did this some years ago, but as I recall, the key to using > >> Vpython from Wx python is to create a client-server architecture. > >> Create your Vpython application as a com object with variable > >> parameters expressed as public methods. The server is launched from > >> your Wxpython application. The Wxpython app provides the UI and > >> allows updating the Vpython parameters with each pass through > the control > >> loop. > >> > >> Bruce > >> > >> At 03:10 PM 10/30/2008, you wrote: > >> > >>> From: Stef Mientki <s.m...@ru... <mailto:s.m...@ru...>> > >>> Precedence: list > >>> MIME-Version: 1.0 > >>> To: vis...@li... > <mailto:vis...@li...> > >>> Date: Thu, 30 Oct 2008 00:18:31 +0100 > >>> Message-ID: <490...@ru... > <mailto:490...@ru...>> > >>> Content-Type: text/plain; charset=ISO-8859-1; format=flowed > >>> Subject: [Visualpython-users] WPython + wxPython possible ? > >>> Message: 5 > >>> > >>> hello, > >>> > >>> now there's some activity on the list, > >>> I (and many other wxPython users) would love to use VPython from a > >>> wxPython application. > >>> > >>> This doesn't seem to be possible at first sight, because both > >>> environments claim the main loop > >>> (but I'm not an expert). > >>> > >>> There's an example on youtube: > >>> http://www.youtube.com/watch?v=nMNzMwDXHLA > >>> > >>> but this could well be 2 separate applications, > >>> communicating in some clever way. > >>> But that's also an acceptable solution. > >>> > >>> Any suggestions / answers / links ? > >>> > >>> thanks, > >>> Stef Mientki > >>> > >> > ------------------------------------------------------------------------- > >> 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=/ > <http://moblin-contest.org/redirect.php?banner_id=100&url=/> > >> _______________________________________________ > >> Visualpython-users mailing list > >> Vis...@li... > <mailto:Vis...@li...> > >> https://lists.sourceforge.net/lists/listinfo/visualpython-users > >> > >> > > > > > > > ------------------------------------------------------------------------- > > 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=/ > <http://moblin-contest.org/redirect.php?banner_id=100&url=/> > > _______________________________________________ > > Visualpython-users mailing list > > Vis...@li... > <mailto:Vis...@li...> > > https://lists.sourceforge.net/lists/listinfo/visualpython-users > > > > > > > > ------------------------------------------------------------------------- > 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=/ > <http://moblin-contest.org/redirect.php?banner_id=100&url=/> > _______________________________________________ > Visualpython-users mailing list > Vis...@li... > <mailto:Vis...@li...> > https://lists.sourceforge.net/lists/listinfo/visualpython-users > > > > ------------------------------------------------------------------------ > > ------------------------------------------------------------------------ > > ------------------------------------------------------------------------- > 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 > |
From: Jasper S. <jas...@gm...> - 2008-11-01 19:23:45
|
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. 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? Greetz, Jasper |
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 > |
From: Jasper S. <jas...@gm...> - 2008-11-02 14:14:11
|
Yup, TU/e here. Everything ok in Nijmegen? Anyway, thanks for the info on the time testing. It's a simple yet efficient method to see what is going on in there. Doesn't printing things make it slow though? You are right that the current random thing acts as noise (quite big noise though). I'll make different sliders/options for the disturbances/physical parameters etcetera later on. Also, I'll put in different types of controller, rewrite some stuff etc etc.. Lots to be done, in due time. The controller is running at a faster rate because this simple ODE solver gives too large errors when the timesteps become larger than 0.01s. So I split the visual framerate from the simulation timestep. Greetz, Jasper On Sat, Nov 1, 2008 at 9:26 PM, Stef Mientki <s.m...@ru...> wrote: > 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 > > > > ------------------------------------------------------------------------- > 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 > |
From: Stef M. <s.m...@ru...> - 2008-11-02 18:24:17
|
hi Jasper, Jasper Stolte wrote: > Yup, TU/e here. Everything ok in Nijmegen? Yes, everything is fine overhere. > > Anyway, thanks for the info on the time testing. It's a simple yet > efficient method to see what is going on in there. Doesn't printing > things make it slow though? I doubt so, if can print a line every 5 msec and consume 20% of my processor time, while a Vpython application is running ... > > You are right that the current random thing acts as noise (quite big > noise though). I'll make different sliders/options for the > disturbances/physical parameters etcetera later on. Also, I'll put in > different types of controller, rewrite some stuff etc etc.. Lots to be > done, in due time. It might me interesting to combine your control systems theory knowledge, with mine PyLab_Works. btw. I've played around with docking VPython in a wxPython application, and although I've some quirks to solve, it's working in it's basic form (windows only :-( . I'll let you know when it's working completely. cheers, Stef |