Best way to do external controls for LinuxCNC

More
5 years 1 month ago #220102 by FDP
Thanks @Roiki. Do you know why Python 3 can't run as realtime code using PREEMPT_RT?

It's OK for me to lose the trajectory planner for this application as I am driving a linkage that is moved using a combination of rotary axes, so the standard trajectory planning is probably not useful in my case.

Please Log in to join the conversation.

More
5 years 1 month ago #220128 by Roiki
Because python is interpreted language and the python interpreter is not a realtime process.

Only kernel modules can run at realtime.

Please Log in to join the conversation.

More
5 years 1 month ago #220136 by FDP
For some reason I assumed that since Python compiles to bytecode it would be able to run in realtime.

Do you think a reasonable workaround would be to write a C/C++ library and then make a Python wrapper using CTypes?

Please Log in to join the conversation.

More
5 years 1 month ago #220220 by Roiki
Just because it compiles into bytecode doesn't make it realtime capable if there's nothing to run that bytecode with. The realtime modules are just linux kernel modules. Linux kernel modules are written in C(and rust in the future).

The linuxcnc python api is a wrapper to the c++ api. I don't know what library you're wanting to make but most of the functionality is already there.

Please Log in to join the conversation.

More
5 years 3 weeks ago #222315 by andypugh
You might want to look at:

linuxcnc.org/docs/2.8/html/man/man1/halrmt.1.html

linuxcnc.org/docs/2.8/html/man/man1/linuxcncrsh.1.html

linuxcnc.org/docs/2.8/html/man/man1/linuxcncsvr.1.html

The last one exists, but I have no idea how to use it. If you figure it out then perhaps you can add to that manpage?

Please Log in to join the conversation.

More
5 years 3 weeks ago #222365 by arvidb

Thanks @Roiki. Do you know why Python 3 can't run as realtime code using PREEMPT_RT?
You could run the Python interpreter as a realtime process, but the interpreter's garbage collector will kick in at random times which means your program still won't be time deterministic. You simply can't control the latency between "instructions" in Python.

Please Log in to join the conversation.

More
5 months 2 weeks ago #346336 by grijalvap
Any bpdy in the forum heve used this gRPC

github.com/dougcalobrisi/linuxcnc-grpc

not sure if it is real time but I think is an interesting aproach sinse GRPC is lenguaje agnostic 
prety well supported and i think the c++ or RUST version can run deterministic

Please Log in to join the conversation.

Time to create page: 0.086 seconds
Powered by Kunena Forum