mBot Solving a Maze

Sdílet
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.

Komentáře • 110

  • @r.swallow4934
    @r.swallow4934 Před rokem +1

    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.

  • @k3nd0ll1
    @k3nd0ll1 Před 5 lety +4

    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 :)

    • @charlesmcknight7637
      @charlesmcknight7637 Před 5 lety

      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. :-)

  • @THEbonny95
    @THEbonny95 Před 7 měsíci

    Hi. Can you say exactly what size the cells were? Or at least the length of the wall.

  • @charlesmcknight2237
    @charlesmcknight2237  Před 8 lety +4

    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.

    • @melindaelliott9347
      @melindaelliott9347 Před 8 lety

      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.

    • @melindaelliott9347
      @melindaelliott9347 Před 8 lety

      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?

    • @charlesmcknight2237
      @charlesmcknight2237  Před 8 lety

      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.

    • @charlesmcknight2237
      @charlesmcknight2237  Před 8 lety +1

      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

    • @melindaelliott9347
      @melindaelliott9347 Před 8 lety

      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.

  • @kattafps
    @kattafps Před 6 lety

    I'm reading ur book and practicing the projects I'm learning a lot.

  • @Lugeix
    @Lugeix Před rokem

    Q-Learning algorithm covered in the book with example?

  • @rozemarijn9607
    @rozemarijn9607 Před 5 lety +3

    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.

    • @charlesmcknight7637
      @charlesmcknight7637 Před 5 lety

      It's the length and the width of a room and is used to calculate the distance to move between room centers.

  • @blackthorn7335
    @blackthorn7335 Před 7 lety +7

    Can you give codes ?I realy need it.Thank you.

    • @davidjennings4896
      @davidjennings4896 Před 7 lety

      It seems to be just depth-first search.

    • @charlesmcknight7637
      @charlesmcknight7637 Před 7 lety

      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." ;-)

    • @borantn
      @borantn Před 6 lety +1

      Mbotu iyi biliyorsan kolay

    • @MrHakanYT
      @MrHakanYT Před 6 lety +1

      B.T Mapping çok açıklayıcı be

    • @mindpsycho7158
      @mindpsycho7158 Před 6 lety +1

      Umutkaan Özbaş me too

  • @Krabouif
    @Krabouif Před 7 lety +2

    hi, where have you found your maze ?

    • @charlesmcknight2237
      @charlesmcknight2237  Před 7 lety

      I made it myself using 4mm foam core board, 3D printed posts, and 1" / 2.5cm black cloth tape

  • @veskimae
    @veskimae Před 6 lety +1

    kudas seda programm`i teha?

  • @kadentan6857
    @kadentan6857 Před 3 lety

    what does "duration" do?

  • @Tetra3Ne56scur
    @Tetra3Ne56scur Před 4 lety

    Do obstacle avoidance with that maze too haha

  • @jesuspl13
    @jesuspl13 Před 8 lety +1

    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

  • @davidpeng9196
    @davidpeng9196 Před 3 lety

    great video, do you heard that MakeX competition is using mBot for robotics competition, really excited competition.

  • @rentseakhcire
    @rentseakhcire Před 7 lety

    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?

    • @charlesmcknight2237
      @charlesmcknight2237  Před 7 lety

      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.

  • @clementsavigny8281
    @clementsavigny8281 Před 5 lety

    What his the programme please

  • @unified95
    @unified95 Před 6 lety

    Can you please let me know the distance between the tape lines? I am working on building the maze an it would really help

    • @charlesmcknight2237
      @charlesmcknight2237  Před 6 lety +1

      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.

    • @unified95
      @unified95 Před 6 lety

      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 :))

  • @fernandomoreno9223
    @fernandomoreno9223 Před 8 lety

    could you please share me the ebook when its ready please? i have eager students waiting for it

    • @charlesmcknight2237
      @charlesmcknight2237  Před 8 lety

      +Fernando Moreno Hi Fernando, the book is ready at leanpub.com/agitr_v1.

  • @esmadogan7202
    @esmadogan7202 Před 8 lety

    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.

    • @charlesmcknight2237
      @charlesmcknight2237  Před 8 lety

      +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.

  • @spougatc1
    @spougatc1 Před 8 lety

    hey sorry to keep asking about this . but what is the status on the ebook. I'm looking forward to buying ;)

    • @charlesmcknight2237
      @charlesmcknight2237  Před 8 lety

      +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.

  • @Phoenix540
    @Phoenix540 Před 4 lety

    Are you using line following along with the ultrasonic?

    • @charlesmcknight7637
      @charlesmcknight7637 Před 4 lety

      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.

    • @wolfgangr.3268
      @wolfgangr.3268 Před 2 lety

      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?

  • @unified95
    @unified95 Před 6 lety

    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 :))

    • @charlesmcknight2237
      @charlesmcknight2237  Před 6 lety

      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.

  • @unified95
    @unified95 Před 6 lety

    what did u use to build the labyrinth?

    • @charlesmcknight2237
      @charlesmcknight2237  Před 6 lety

      I used 4mm foam core board and 3D printed posts (see the description for the link).

    • @unified95
      @unified95 Před 6 lety

      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!

  • @blackhat580
    @blackhat580 Před 6 lety

    are your robots fast-paced?

    • @charlesmcknight2237
      @charlesmcknight2237  Před 6 lety

      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.

  • @louisparkerson6485
    @louisparkerson6485 Před 7 lety +3

    Hey, what are the walls made of.
    Thanks, Louis

  • @NuRiieTaa5
    @NuRiieTaa5 Před 6 lety

    Me gustaría saber el código con el que se ha realizado el video. Muchas gracias.

    • @charlesmcknight2237
      @charlesmcknight2237  Před 6 lety

      El código esta aqui (github.com/senestone/A_Gentle_Introduction_To_Robotics_With_mBlock_and_mBot)

  • @YTANIRUDH
    @YTANIRUDH Před 4 lety

    Pretending like robot is doing that itself.....but actually he is controling it from another mobile

    • @charlesmcknight7637
      @charlesmcknight7637 Před 4 lety +1

      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.

    • @YTANIRUDH
      @YTANIRUDH Před 4 lety

      @@charlesmcknight7637 ohh i understand....sorry

  • @user-be9wn8xv5m
    @user-be9wn8xv5m Před 5 lety +2

    Hello~ You're amazing. Can you give me the code?

    • @charlesmcknight2237
      @charlesmcknight2237  Před 5 lety +1

      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. :-)

  • @petargacic4299
    @petargacic4299 Před 7 lety

    i am doing this at school it s sooo cool

  • @janithfernando3202
    @janithfernando3202 Před 7 lety

    Can you please send me the program I really need it

    • @charlesmcknight2237
      @charlesmcknight2237  Před 7 lety

      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! :-)

  • @IvanHoeEeWu
    @IvanHoeEeWu Před 8 lety

    Hi Charles, is the code available?Thank you

    • @charlesmcknight2237
      @charlesmcknight2237  Před 8 lety +2

      +Ivan Hoe Will be later this month. It's part of an ebook I'm writing to support a middle school robotics team. :-)

    • @IvanHoeEeWu
      @IvanHoeEeWu Před 8 lety

      Cool! Thanks Charles McKnight : )

    • @charlesmcknight2237
      @charlesmcknight2237  Před 8 lety

      +Ivan Hoe The book is available as a PDF at leanpub.com/agitr_v1. Enjoy!

  • @potatisha900
    @potatisha900 Před 5 lety

    Nice thank you for making videos 😁

  • @spougatc1
    @spougatc1 Před 8 lety

    any updates on the eBook?

    • @charlesmcknight2237
      @charlesmcknight2237  Před 8 lety +1

      +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.

    • @spougatc1
      @spougatc1 Před 8 lety

      +Charles McKnight awesome!! please post a link here when it's ready. cheers

  • @janithfernando3202
    @janithfernando3202 Před 7 lety

    are you using 2 line followers?

  • @abbyabau7849
    @abbyabau7849 Před 7 lety +1

    i want to ask what is the program ?? i need the program very much , Pls !!!

  • @ratrod67
    @ratrod67 Před 5 lety

    It seems to prefer going left versus right. Lol

  • @timotheeduchesne3741
    @timotheeduchesne3741 Před 7 lety

    bj j en est un et c estavec le mode 2 que fait sa c est pas incrioyable c est meme faile feneant

  • @diegogordon2291
    @diegogordon2291 Před 3 lety

    Interesting

  • @tossvzz
    @tossvzz Před 3 lety

    I’m doing this in my school if i can’t solve it i will get F :(

  • @esmadogan7202
    @esmadogan7202 Před 8 lety

    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?

    • @charlesmcknight2237
      @charlesmcknight2237  Před 8 lety

      +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.

    • @esmadogan7202
      @esmadogan7202 Před 8 lety

      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 :).

    • @charlesmcknight2237
      @charlesmcknight2237  Před 8 lety

      +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.

    • @blackthorn7335
      @blackthorn7335 Před 7 lety

      Façan yansın abi :D

  • @user-tl6bw6dk4n
    @user-tl6bw6dk4n Před 5 lety

    코딩한거 공짜로 주시면 안돼나요?

  • @ccyctm
    @ccyctm Před 6 lety

    ...

  • @juanmanuelcabrera1237
    @juanmanuelcabrera1237 Před 5 lety

    Y el mbot nunca encontro la salida y se murio:v

    • @charlesmcknight2237
      @charlesmcknight2237  Před 5 lety

      La salida está marcada por una tarjeta de índice blanca donde se detiene el mBot.

  • @ccyctm
    @ccyctm Před 6 lety

    Not bad!

  • @wolfieplayzrblx5857
    @wolfieplayzrblx5857 Před 5 lety

    lol

  • @MartinKivits-lx8so
    @MartinKivits-lx8so Před 4 lety

    nul menfou

  • @MakeItFlyofficial
    @MakeItFlyofficial Před 2 lety

    Nice one
    I guess I have more subscribers than urs even though my content is not so techy