Scratch 2—Thymio-II : versions Windows, MacOS, Linux

Continuing the discussion from Piloter un Thymio-II avec Scratch:

Suite à des nombreux retours j’ai amélioré la passerelle Scratch 2—Thymio-II pour qu’elle fonctionne sous Windows, Linux et MacOS. Elle permet à un programme Scratch 2 de piloter un robot Thymio-II branché par câble USB.

La version pour votre système peut être téléchargés à l’adresse Releases · davidjsherman/inirobot-scratch-thymioII · GitHub. La version actuelle est la v0.6.2-alpha.

L’usage est assez simple :

  1. Brancher le robot
  2. Lancer la passerelle Scratch2-ThymioII
  3. Ouvrir l’un des exemples fournis avec Scratch 2 offline

L’exemple Thymio-II sensors affiche les valeurs des capteurs, dont quelques uns (distance avant et arrière, angle avant) qui sont calculés à partir des capteurs de base. (Clique sur le scène pour démarrer le reporting.)

L’exemple Spirograph arcs montre comment la position d’un lutin Scratch peut être synchronisé avec l’odométrie du robot.

Un grand merci à Didier Roy, Romain Couairon, Jacques Soustrade et David Doak pour les tests sur le terrain, et à Stéphane Magnenat et Michael Bonani pour leurs conseils.

Le choix de blocs et de reporteurs n’est pas arrêté, n’hésitez pas à me faire des critiques ou suggestions. Vous trouverez sur GitHub le bytecode thymio_motion.aesl, qui met en œuvre une file d’attente pour les opérations bloquantes comme le movement, ainsi que le code source pour la passerelle asebascratch, qui met en œuvre un micro-serveur HTTP pour communiquer avec le Thymio-II.

Un grand merci à David pour son immense contribution à nos projets robotiques pour l’éducation !

Ce sujet est maintenant un gros titre. Il sera affiché en haut de chaque page jusqu’à qu’il soit ignoré par un utilisateur.

Ce sujet n’es plus un gros titre. Il ne sera plus affiché en haut de chaque page.

Je m’excuse que je n’ecris pas francais, mais c’est trop difficile pour moi :disappointed:

Thanks, David, for developing this great project!

  1. Is there documentation of the blocks? I don’t know what you mean by “switch dial”, “set odometry”, “avoid”,
    and the details using some other blocks are not obvious.

  2. Why do some blocks appear in the palette in some projects and not others? For example, “avoid”.

  3. When I tried to run Sierpinski, nothing happened…

Hello Moti,

Scratch programs record the extension blocks so that they will be self-contained, and I think I included the wrong versions of some of the examples. I’ll fix that right away. Sorry!

If you load the extensions explicitly into Scratch (using shift-File) then you will get the up to date versions. There are two interfaces:

The documentation in inirobot-scratch-thymioII/README.md is pretty incomplete. Briefly, the “dial” is my idea for giving the Thymio-II costumes to show that it is thinking: the circle LEDs on top spin around like the hands on the dial of an analog clock. The “set odometry” block resets the Thymio-II’s idea of where it is: direction angle, x coordinate, y coordinate.

Thanks for your feedback,
David

Update: I added a brief description of the blocks to scratch-blocks.md

Sorry, David, but it’s not working for me. When I load the json files into scratch, nothing happens. It’s not clear if I am supposed to do this before or after connecting the Thymio and running the server, but I tried it both ways and neither works. It doesn’t seem to be a hardware problem, because loading the examples still gives me the result I got before.
Thanks in advance for your help,
Moti

David, Moti,

FYI

I have used the 0.6.2 release successfully on Win 7 machines at school.
However, I cannot get 0.6.2 to work on Macs (tried three machines 2xMavericks, 1xYosemite).
I have an old 0.6.1 release which works fine on the Macs.

David.

Hi David,
Thanks for the reply.
Since I am not familiar with the infrastructure you’re using (Air, json),
I think I’ll wait until the project is a bit more mature before trying again…
Moti

Hi David,
I’ve been using it successfully on Macs, Win XP, and Ubuntu Linux. Perhaps something is missing from the Mac bundle like last time. If you could run in from terminal and mail me the error messages, I’ll see what’s up.

