Robotics Programming: Building an Autonomous Mobile Robot | Arduino Lab Series

This is the first lab video in my hands on beginners robotics course. Throughout this series we will be introducing topics on building and programming an autonomous mobile robot! You can follow along with each lab adding amazing new behaviors to you robot projects and learning the algorithms and tuning techniques that produce incredible robots! We will be exploring reactive algorithms such as PID, Potential Fields and A*. Along the way you will learn how to program behaviors such as object following, wall following, standing / balancing, go-to goal and object avoidance. This series is intended to allow you to follow along with your own robot.
Code access: Direct access to source code and additional resources are available by becoming a Coding Coach supporter. You can join and learn more here: codingcoach.net/sponsor . You may also copy the code from the video as you follow along.
The next video in this series: • Robotics Programming: ...
Playlist of the full series: • Robotics Programming Labs
Video that discusses the future direction of the series: • Robotics Programming: ...
There are many different robots you can use, but I will be using an Arduino based Pololu 3pi+ which you can purchase and use follow along.
Please note @ 37:27 WHEEL_CIRCUMFERENCE should be a float, not an int! as an integer it is loosing the decimal (.05) this error will become apparent as the distance the robot travels grows!
Chapters:
00:00 Introduction
1:20 Lab Series Introduction
1:40 Topic Overview
2:11 Requirements for our Robot
2:52 Robot Hardware / Required Sensor Discussion
7:24 Review of common Robotic Platforms
10:38 Hardware Review of the Pololu 3pi+
14:22 Development Environment Setup
17:36 1st Program - Move Forward!
25:27 2nd Program - Wheel Encoders
36:50 3rd Program - Distance in Centimeters
40:59 4th Program - Move 1 foot!
43:29 Robot Dynamics and Tuning
50:12 Success!
50:41 Conclusion
#codingcoach #arduinorobot #roboticsprogramming
Pololu 3pi+: www.pololu.com/category/280/3...
Other robots, batteries and tools (Amazon Affiliate links)
Elegoo Smart Car: amzn.to/3iG3uFO
Robot car chassis (with encoder cutout): amzn.to/3odlacY
Pololu Zumo: amzn.to/39TbaAC
Batteries:
EBL Rechargeable batteries: amzn.to/3pdiM7A
Micrometer Caliper Measuring Tool (To measure wheel diameter): amzn.to/3sQ0BqB

