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
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
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
2 жыл бұрын
lol... this kind small errors happens so often in our programming world while troubleshooting, it is so funny.
I am building an autonomous mower and your video has helped me tremendously. Thank you!
This content should be much more watched on KZread. Sometimes even better than the content of the 'big' robotic chanels. Great work 👍
@CodingCoach
3 жыл бұрын
Glad you enjoy it!
most under rated channel on KZread regarding electronic stuff. Highly appreciate your work!!!!
@CodingCoach
2 жыл бұрын
Thanks!
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!
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
3 жыл бұрын
You are welcome!
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.
Thank you so much
this pokemon (kindaa) music hooked me as well as explanation ofcourse :)
Buen video, gracias por la explicación 🦾
@CodingCoach
3 жыл бұрын
you are welcome!
Great video!
@CodingCoach
3 жыл бұрын
Thanks! Happy New Year, hope all is well!
@djzatka
Жыл бұрын
@@CodingCoach waiting foe new videos😊
thank you so much sir.
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.
I try to add the time of flight sensor opt3101, thanks for your example, lets see what i'll come up with :)
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.
do you have a video on waypoint finding?
how to do the getcountsandreset(); for an individual arduino with motos with free encoders..!
Nice video!! But why did you stopped uploading new videos?
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
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
2 жыл бұрын
@@CodingCoach Thanks ! I think i got it
awesome video please start series with raspberry Pi
@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
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.
It is cool robot
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
11 ай бұрын
You could use predefined coordinate for each room as an address for the robot
Please make the same project in arduino
still works even using Pololu 3pi? Not with a plus (+) variant?
@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.
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
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
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
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
3 жыл бұрын
@@codecage9333 you got it!
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
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!
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
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
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
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
3 жыл бұрын
great work!
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