unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
From: Steve Tell <tell@telltronics.org>
Cc: guile-user@gnu.org
Subject: Re: guile-controlled house
Date: Wed, 3 Apr 2002 23:13:07 -0500 (EST)	[thread overview]
Message-ID: <Pine.LNX.4.21.0204032106050.29059-100000@ariel.lan.telltronics.org> (raw)
In-Reply-To: <E16seBT-0002VK-00@giblet>

On Tue, 2 Apr 2002, Thien-Thi Nguyen wrote:

>    From: Steve Tell <tell@telltronics.org>
>    Date: Tue, 19 Mar 2002 02:03:51 -0500 (EST)
> 
>    Anyone else interested in (or already using) guile for home
>    automation?
> 
>    Announcing "guilfred," guile's answer to Alfred the butler.  [...]
> 
> are these devices "real-time" in any sense?

Many device nodes have low-leveldealings with external hardware with
real-time constraints, such as the Dallas one-wire interface and
other serial protocols.  That's all handled in embedded 8051
assembly-language firmware.

I suppose the whole system of guile code, C support, and connected
device nodes could be considered soft real-time:

- events relates to the wall clock; if a cron entry says to call a
procedure at 17:05, it isn't the end of the world if it gets called at
17:05:01, but it is wrong if it happens at 17:06.  

- several user-interface inputs must trigger their guile procedures and
the results of those take effect soon enough that it appears
"instantaneous" to the user.  I've got a node called "keyled" which has 8
pushbuttons, each with an integral LED.  When the user pushes the button,
the embedded micro debounces the button, and stores the keycode in a
buffer.  Guilfred is continually polling all such keypad nodes, asking if
they have any buffered keycode.  When keycodes are found, the procedure
bound to that keycode is called.  Typicaly, at least two messages end up
being dispatched: one to turn on the LED in the button, and another to
turn on the associated lamp or other device.  I generally can't see any
noticable lag, but if I did, I'd set about redesigning and recoding so I
didn't.  But if one time in a hundred it took 250 milliseconds instead of
50, that would probably be OK.

But so far I'm not taking any particular measures to keep things
real-time.  I've been running guilfred as a user process on a linux box,
not even rtlinux nor even scheduling priority for the process.  
The same Pentium 166 cpu does other things too, serving web pages and
playing MP3 files.

When I started this a couple of years ago, I was worried about overhead of
using any scripting language, but subjectively guile has performed
admirably.  I have constrained it a bit: the C core is in charge and owns
the select loop.  It calls guile procedures or hooks on timer events and
external-input events.  Guile code isn't allowed to do anything that could
possibly block (although I'm not enforcing that by hiding "dangerous"
libguile procedures yet).


I've put some pictures some of the user interface devices at
http://www.telltronics.org/software/guilfred/hw-pictures/
Photos of nodes controlling some lights and the in-floor radiant heat will
have to wait until next time I climb into the attic.

Steve







--
Steve Tell  tell@telltronics.org 


_______________________________________________
Guile-user mailing list
Guile-user@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-user


      reply	other threads:[~2002-04-04  4:13 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-03-19  7:03 guile-controlled house Steve Tell
2002-04-03  6:23 ` Thien-Thi Nguyen
2002-04-04  4:13   ` Steve Tell [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Pine.LNX.4.21.0204032106050.29059-100000@ariel.lan.telltronics.org \
    --to=tell@telltronics.org \
    --cc=guile-user@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).