Discuss Scratch

botkop
New to Scratch
8 posts

scratch and lego mindstorms ev3

Hi,

I started working on a way to program the EV3 with the Scratch 2.0 off-line editor.

Source and documentation can be found on github:
https://github.com/koen-dejonghe/ev3-scratch-helper-app

Currently it's only possible to read a couple of sensors, but I think it's a good start.

Suggestions, bug reports, etc… welcome.
Thank you.
swedish_cook
New to Scratch
4 posts

scratch and lego mindstorms ev3

botkop wrote:

Hi,

I started working on a way to program the EV3 with the Scratch 2.0 off-line editor.

Source and documentation can be found on github:
https://github.com/koen-dejonghe/ev3-scratch-helper-app

Currently it's only possible to read a couple of sensors, but I think it's a good start.

Suggestions, bug reports, etc… welcome.
Thank you.

Awesome - the old NXT had 2 Scratch implementations, so glad to hear one is starting for EV3 !

Imho the programming suite supplied by Lego really really sucks (to be generous), once programs become more than trivial they look a real mess and are unintelligible (speaking as someone working in systems design for 20 years or more). How they think that kids can learn well with that software really beats me.

I'll take a look next weekend :-)
swedish_cook
New to Scratch
4 posts

scratch and lego mindstorms ev3



I followed the instructions and connected successfully to my ev3 on first attempt, I ticked the 3 sensors I had connected, dragged on the blocks to tell it which sensors(touch, distance and color) were connected to what and followed that by a loop forever. The first time I tried I got the touch sensor to registed a press, on subsequent runs it did not, the values displayed for the other sensors did not change irrespective of what I did with those sensors. Connected a large motor and that seemed to start and stop ok.

I had lots of errors on the command window like these :

2014-04-21 17:32:50.392 ERROR 2544 — scratch.ev3.PollControl
ler : null
2014-04-21 17:32:50.392 ERROR 2544 — scratch.ev3.PollControl
ler : null
2014-04-21 17:32:50.532 ERROR 2544 — scratch.ev3.PollControl
ler : null
2014-04-21 17:32:50.535 ERROR 2544 — scratch.ev3.PollControl
ler : null
2014-04-21 17:32:50.586 ERROR 2544 — scratch.ev3.PollControl
ler : null
2014-04-21 17:32:50.593 ERROR 2544 — scratch.ev3.PollControl
ler : null
> Building 50% > :bootRunTerminate batch job (Y/N)? y

