mBot simulator written with mBlock blocks


#1

Hi, I wrote a mBot simulator in mBlock.

The simulator enables you to simulate the mBot behavior on the “scene” and toggling a variable it should send the commands to the real mBot, if one is connected to the mBlock.

I’m a spanish speaker so, the variable names and documentation is in spanish, but, code is code and should be a starting point for any one interested on the subject.

I’ll be pleased if any one use it and will answer any question you may have.

Firsts videos of old implementations
In this video, i start driving the mBot with the arrowkeys and watching the distance reported by the simulated ultrasonic senor and line follower. After a while i make visible a “stick sprite” whic i used to measure distances.
Then I switch the floor and run a line follower code.

This second video has me speaking explaining some inner workings of this old implementation, which do not change so much, but now, instead of multiple sprites and multiple threads I am using a single mBot object with multiple costumes. So just one thread for mBot object.

in this third video i was connected to another simulator via comm ports, so I toggle from sending commands to a mBot simulated in 3d space and simulating in 2d space with mBlock

This one is the last, with 2 mBot on scene

Here the code of a couple of examples: line follower and exit of a maze following the right wall

https://drive.google.com/open?id=1_hHvHkTTw7cSNK4dCYebu5p8wfuhKLVq

https://drive.google.com/open?id=12DyJKsjh4rSRdDlU2Q2TIr5N18_T-ibK

a guide of usage:
https://drive.google.com/open?id=1XmxHprKv25NH984fJLXccbAw-cRGssng

enjoy

Juan


#2

Felt the need to login just to say thank you.

I’ve been looking around for something like this for some time now but never got around to doing it.

Awesome job, congratulations !


#3

Thank you.
As a teacher, simulation is a must. Students has the chance of testing at home, in no real bot is present. Refine the algorithm and then enjoy watching the real one.

Just in case… this is the Spanish Forum thread about this simulator:

Juan


#4

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.