mBot Solving a Maze
Vložit
- čas přidán 25. 08. 2024
- This video is of an mBot by Makeblock using a wall following algorithm to solve a maze. The mBot is a STEM-focused robot and is the stock, out-of-the-box version (mine are WiFi, but Bluetooth models are also available). The posts and pegs are 3D printed (www.thingiverse...) and the rest of the construction is 4mm foam core board and black masking tape. All of the code is written in the mBlock (Scratch 2.0) environment using the Scratch language and mBot extensions.
This project is the capstone for a one week camp for middle school children in the Seattle, WA area.
I've published an eBook that contains a collection of projects for the beginner at leanpub.com/ag.... The book starts with turning the LEDs on and off and progresses through to the maze solving program above. The price is less than $20 USD and all of the proceeds to to funding kids robotics teams.
The code is available at github.com/sen..., but please consider buying a copy of the eBook and supporting the kids.
Has anyone able to provide a copy of the code for the more recent versions of mBlock, as what is in the book is of no use today.
Hi there, love the maze. I noticed your files for the 3D printer. I can see how you have used the posts, but what are the Pegs for? BTW: I bought your book :)
The pegs go through the bottom of the posts to hold them in place. There is a hole where the posts are located that goes all the way through the foam core board. I would, however, recommend a machine screw and large washer because the 3D printed posts tend to be a bit fragile. :-)
Hi. Can you say exactly what size the cells were? Or at least the length of the wall.
Hi All, just published the ebook (PDF for now, ePub/mobi to follow) on Leanpub (leanpub.com/agitr_v1/). It's my first book, so all constructive feedback is appreciated. After I get the ePub/mobi versions done and published, I'll start on the next volume that will address using the Arduino programming environment with the mBot. The third volume is intended to be a cookbook of sorts so I'm open to gathering project ideas and/or problem areas.
All of the proceeds from the sales of this book will go into a fund to help robotics teams purchase the hardware, software, etc. that they need to be successful. The code to the book (which includes the maze solver above) is at goo.gl/CWROM5, but please consider buying the book to support the kids activities.
Hi Charles, I bought your ebook and I'm having trouble getting the variables to work. I can create them easily, but they don't work. For example, I understand how to calculate distance traveled by multiplying the diameter of the wheels by the mean time interval. However, how do I connect my distance variable to the mBot wheel rotation? How do I connect my time interval variable to the internal clock on the mBot? Thanks.
Hi Charles, More variable questions: How do I set up a power, speed, and a CmPerSec variable to the motors? To what is the StopFlag variable connected?
The variables are set up in the Initialize block. The StopFlag is used as a condition to terminate the loop in the main program logic block.
The mBot does not provide a method for measuring rotations, so it is necessary to conduct the measurement experiments in Chapter 12 to determine the time your mBot requires to travel a specified distance. This time value is used in the seconds parameter of the motor block.
You can either use a wait block with the duration or use a repeat until or if-else block with a test to see whether or not the current timer value is greater than the maximum value you desire.
The first method is a blocking call that will prevent anything else from happening until it is complete.
The second method requires that you calculate the end time and test that with either a repeat until block or an if / if else block to see if the current time is greater than the calculated time.
set [triggerTime] to (timer) + myDuration
forever
if ((timer) > triggerTime)
do something
else
do something else
--- or ---
set [triggerTime] to (timer) + myDuration
repeat until ((timer) > triggerTime)
do stuff here
Hi Charles,
I guess I'm not being clear enough. If I test the mBot and it can go an average of 2 cm per second at speed 100. I set up an initialize block with a variable called "CmPerSec." To the mBot, "CmPerSec" is just a string of characters. How to I get the mBot to understand that when I use the variable CmPerSec, it's supposed to run the motors at speed 100 for the specified time? It needs to communicate to the motors, but I don't know how to make it do that.
I'm reading ur book and practicing the projects I'm learning a lot.
I'm happy to hear that the book is being helpful!
Q-Learning algorithm covered in the book with example?
Thank you for your video, this really helped me. However, I still have one question: What does 'set RoomSize to 27.94' in the code mean? This is used underneath define : initialize. Thank you.
It's the length and the width of a room and is used to calculate the distance to move between room centers.
Can you give codes ?I realy need it.Thank you.
It seems to be just depth-first search.
Well, actually it's just a left-hand maze solver. mBlock doesn't support any data structures for its code generation so the the mBot "lives in the moment." ;-)
Mbotu iyi biliyorsan kolay
B.T Mapping çok açıklayıcı be
Umutkaan Özbaş me too
hi, where have you found your maze ?
I made it myself using 4mm foam core board, 3D printed posts, and 1" / 2.5cm black cloth tape
kudas seda programm`i teha?
what does "duration" do?
Do obstacle avoidance with that maze too haha
Hi. I could really use the code to go Arduino starting to see how it works, because I have a practice and do not understand the teacher's explanation. A greeting
great video, do you heard that MakeX competition is using mBot for robotics competition, really excited competition.
I just bought your book. A question to the "solving the maze" problem. Do have to set the room size exactly to 27.94? Or can i use any roomsize an just set it up in the initalize block with my own size?
You should set the room size to match whatever the center-to-center distance is based on the size of the rooms of your maze. My physical maze happened to measure 27.94cm center-to-center. The earlier exercises for measuring movement will prove to be very helpful as well because a lot of the movement really depends on the speed setting.
What his the programme please
Can you please let me know the distance between the tape lines? I am working on building the maze an it would really help
I believe that I had them on 11 inch (27.94cm) centers, i.e., at the intersections. The distance can be whatever you want it to be, but you will need to change the RoomSize variable to accommodate the distance at the speed your mBot is moving.
Hello again :)) can you please also let me have the dimension of the whole maze? i am thinking to make it 150cm x 150cm, with the distance between the lines of 30cm. Please help :))
could you please share me the ebook when its ready please? i have eager students waiting for it
+Fernando Moreno Hi Fernando, the book is ready at leanpub.com/agitr_v1.
hi, ,My english not good.so sorry.Is there maze solving code in this book? would you buy appropriate price please?Already mbot robot is expensive. I' m understandig power of knowledge now . I understand helplessness now.
+seher doğan Yes, the code for the maze solver above is in the book. The book is $17.50 USD with a suggested price of $20.00 USD.
hey sorry to keep asking about this . but what is the status on the ebook. I'm looking forward to buying ;)
+stefan pougatchev No worries, I'm eager to get it published! I've got the PDF version and an ePub version done. I just need to get the .mobi created, followed by assigning ISBNs before I push them to Leanpub. Should be end of week latest barring anything unforeseen. After that I'll be working on getting them on Amazon and Apple (others as I get there) and building the support website.
Are you using line following along with the ultrasonic?
Yes, I wanted to constrain the program to using the stock mBot so the ultrasonic is used to detect walls and the line follower is used to navigate.
First generation mBots didn't have much movement control and their turns lacked precision. The grid of lines in this maze brings them back on track. The new models have encoded motors and gyrosensors which should enable them to solve a maze without guiding lines. Can you confirm this?
Hello again :)) can you please also let me have the dimension of the whole maze? i am thinking to make it 150cm x 150cm, with the distance between the lines of 30cm. Please help :))
Alex, you can make the maze any size that you want to make it. The program doesn't rely on a specific number of "rooms." Mine is 5' x 5' (~152.4 cm). It took three pieces of the foam core board to make the floor, but your mileage may vary depending on how big you want your maze to be.
what did u use to build the labyrinth?
I used 4mm foam core board and 3D printed posts (see the description for the link).
Charles McKnight can you please tell me the distance between the tape lines? I can see they are 90degrees angle, chess table layout, but I would need the distance between them..also if you can tell me the width of the corridor. Thank you!
are your robots fast-paced?
They are not currently fast-paced because the program is more of a proof-of-concept demo. The robot could be speeded up, but several other variables would need to be adjusted to compensate for the increased speed. Due to the motors not being encoded, the distance is calculated based on time and speed so that would be the areas that would need to be tweaked.
Hey, what are the walls made of.
Thanks, Louis
Ignore that it was in the description! Stupid me! Do you know how tall the the board needs to be!
Mine are about 4" tall.
Which board? The foam core is 4mm thick and ~4" tall.
Me gustaría saber el código con el que se ha realizado el video. Muchas gracias.
El código esta aqui (github.com/senestone/A_Gentle_Introduction_To_Robotics_With_mBlock_and_mBot)
Pretending like robot is doing that itself.....but actually he is controling it from another mobile
It's a pity that you chose to make an unfounded accusation because the code for the left-hand maze solver that the mBot is running was published on my GitHub account in 2016 which you would have known if you had bothered to read the description above and followed the link.
@@charlesmcknight7637 ohh i understand....sorry
Hello~ You're amazing. Can you give me the code?
See the description for the GitHub link. FWIW, it's part of an eBook that I wrote to raise funds for kids robotics so I'd appreciate it if you'd consider buying a copy to support the kids. :-)
i am doing this at school it s sooo cool
Can you please send me the program I really need it
The code is on Github (see the link in the description). There is an inexpensive book that I've published (link in the description as well) that goes into the thought process and has several other exercises as well. The proceeds from the book sales are used to fund kids robotics, so please consider buying a copy.
Thanks! :-)
Hi Charles, is the code available?Thank you
+Ivan Hoe Will be later this month. It's part of an ebook I'm writing to support a middle school robotics team. :-)
Cool! Thanks Charles McKnight : )
+Ivan Hoe The book is available as a PDF at leanpub.com/agitr_v1. Enjoy!
Nice thank you for making videos 😁
any updates on the eBook?
+stefan pougatchev I'm content complete, just finishing the final copy editing and preparing for publication in the next week or two. The initial publication will be as a PDF with ePub and .mobi to follow in 2-3 weeks.
+Charles McKnight awesome!! please post a link here when it's ready. cheers
are you using 2 line followers?
because I created a program but it won't turn at intersections
Nope, just one. The mBot pictured is the standard 1.0 kit.
i want to ask what is the program ?? i need the program very much , Pls !!!
hiu ching au yeung its mblock
It's the final program in my eBook, "A Gentle Introduction to Robotics" (leanpub.com/agitr_v1). The source is on Github.
I bought the book and I didn't find the program for this or any working program in it.
Charles McKnight p
It seems to prefer going left versus right. Lol
Well, it *is* a "left-hand wall following algorithm"! ;-)
bj j en est un et c estavec le mode 2 que fait sa c est pas incrioyable c est meme faile feneant
Interesting
I’m doing this in my school if i can’t solve it i will get F :(
hi,thank you very much for code.Your code is good and run.But I can't run stable.it's one run, one don't run.My roomsize variable is 32cm.My cmpersecond variable is 12,5 cm.My black line isn't 1 inc,my black line is 3 cm.my problem my mbot is turning early or my mbot is turning late.how can I fix to problem?
+seher doğan You have a link in your post that is triggering a spam alert on CZcams.
Each mBot is slightly different and the power/time values may vary due to those differences as well as differences in the batteries used. You will need to tweak the values a bit to find the ones that work consistently for your mBot. This is the nature of inexpensive robotics. :-)
There are exercises in the book about robotic movement that you should work through to get the settings for your mBot or moving in straight lines (forward/backward) or turning. You might want to go through those and see if the measurements you get make the mBot move more accurately.
hi,thank you for your answer.Stable it link wrong ,I write wrong word
and I'm so sorry.I used duracell batery and I make a maze. .I think you
use left hand algorithm.I exercised mbot code already.My roomsize is
same length all of them to my maze but mbot return false center of
lines.one is returning true one is returning to a little next .So mbot
don't complete to maze.Which value of variables can I change ?Roomsize
,cmpersecond or speed ?I can send my maze photo if you want to see :).
+seher doğan I would suggest that you troubleshoot the line following if the mBot is having trouble following the lines. If the movement to the center of rooms is not consistent, you will need to tweak the rate (CmPerSec) or the speed until the mBot is consistently moving center-to-center. If you get a copy of the book, you'll get the exercises that allow you to build into doing the maze program. Otherwise, you'll need to do the tweaking of the values and the measurements until the mBot moves consistently.
Façan yansın abi :D
코딩한거 공짜로 주시면 안돼나요?
It's at the Github link in the description.
...
Y el mbot nunca encontro la salida y se murio:v
La salida está marcada por una tarjeta de índice blanca donde se detiene el mBot.
Not bad!
lol
nul menfou
Nice one
I guess I have more subscribers than urs even though my content is not so techy