Minor install niggles (may be worth update to instructions for others) :
1. Slightly confused what to do on github (I haven't used it before), elected to download as a zip and that seemed to be ok.
2. Needed full jdk, only had a jre installed. For those new to java worth a comment on java_home and path.
3. With the ev3 disconnected I expected an error, but the one displayed looked more like a compile error than a connectivity error.
4. With ev3 connected the last thing displayed on the command window before I started scratch was “Building 50%”, you can still see it above, so I wasn't sure it was actually running.

Thanks for this, looks like something that could really work well, happy to test some more … how can I verify what is wrong with the sensors ?

Last edited by swedish_cook (April 21, 2014 16:58:10)

botkop
New to Scratch
8 posts

scratch and lego mindstorms ev3

I am very grateful for this test report. Frankly I have never tested it on Windows, so I'm glad to hear that it ‘works’ just like on other platforms.

The null error generated by the poll controller is a known issue to me. I am still investigating how to fix it.
Basically, I have not found a way for lejos to report the current state (connected/disconnected) of motors and sensors. In other words, my program must keep track of all state changes, and must be told explicitly. If something changes in the physical world without my program being told, then this will generate these null errors. There may be other reasons as well.
If this situation happens, then the only way I have found to slove this, is to reset lejos, by either rebooting the ev3, or logging in to the ev3, killing the menu program, and restarting it.

I have included a small demo program ‘scratchcar’. If you have a look at it, you will find an initialize, a reset and a start sprite.
The initialize sprite tells the helper-app which devices have been connected to the ev3. This must be executed before anything else.
The reset sprite tells the program to close the connected devices. It is not necessary to remove them physically from the ev3, but if you want to use them again, then you must execute the initialize sprite again.
The start sprite is a small program that will tell the ev3 to keep running forward, until it comes too close to an obstacle, at which point it will make a left or right turn, depending on how you connected the motors.

About the documentation, you are absolutely right. I will include your remarks as soon as possible. Some things that are obvious to me, are not clear to other people. That is why testing and reporting like you did is so valuable.

swedish_cook
New to Scratch
4 posts

scratch and lego mindstorms ev3

Tried scratchcar - runs fine, no errors, looks like your project is progressing well.

Any chance that you can add motor rotation by degrees/rotations ? My son is building the Spider (Spik3r) and firing motor cannot be allowed to run free, so won't be able to test for a while without that. Obviously don't let me derail your plans though !
botkop
New to Scratch
8 posts

scratch and lego mindstorms ev3

Good to hear that. There are still problems though with the program…

I've implemented to rotate and rotateTo methods, but I've not had much time to test (and I will not have the possibility to make changes in the next coming days).
One thing to keep in mind: these methods take time to finish, but the wait-commands in scratch are buggy so I cannot use them. What this means is that you must have the rotate instruction followed by a wait instruction for approx. the time it takes for the rotation to finish.

Hopefully you will already find it useful.
gatzke
Scratcher
100+ posts

scratch and lego mindstorms ev3

I like the idea of this project, but install is not “seemless” by any means.

What would it take to get code like this included in the offline editor? The package is quite small…

Also, what would it take to include NXT support? We currently run NXT, but will have to switch. There will be many NXT folks for years, though!

Check out Super Tank in Phosphorus++ to run Scratch programs
nerder
Scratcher
1 post

scratch and lego mindstorms ev3

Is it even possible to use ev3 with scratch? if so start a studio!
rocketclock123
Scratcher
100+ posts

scratch and lego mindstorms ev3

Support

My Signature doesn't taste good
PLATFORMER click here
little_kitten
Scratcher
500+ posts

scratch and lego mindstorms ev3

nerder wrote:

Is it even possible to use ev3 with scratch? if so start a studio!
Yes, he's working on it.

The above post was likely clear sass. 10 outta 10.
Unless it wasn't. Which happens from time to time. Sadly.
Wordwide
New to Scratch
6 posts

scratch and lego mindstorms ev3

I Have The Lego EV3.
Its Brand New!
I Got It On The 5th!
StriderTheDog
Scratcher
7 posts

scratch and lego mindstorms ev3

Wordwide wrote:

I Have The Lego EV3.
Its Brand New!
I Got It On The 5th!
i go it to
SuperDragon2014
Scratcher
45 posts

scratch and lego mindstorms ev3

gatzke wrote:

I like the idea of this project, but install is not “seemless” by any means.

What would it take to get code like this included in the offline editor? The package is quite small…

Also, what would it take to include NXT support? We currently run NXT, but will have to switch. There will be many NXT folks for years, though!
Actually, there is a pretty good NXT Scratch (or I guess it's really a BYOB) mod by the name of Enchanting.(http://enchanting.robotclub.ab.ca/tiki-index.php) All you need is LEJOS installed on your NXT and you'll be good to go! The only down side is that BYOB and Enchanting are mods of Scratch 1.4, not 2.0.

if <(username)=[SuperDragon2014
change [loves v] by (999999999999999999)
end
gatzke
Scratcher
100+ posts

scratch and lego mindstorms ev3

SuperDragon2014 wrote:

Actually, there is a pretty good NXT Scratch (or I guess it's really a BYOB) mod by the name of Enchanting.(http://enchanting.robotclub.ab.ca/tiki-index.php) All you need is LEJOS installed on your NXT and you'll be good to go! The only down side is that BYOB and Enchanting are mods of Scratch 1.4, not 2.0.

I have used Enchanting. It was not terribly robust overall, but I have used it in the past. The install was generally ok and the code mostly worked but it seemed a little flakey.

Things are moving to EV3 as NXT is no longer sold, so hopefully scratch moves too. AFAIK, there are no working EV3 Scratch implementations. I could be wrong, I have not looked much recently.

Check out Super Tank in Phosphorus++ to run Scratch programs
jlm70
New to Scratch
7 posts

scratch and lego mindstorms ev3

Scratch is already supporting Lego WeDo… but I just bought an EV3 package and I'd like so much teaching my kids to mix their growing Scratch “coder dojo” competences with the new EV3 (without buying another expensive Lego set ;-). Mixing physical and digital is the way to major express their creativity (and mine, too… ;-).

I obviously support the idea!
gatzke
Scratcher
100+ posts

scratch and lego mindstorms ev3

Lots of folks support the idea, but I think most of what can currently be done is a real-time attachment like the WeDo approach. Basically, the scratch engine can read and write to the physical hardware in real time. Detect sensor values and send output information to the motor.

However, for robotics you often need an autonomous system. So in the Scratch inspired project Enchanting, you write code then compile/dump it into the NXT core. Then the robot can run on its own.

I think folks are working on the ev3, but more from the WeDo approach. If that can work wirelessly (continuously) it may be ok. However, you can't really dump a program onto the ev3 using that approach.


Check out Super Tank in Phosphorus++ to run Scratch programs
KiwiGamer450
Scratcher
1 post

scratch and lego mindstorms ev3

StriderTheDog wrote:

Wordwide wrote:

I Have The Lego EV3.
Its Brand New!
I Got It On The 5th!
i go it to
I got it too
TylerInScratch
Scratcher
35 posts

scratch and lego mindstorms ev3

uuuuuhhh… i got 4th place in the fll world league…
terrainfollower
New to Scratch
1 post

scratch and lego mindstorms ev3

I got 2nd place!!!!!!!!!
nxtprogrammer
Scratcher
6 posts

scratch and lego mindstorms ev3

i have ev3 but i neglect it

r2d2 is cute so is pikachu

when green flag clicked
forever
use scratch
end

Powered by DjangoBB