[Sugar-devel] TA NXT plugin - cleanup and faster startup

Emiliano Pastorino epastorino at plan.ceibal.edu.uy
Wed Mar 23 13:48:53 EDT 2011


>
> One situation that is not handled well is unplugging/replugging of the
> usb cable -- which may well happen between "runs" in a busy classroom.


I was thinking just a moment ago on listening for "deviceadded" and
"deviceremoved"
signals from hal, hidding/unhidding nxt palette and calling find_one_brick
only when
necessary. Do you think this is a good approach?
Is it possible to add and remove a palette on the fly?

On Wed, Mar 23, 2011 at 1:54 PM, Martin Langhoff
<martin.langhoff at gmail.com>wrote:

> Hi Emiliano, Walter, list,
>
> At http://dev.laptop.org/git/users/martin/turtleart/ you'll find
> current TA master plus 2 patches. One is Emiliano's work, presented as
> a single patch that only touches the relevant files. I think this is
> good to merge.
>
> Author: Emiliano Pastorino <epastorino at plan.ceibal.edu.uy>
> Date:   Wed Mar 23 11:49:02 2011 -0400
>
>    Add LEGO Mindstorms NXT2.0 plugin based on nxt_python 2.1.0
>
>  icons/nxtoff.svg      |   84 ++++++++++++
>  icons/nxton.svg       |   83 ++++++++++++
>  plugins/nxt_plugin.py |  339
> +++++++++++++++++++++++++++++++++++++++++++++++++
>  po/es.po              |  168 ++++++++++++++++++++++++
>  4 files changed, 674 insertions(+), 0 deletions(-)
>
> The other one is
>
> Author: Martin Langhoff <martin at laptop.org>
> Date:   Wed Mar 23 12:33:08 2011 -0400
>
>    nxt: delay finding the NXT brick, offer NXT block everytime
>
>     - Startup delays --due to searching for NXT bricks -- are gone
>       these delays affected all users with the libs installed.
>
>     - All users that have nxt libraries installed see NXT blocks, and
>       can load/edit files w them.
>
>     - NXT detection is delayed until we hit an NXT-related action block
>
>     - We only try to stop NXT motors if we have seen an nxt brick
>
>  plugins/nxt_plugin.py |   52
> ++++++++++++++++++++++++++++--------------------
>
> To use/test my rework of Emiliano's patches, you'll want to have the
> following rpms installed. They are built for Python 2.7 so F14 onwards
> -- will prep F9 and F11 packages soon.
>
> http://dev.laptop.org/~martin/public_rpms/nxt_python-2.1.0-1.fc16.noarch.rpm
>
> http://dev.laptop.org/~martin/public_rpms/lego-udevrules-1.0-1.fc14.noarch.rpm
>
> With Emiliano's patch there is a very visible delay on startup, due to
> the attempts to find an NXT brick. In fact I got worried for a moment
> that the plugins model was to blame. My patch waits until we actually
> need to talk to the brick to search for it, and displays a nice error
> msg if we can't find it.
>
> One situation that is not handled well is unplugging/replugging of the
> usb cable -- which may well happen between "runs" in a busy classroom.
>
> We could address that by wrapping every call to the NXT libs with a
> try/except that retries the _find_brick() and retries the command.
>
> cheers,
>
>
> m
> --
>  martin.langhoff at gmail.com
>  martin at laptop.org -- Software Architect - OLPC
>  - ask interesting questions
>  - don't get distracted with shiny stuff  - working code first
>  - http://wiki.laptop.org/go/User:Martinlanghoff
>



-- 
Ing. Emiliano Pastorino
Centro Ceibal
Av. Italia 6201 Ed. Los Ceibos
Montevideo, Uruguay
Tel: (598) 2601 5773 int.: 2232
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sugarlabs.org/archive/sugar-devel/attachments/20110323/54025ac5/attachment.html>


More information about the Sugar-devel mailing list