jmoenig / Snap

a visual programming language inspired by Scratch
http://snap.berkeley.edu
GNU Affero General Public License v3.0
1.49k stars 743 forks source link

Controlling Thymio robot with Snap! #1711

Open nathalierun opened 7 years ago

nathalierun commented 7 years ago

Hi,

Thymio (https://www.thymio.org) is a robot often used in european schools. telechargement

We have twenty in our school and I would like to make students pilot those robots with Snap! There is already a way to program Thymio with Scratch. (here : https://www.thymio.org/en:scratchprogramming)

Have you heard about someone working on this ? Thank you.

nathalierun commented 7 years ago

There is something about this here : https://dm1r.inria.fr/t/piloter-thymio-avec-snap/483 but I don't understand anything. Specially this ... Il y a dans snap un pdf qui renvoie via http://localhost:30006 vers ext_basic.json et ext_scratch.json, pour ensuite utiliser asebahttp api puis asebascratch api.De là, via aseba-ser:tcp: on envoie vers thymio_motion.aesl et aseba firmware.

bromagosa commented 7 years ago

Yep, it seems they're just using HTTP to control the robot. It should be entirely possible (and easy, as in a couple hours) to port to Snap!, but I don't have any of those around.

Maybe you should give it a try yourself. Here's their documentation: https://github.com/davidjsherman/inirobot-scratch-thymioII/blob/master/README.md

And the whole HTTP protocol is here: https://github.com/davidjsherman/aseba/tree/master/switches/http

You just need to create blocks that use the ( http:// [ ] ) block, like so:

image

Which gives you this block:

image

You'll first need to install their middleware and fire it up to test these blocks.

nathalierun commented 7 years ago

Thank you @bromagosa for your answer.

It is not a small matter ! I need enough time to work on it.

I give the information to someone who works on it. https://dm1r.inria.fr/t/piloter-thymio-avec-snap/483

jmoenig commented 7 years ago

Hi @nathalierun , I think I've seen engineers at INRIA controlling a large-scale simulation of the Rotterdam harbor that used several Poppy Ergo Jr. robots as well as several Thymios all with a single Snap project last summer in Bordeaux. Let's ping @pierre-rouanet about this, he was one! Maybe (some of) the work can be reused. It would be wonderful to control Thymios with Snap, they're fantastic and very popular robots!

nathalierun commented 7 years ago

@jmoenig : ok, I'll contact @pierre-rouanet . Thanks.

Albidochon commented 7 years ago

Hello all, Well, i can try bromagosa's method .... lot of work and time to spend for all blocks .... tell you later how it goes on... Thanks for the new idea.

bromagosa commented 7 years ago

Hey! It's not so much work, just take a look at the Scratch extension and replicate it.

Here's the list of blocks: https://github.com/davidjsherman/inirobot-scratch-thymioII/blob/master/doc/scratch-blocks.md

And here are all the HTTP calls: https://github.com/davidjsherman/inirobot-scratch-thymioII/blob/master/ext-basic-thymioII.json

Seriously, it's just a matter of copy-pasting :)

pierre-rouanet commented 7 years ago

Hi all,

Indeed as @jmoenig said we already did the blocks a while ago... and I can't remember where they are. I keep digging and let you know as soon as I find them back!

Albidochon commented 7 years ago

hello all ... I've in my directory the files you're talking about. Blocks and json file. Something miss me. The path in the json file : "nodes/thymio-II/scratch_move" for example. I don't have nodes and thymio-II directories.... Do i have to rebuilt the tree to reach this target ? There is something that i can't understand in this json file. Thanks for the reply

show0k commented 7 years ago

Hi all, Here are the blocks @pierre-rouanet and I used for a demo with multiple Thymios. If you have multiple Thymios conneted with the same asebahttp, they will have each a different node id (but there is always a default node called 'thymio-II'), that's why certain blocks have a node input.

You need to start asebahttp which will start a local web server to answer Snap requests to the robot. I had a Linux binary but I don't find it anymore...

Albidochon commented 7 years ago

Bonjour, You will find on this page the Thymio's blocks for snap : http://dm1r.fr/thymio-scratch-sim/ The file is called thymio-scratch-snap-base.zip, just have a look over the page to find it. in the zip,you'll find the file thymio_snap_15052017.xml you have to import int the snap GUI, this file will build all the blocks for Thymio. The snap's file are xml formatted. So so, hope you will find usefull this new link.

jmoenig commented 7 years ago

Yay!! thank you, @Albidochon !

nathalierun commented 7 years ago

Nice.

But, we only have Linux stations in my establishment. And, unfortunately, the patchs given are only for Mac and Windows. Our students have all a computer under Linux, offered by our district in their first entry in high school. Do you have any idea of what we have to do under Linux ? I don't understand why we have to install first a patch for Scratch.

bromagosa commented 7 years ago

Hi @nathalierun,

if I got it right, it's not a patch for Scratch, it's the middleware they're using to communicate with the robot.

It seems there's a package for Ubuntu too, but I'm not sure it's the same thing: https://github.com/davidjsherman/inirobot-scratch-thymioII/releases

Sorry, I don't have a Thymio myself so I can't test it :(

Albidochon commented 7 years ago

hi all, @nathalierun , #bromagosa is right, you've got a Ubuntu release on this page...

habib256 commented 1 year ago

You can use ThymioSNAP : https://snap.berkeley.edu/snap/snap.html#present:Username=gist&ProjectName=ThymioSNAP&editMode&noRun Have FUN :-)

cymplecy commented 1 year ago

I loved my Thymio :)

image