There will be a new version shortly, with fewer dependencies. It will be a maintenance release, while I’m working on the version that will work with the Thymio RF.

Cheers,
David

Importing the JSON file should add grey-colored blocks under a heading « Thymio-II » in the « More Blocks » category. You need to import the definition using the hidden « import experimental HTTP extension » option that you get by SHIFT-clicking on the File menu.

(Trying to open the JSON file as if it were a program will silently fail.)

There will be a colored dot next to the new blocks. If the server is running and Scratch can contact it, the dot will be green, otherwise, red (as below). It shouldn’t matter if you do this before or after loading the extension.

Voici une version corrigée pour Mac / Here is a corrected version for the Mac : Scratch2-ThymioII-0.6.2-MacOS_patch1.dmg
Thanks @ddoak for your help in diagnosing the problem.

Proximity sensors

In the current implementation “sensing front” is a string in Scratch - which is tricky to make use of since Scratch has no native string manipulation functions - I think it might be more useful as a list.

Similarly - I’d like to be able to access the raw values from the ground and rear sensors. I don’t see how it is possible to make a line follower at the moment.

Is there still a version of the extension which exposes more of the native data from the thymio? (I just tried loading the basic json extension and couldn’t get the grey extension variables to update)

La variable « distance » et sa version booléenne « je touche » ont de petits menus, qui permet de récupérer les valeurs à l’avant, à l’arrière et au sol. À l’avant tu peut utiliser l’angle à la place des capteurs horizontaux — le signe permet de savoir si l’obstacle est à droite ou à gauche. Pour les capteurs au sol, c’est vrai que je combine les deux, ce qui pose problème parce que pour suivre une trace il est utile de savoir si l’on le perd à droite ou à gauche.
Scratch ne permet pas de récupérer une liste, uniquement une chaîne de caractères, c’est énervant.
Voici une capture d’écran avec l’extension basique, qui marche pour moi ;-(

The « distance » reporter and its boolean counterpart « touching » have little menus, where you can select for front, back, and ground sensors. For the front, you can use the angle instead of the horizontal sensors — the sign lets you know whether the obstacle is to the right or to the left. For the ground sensors, it is true that I combine the two values, which makes it hard to make a line follower since it’s useful to know whether one loses the trace on the right or on the left.
Scratch doesn’t let one retrieve a list, only a string, which is annoying.
Here is a screen shot of the basic extension, which works for me ;-(

Bonjour David , merci pour le travail effectué. J essaye de faire marcher le livrable windows sur du windows 7 et le chargement du script aseba, ne SZ fait pas.
Aurais tu une idée ?
En tout ça le projet est bien sympathique !

Bonjour Rémy,
Si j’ai bien compris la question, la passerelle assebascratch démarre, mais ne transmet pas le programme thymio_motion.aesl au robot ? Comment le savez-vous ?
Avez-vous déjà installé les logiciels Aseba Studio etc. sur cette machine ? Car la distribution officielle installe un pilote USB pour le Thymie-II qui est nécessaire pour le fonctionnement de ma passerelle.

Bonjour

D’abord un grand bravo pour l’ensemble de ce travail sur thymio et scratch.

J’ai reçu une thymio la semaine dernière et j’ai pu tester un peu cet outil avec aseba studio qui me semble assez complexe à maitriser et surtout à expliquer puis avec scratch.

Avec scratch, j’ai été tout de suite conquis.

Ayant un peu d’expérience sur l’utilisation de scratch et de la sphero

cf https://www.youtube.com/watch?v=Sta_YCi028I&feature=youtu.be et http://www.ien-lannion-nord-paimpol.ac-rennes.fr/sphero/evaluation_sphero_scratch_plougrescant.odt

je me suis demandé s’il était possible de transférer à la thymio ce qui avait été réalisé avec la sphéro l’an dernier.

Cela ne m’a pas posé de problème et j’ai donc hâte que le kit sans fil soit disponible surtout que faire brancher et débrancher plusieurs fois par jour sur une aussi petite prise et cela par des utilisateurs multiples me semble un peu risqué si on veut que l’outil reste fonctionnel très longtemps.

Je vous livre mes premières remarques ici

http://www.ien-lannion-nord-paimpol.ac-rennes.fr/2015_2016/thymio_remarques.pdf

Cordialement

Alain Botrel