Пікірлер: 52

  • @MartinL7012
    @MartinL70123 жыл бұрын

    Very nice tutorial. I would like to make just one comment, on the line const int WHEEL_CIRCUMFERENCE = 10.0531 should probably be correct const float WHEEL_CIRCUMFERENCE = 10.0531

  • @CodingCoach

    @CodingCoach

    3 жыл бұрын

    I can't believe i missed that! Thank you! It is chopping off the .05 with the int type which will become noticeable the longer the robot travels. No idea why I typed int there.

  • @gab882

    @gab882

    2 жыл бұрын

    lol... this kind small errors happens so often in our programming world while troubleshooting, it is so funny.

  • @eclecticlife
    @eclecticlife2 жыл бұрын

    I am building an autonomous mower and your video has helped me tremendously. Thank you!

  • @someDude809
    @someDude8093 жыл бұрын

    This content should be much more watched on KZread. Sometimes even better than the content of the 'big' robotic chanels. Great work 👍

  • @CodingCoach

    @CodingCoach

    3 жыл бұрын

    Glad you enjoy it!

  • @pranshuraj3801
    @pranshuraj38012 жыл бұрын

    most under rated channel on KZread regarding electronic stuff. Highly appreciate your work!!!!

  • @CodingCoach

    @CodingCoach

    2 жыл бұрын

    Thanks!

  • @stevephillips5392
    @stevephillips5392 Жыл бұрын

    Best explanation I have found to date on using encoders to control (fairly) precise navigation. Since I am new the fact that you explain everything in detail is helpful. Your explanation around avoiding an additional 'while loop' to determine the stopping point was instructive. I am looking forward to the remaining videos in the series. Many thanks!

  • @PaulReedmanreedmanit
    @PaulReedmanreedmanit3 жыл бұрын

    This is an exceptionally good tutorial on robot programming. Thank you. I will be watching more as I have purchased the robot you show in your video.

  • @CodingCoach

    @CodingCoach

    3 жыл бұрын

    You are welcome!

  • @MrStrangerr2002
    @MrStrangerr2002 Жыл бұрын

    Thank you for your time n efforts! I was looking for gradual increase/decrease in motor speed for an input trigger which your video covered.

  • @AmitsLife
    @AmitsLife Жыл бұрын

    Thank you so much

  • @sky-jx1rk
    @sky-jx1rk9 ай бұрын

    this pokemon (kindaa) music hooked me as well as explanation ofcourse :)

  • @MakingRoboticsColombia
    @MakingRoboticsColombia3 жыл бұрын

    Buen video, gracias por la explicación 🦾

  • @CodingCoach

    @CodingCoach

    3 жыл бұрын

    you are welcome!

  • @alekspavlinik2240
    @alekspavlinik22403 жыл бұрын

    Great video!

  • @CodingCoach

    @CodingCoach

    3 жыл бұрын

    Thanks! Happy New Year, hope all is well!

  • @djzatka

    @djzatka

    Жыл бұрын

    ​@@CodingCoach waiting foe new videos😊

  • @25.muhammadhilmihaidary60
    @25.muhammadhilmihaidary609 ай бұрын

    thank you so much sir.

  • @DaveScottADV
    @DaveScottADV Жыл бұрын

    Great video so far. Just one thing to note: your robots shown at the 3:00-4:00 mark aren't holonomic. Skid/tank steer is still considered nonholonomic.

  • @troublehd7236
    @troublehd72363 ай бұрын

    I try to add the time of flight sensor opt3101, thanks for your example, lets see what i'll come up with :)

  • @sposhto6325
    @sposhto6325 Жыл бұрын

    I might be very late to get an answer but how to know the tick per rotation of the motor?? I am not using Pololu product but an offbrand N20 with a magnetic encoder.

  • @study_sounds1113
    @study_sounds11132 жыл бұрын

    do you have a video on waypoint finding?

  • @jaywardhan9663
    @jaywardhan9663 Жыл бұрын

    how to do the getcountsandreset(); for an individual arduino with motos with free encoders..!

  • @djzatka
    @djzatka Жыл бұрын

    Nice video!! But why did you stopped uploading new videos?

  • @BennyBern
    @BennyBern2 жыл бұрын

    Hi Great video! Thanks a lot. I have a question, how the robot knows to stop exactly on the blue sticker on the floor? Is this a RFID sensor? Color sensor? Or are you using some kind of geo-localization? I would really appreciate your help. Thanks

  • @CodingCoach

    @CodingCoach

    2 жыл бұрын

    wheel odometry.. The robot has a goal location in x,y space, say 100, 100 and starts at a location like 0,0 with a starting angle say 0. From there It is all math. The feedback loop is the amount of rotation of the wheels.

  • @BennyBern

    @BennyBern

    2 жыл бұрын

    @@CodingCoach Thanks ! I think i got it

  • @vikassinha9557
    @vikassinha95573 жыл бұрын

    awesome video please start series with raspberry Pi

  • @CodingCoach

    @CodingCoach

    3 жыл бұрын

    That is a great idea for the next robotics series. remember that if you want to try this on a raspberry pi you would only have to simply convert the algorithms to Python or whatever programming language you're using from C. The math is all the same.

  • @vikassinha9557

    @vikassinha9557

    3 жыл бұрын

    @@CodingCoach I have subscribed your channel hopeing for long learning series with you. your way of teaching is awesome please make a series of this.

  • @alancurtis-engineeringdiym5872
    @alancurtis-engineeringdiym58722 жыл бұрын

    It is cool robot

  • @venusgutierrez1655
    @venusgutierrez16552 жыл бұрын

    Hi Sir! I would like to ask if what sensor will be use in order to move in different direction such us in hospital. There will be a button or a remote that dictates where the robot will go. For example, I click on room number 101, how will the robot detects a room and deliver the food inside of it(room). First we will use the line follower robot then we don't have an idea on how the robot will go inside the room because of the different direction. Thank you in advance Coach

  • @umar6ma_tik725

    @umar6ma_tik725

    11 ай бұрын

    You could use predefined coordinate for each room as an address for the robot

  • @MuhammadHamza-ki3ze
    @MuhammadHamza-ki3ze Жыл бұрын

    Please make the same project in arduino

  • @noa7784
    @noa77843 жыл бұрын

    still works even using Pololu 3pi? Not with a plus (+) variant?

  • @CodingCoach

    @CodingCoach

    3 жыл бұрын

    The environment's the same they both use similar Arduino based processors. The big difference though is that the 3pi does not have wheel encoders. And I use them extensively.. The zumo is another good option and I believe that one has wheel encoders.

  • @codecage9333
    @codecage93333 жыл бұрын

    You mention the number of clicks per one revolution of the motor shaft, but I lost you on how to figure what number was needed for the Turtle or Hyper Edition! And even how you got 12 for the Standard Edition. How did you come up with these numbers?

  • @CodingCoach

    @CodingCoach

    3 жыл бұрын

    Good question! Starting here: www.pololu.com/docs/0J83/5.4 "he encoders provide a resolution of 12 counts per revolution of the motor shaft when counting both edges of both channels. To compute the counts per revolution of the wheels, multiply the gearboxes’ gear ratios by 12. For example, if 30:1 motors (which have gear ratios more accurately specified as 29.86:1) are used, the encoders provide 29.86 × 12 ≈ 358.3 CPR. The exact gear ratios of our Micro Metal Gearmotors are specified on their product pages." The product pages for the motors on the standard edition (30:1): www.pololu.com/product/2364 "This gearmotor is a miniature medium-power, 6 V brushed DC motor with a 29.86:1 metal gearbox" and the turtle edition (75:1): www.pololu.com/product/2366 "This gearmotor is a miniature medium-power, 6 V brushed DC motor with a 75.81:1 metal gearbox" Note, i did not include the hyper edition here, but if you have it just look up the 15:1 ratio motor 6v

  • @codecage9333

    @codecage9333

    3 жыл бұрын

    @@CodingCoach I guess my real question was about the number "12." Is that a fixed number for all motors? A comment, or a way you made reference to CLICK_PER_ROTATION, gave me the impression that this number might be different for different editions of the 3Pi+. But I saw no way to derive a different number. Is that number based on the encoder itself and remains the same for all editions. Thanks for the quick reply by the way!

  • @codecage9333

    @codecage9333

    3 жыл бұрын

    @@CodingCoach Well the answer was staring me in the face the whole time! "The encoders provide a resolution of 12 counts per revolution of the motor shaft..." The encoders refer to the encoder used and have nothing to do with the motors themselves! Blind in one eye and can't see out of the other!

  • @CodingCoach

    @CodingCoach

    3 жыл бұрын

    @@codecage9333 you got it!

  • @vikassinha9557
    @vikassinha95573 жыл бұрын

    please create more video on this series without use of pololo robot just simple robot with bldc motor rotary encoder and ultrasonic sensor with servo pololo is costly and most of us are not having it that's why at a cheaper rate please try same video with bldc motor and ultrasonic sensor with servo

  • @CodingCoach

    @CodingCoach

    3 жыл бұрын

    That is a good idea, I know that many enjoy building the robot. I have this video on the assembly of the elegoo smart car: kzread.info/dash/bejne/Z3eCzKeSYK-pp6Q.html but the fact it has 4 wheels does not make it a good candidate even if you add encoders. When I am done with the initial series I will do a video on the $15 2 wheeled chassis I showed in the video with the elegoo parts on it and the encoders. As I mentioned in the video remember you can use any similar robot for this series it does not have to be the pololu. The algorithms discussed will be the same any the tuning of the robot will be different. Thank you for the feedback!

  • @briancoppola7317
    @briancoppola73173 жыл бұрын

    I'm running into an error. I followed the entire video and I got everything to work, but in the end, I unplugged the USB from my robot because I wanted it to run without being tethered to the computer. When I unplugged I received this error: avrdude: ser_open(): can't set com-state for "\\.\COM3" An error occurred while uploading the sketch Error while setting serial port parameters: 57,600 N 8 1 It's not recognizing the port I plugged into anymore. I tried to run the same code again on a different file, but I still ran into the same error. Any advice on how to go about fixing this?

  • @CodingCoach

    @CodingCoach

    3 жыл бұрын

    1. In Arduino studio, sure to double check tools -> board and make sure it is set to "Pololu A-Star 32u4" and also tools -> port and make sure you select the correct one. Also it never hurts to reboot your computer and start fresh. 2. If that does not work, try opening an example sketch (like blink) and see if you can flash that. 3. If none of that works, let me know you might have to reset the bootloader see : www.pololu.com/docs/0J83/10.1

  • @briancoppola7317

    @briancoppola7317

    3 жыл бұрын

    @@CodingCoach All the settings I have match up with what you stated above and I received the same error again when I ran the blink program.

  • @briancoppola7317

    @briancoppola7317

    3 жыл бұрын

    @@CodingCoach I just finished going through the uploading-before-bootloader method from Pololu and I got everything back to normal! Thank you for the assistance. I'm looking forward to the upcoming semester!

  • @CodingCoach

    @CodingCoach

    3 жыл бұрын

    great work!

  • @GetRealwithMike
    @GetRealwithMike Жыл бұрын

    I want to build a robot that will chase my cat by sensing him but it won't hit him. It retreats when he approaches it and it plays sounds of a cat meowing. Infact, it can follow me around too just like he does. We had to move into an apartment and gave up his brother and sister that he played with. Now he's getting fat and lonely. I thought building him a companion would be perfect for him and I get to learn how to build a robot - something I always wanted to do. I'm 63, teach middle school and needed a hobby to destress after working with screaming kids all day. Can you help me out with this? Thanks, Mike