A Question

Martijn Faassen m.faassen at vet.uu.nl
Wed Mar 8 08:15:52 EST 2000


Purang Abolmaesumi <puranga at ece.ubc.ca> wrote:
> Hello All
> Here, at the University of British Columbia, we are looking into the design
> of a user interface for a medical robotic system we have in the lab.
> Basically, the system consists of two computers, one PC and one VXWORKS
> operated, and there is a robot which is connected to the VXWORKS machine and
> being controlled by that. But, some parts of the control is being done by
> the PC by sending data in real-time via internet to the VXWORKS and then the
> robot.
> So, here is the problem: We would like to have a GUI which gets images from
> a frame-grabber installed on the PC and show them on the screen (we have the
> C functions right now which are running perfectly), send some data in
> real-time to the VXWORKS machine (again, we have the C functions written)
> and at the same time, interacts with user.
> I have the following questions:
> 1. Can we use Python for this?

It depends on how 'real time' it has to be. Python has reasonable
response times for interactive things, but if your requirements are very
low latencies or if you need to do lots of calculation for each
response it may be too slow. It's hard to say.

Python is certainly capable in the GUI department -- it talks to lots of
different GUIs, like Tk, wxWindows, KDE/QT, Gnome/GTK, etc, etc. I'll leave
others to discuss the merits of all these options. :)

> 2. Can we call C functions in Python and vice versa easily?

With Swig at least the first will be quite easy; check out www.swig.org.
Swig is a tool which can generate Python wrappers for C functions
automatically. The other way around it possible too, but as far as I know
there's no automated tool for it. Check out the Python extension/embedding
documentation (at http://www.python.org).
 
> 3. How fast is a Python program? Can we use it for a real-time application
> like the one we have?

It depends on what you want to do, like before. Python code is a lot lower
than say C code, but for the majority of applications Python code is fast
enough. And it's always possible to spice up parts which are slow in 
Python with fast C functions.

> 4. If we use TKinter as the GUI, can we use our C functions for the
> frame-grabber to show the image on the screen?

I wouldn't know this; it depends on what kind of image data your C functions
create? It should be possible to display that into any GUI window, if the
GUI is reasonably capable.

Regards,

Martijn
-- 
History of the 20th Century: WW1, WW2, WW3?
No, WWW -- Could we be going in the right direction?



More information about the Python-list mailing list