Racket Realtime

83 views
Skip to first unread message

Curtis Dutton

unread,
Mar 1, 2019, 11:51:06 AM3/1/19
to Racket Developers
Hi all,

I've worked with linuxcnc realtime machine controller for the last 5 years. I have been playing around in my spare  time with building a new motion controller that is jerk limited. My prototyping is being done in racket to prove out my math and implementation. Once working well it will be ported to C for hard realtime production code. It's been nice with the FFI to be able to actually interface with linuxcnc.

Now I find myself wondering, why can't racket run in realtime? The GC is the most obvious hurdle that I can see. But racket execution speed by itself is plenty fast enough. 

If we had a racket language that could generate code that doesn't generate garbage during execution I think implementing realtime components in racket could be doable.

Most realtime code in the machine controller consists of tiny little functions that are executed at 1000 times per second.

So what I'm looking for is a racket language that doesn't generate garbage at execution time. But a "setup" phase could do so and it wouldn't be a problem.

Is there such a thing? Is it worth pursuing? Or better to just stick with C?

Anyhow just something I've been wondering about and I'm seeking opinions or any known resources from the research world.


Thanks,
    Curtis


Dave McDaniel

unread,
Mar 1, 2019, 11:56:59 AM3/1/19
to Curtis Dutton, Racket Developers
That is a cool idea.  While its not racket, have you heard of Carp?  It's a lisp without GC, was developed for game development.  I think its still pretty beta, and again not racket, but you may find it tangentially interesting. 


Best,
Dave

--
You received this message because you are subscribed to the Google Groups "Racket Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to racket-dev+...@googlegroups.com.
To post to this group, send email to racke...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/racket-dev/CAPChLEqN4BHVn7P0UAA09n4UGVvVsyqw9DhKdoBEOtK56Dkrrg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Stephen De Gabrielle

unread,
Mar 1, 2019, 12:21:52 PM3/1/19
to Dave McDaniel, Curtis Dutton, Racket Developers
Sounds very interesting!

I know it doesnt answer your realtime question but could Racket be used to compile 'G-Code'(or C?) to shorten your development loop from 'prototyping and porting' to 'compiling'? (and perhaps 'talk' to linuxcnc directly if it has an api?)

Kind regards
Stephen

G10 L2 P1 X0 Y0 Z0 (ensure that G54 is set to machine zero)
G0 X-0.1 Y0 Z0
G1 F1 Z-0.25
G3 X-0.1 Y0 I0.1 J0
G0 Z0
M2

It can generate outputs for other targets, e.g. scribble, asi64


Jens Axel Søgaard

unread,
Mar 1, 2019, 12:24:31 PM3/1/19
to Stephen De Gabrielle, Dave McDaniel, Curtis Dutton, Racket Developers

matt...@ccs.neu.edu

unread,
Mar 1, 2019, 1:09:33 PM3/1/19
to Curtis Dutton, Racket Developers
I am aware of a number of Scheme programs for real-time purposes. An exemplary one is probably Disney’s use of Chez Scheme to control some rides. My recollection is that the programs turned off the GC for those parts when they absolutely couldn’t be interrupted for some “embarrassing pause”. In principle, this strategy might be applicable to Racket-on-Chez. (Kent would know the story better. I don’t have it from him, and I never confirmed it with him. But I have confirmed similar stories with companies that do not publicly share their use of Scheme/Racket.)

Of course I don’t know whether such a strategy would work in your case. I also don’t know whether Racket-on-Chez would be fast enough for your Racket fragments and the FFI might not be good enough (yet). I will let Matthew comment on this last point.

— Matthias

Reply all
Reply to author
Forward
0 new messages