By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,589 Members | 1,209 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,589 IT Pros & Developers. It's quick & easy.

Re: HARD REAL TIME PYTHON

P: n/a
David,
Am 07.10.2008 um 01:25 schrieb Blubaugh, David A.:
I have done some additional research into the possibility of utilizing
Python for hard real time development. I have seen on various
websites
where this has been discussed before on the internet. However, I was
wondering as to how successful anyone has truly been in developing a
program project either in windows or in Linux that was or extremely
close to real time constraints? For example is it possible to
develop a
python program that can address an interrupt or execute an operation
within 70 Hz or less?? Are there any additional considerations that I
should investigate first regarding this matter??

As others mentioned before, python is not the right tool for "HARD
REAL TIME".

But: Maybe you can isolate the part of your application that needs
"HARD REAL TIME".
Then implement this part in an approriate Environment (Language,
OS, HW).
Then implement the rest of your application which is not "HARD
REAL TIME"
in python.

To be more helpful, we should know what you mean by "HARD REAL TIME".
Do you mean:
- Handle at least 70 interrupt per second ("SPEED")
- If one fails, this is catastrophic for the application ("HARD")
- Deliver an response to an interrupt within 5-10[ms] ("REAL
TIME")

see http://en.wikipedia.org/wiki/Real-time
Grüessli
--
Kurt Müller, mu@problemlos.ch

Oct 7 '08 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Kurt Mueller wrote:
David,
Am 07.10.2008 um 01:25 schrieb Blubaugh, David A.:
>I have done some additional research into the possibility of utilizing
Python for hard real time development. I have seen on various
websites
where this has been discussed before on the internet. However, I was
wondering as to how successful anyone has truly been in developing a
program project either in windows or in Linux that was or extremely
close to real time constraints? For example is it possible to
develop a
python program that can address an interrupt or execute an operation
within 70 Hz or less?? Are there any additional considerations that I
should investigate first regarding this matter??


As others mentioned before, python is not the right tool for "HARD
REAL TIME".

But: Maybe you can isolate the part of your application that needs
"HARD REAL TIME".
Then implement this part in an approriate Environment (Language,
OS, HW).
Then implement the rest of your application which is not "HARD
REAL TIME"
in python.

To be more helpful, we should know what you mean by "HARD REAL TIME".
Do you mean:
- Handle at least 70 interrupt per second ("SPEED")
- If one fails, this is catastrophic for the application ("HARD")
- Deliver an response to an interrupt within 5-10[ms] ("REAL
TIME")

see http://en.wikipedia.org/wiki/Real-time
I've done this using RTAI + ctypes. Of course the hard realtime tasks are
written in C - but only the absolutely minimal core.

Works like a charm.

Diez
Oct 7 '08 #2

P: n/a
Am 07.10.2008 um 11:44 schrieb Diez B. Roggisch:
Kurt Mueller wrote:
>David,
As others mentioned before, python is not the right tool for "HARD
REAL TIME".
But: Maybe you can isolate the part of your application that needs
"HARD REAL TIME".
Then implement this part in an approriate Environment (Language,
OS, HW).
Then implement the rest of your application which is not "HARD
REAL TIME"
in python.
I've done this using RTAI + ctypes. Of course the hard realtime
tasks are
written in C - but only the absolutely minimal core.
Works like a charm.
(Btw, what is this application like)
Yes.
The key is to
!*isolate*!
the part of the application that needs "HARD REAL TIME".
Thats what you have done with the "absolutely minimal core"
in RTAI + ctypes.

Sometimes it is even questionable if an application really
needs "HARD REAL TIME".
sometimes it is enough to have "soft real time" or even
"fast enough" is enough.

Good enough is good enough!

"HARD REAL TIME" is mostly expensive.

Grüessli
--
Kurt Müller, mu@problemlos.ch

Oct 7 '08 #3

P: n/a
>I've done this using RTAI + ctypes. Of course the hard realtime
>tasks are
written in C - but only the absolutely minimal core.
Works like a charm.

(Btw, what is this application like)
It's for a robot with 8 motors, with a industrial PIII-based PC on board,
running RTAI Linux 2.6. The core control task is user-space realtime with a
1ms loop and gets it's controlling commands via plain C-structs that I pass
in using python/ctypes.

On of the great things about this is that there is Python's GC working in
favor of me, as I can simple allocate/deallocate data structures from
withing Python.

Diez
Oct 7 '08 #4

This discussion thread is closed

Replies have been disabled for this discussion.