In today’s webots tutorial video, we are doing a fun project of line follower robot. A line following robot is a great way to get started with robotics and only requires level 1 coding skills.
We will start by setting up our environment in webots. Next we will add a robot from the webots library which is e puck and add IR sensors. Then we will write our code which is controller in webots in python. I will go over how to detect the line using IR sensors and use those values to make a line following robot in Webots.
========== TIMINGS ==========
0:00 Intro
0:54 Set up the environment
1:12 Add e-puck robot
1:40 Adding IR sensors
3:26 Adding Line (Track)
4:55 Writing controller (Python)
6:04 How IR sensors work?
6:40 Reading IR values
7:50 Line follower robot
9:27 Common problems with line follower
If you enjoyed this video, give it a like and tell me your thoughts in the comment below.
========== USEFUL RESOURCES ==========
๐ Link to download track one (proto node)
https://github.com/KajalGada/Youtube-Tutorial-Download-Material/tree/main/Line%20Follower%20Webots%20Tutorial
๐ Track one was created from CAD model by DragerDG Robotics. Link to youtube channel:
https://www.youtube.com/user/DrakerDG/videos
๐ List of functions available inside controller in Webots for Python:
https://cyberbotics.com/doc/reference/robot?tab-language=python#wb_robot_get_device
๐ Information about distance and infra-red (IR) sensors in Webots:
https://cyberbotics.com/doc/reference/distancesensor
๐ Catch the entire webots tutorial video series here:
๐ How to write a controller in Webots in Python to enable motors and drive a differential drive robot?
๐ How to drive (straight, turn in place, wide turn) differential drive robot in Webots?
========== RELATED VIDEOS ==========
๐ Webots Line Follower Code in C++ // Webots Tutorial
๐ Webots Tutorial Series in Python // Get started with Robotics using Webots
๐ Webots Tutorial Project Wall follower robot using e-puck // Controller code in Python
๐ Webots ROS2 Tutorial
========== CONNECT WITH ME ==========
๐ If you have a question or doubt about this video, use the comment section.
๐ If you have questions about Robotics, job search, Webots, etc, read this on
how to contact me: https://kgada.info/contact/
My social media links:
๐ LinkedIn: https://www.linkedin.com/in/kajalgada/
๐ Instagram: https://www.instagram.com/kajalgada/
๐ Facebook page: https://www.facebook.com/Kajal-Gada-Youtuber-112066216999576/
๐ For more on studying robotics and working in the USA, join our facebook community: https://www.facebook.com/groups/roboticsinusa/
========== ABOUT ME ==========
I am a Robotics Engineer. My goal is to develop algorithms for realizing robot operations in the real world. And it is just absolute fun to code and solve problems. Read more about my projects work at https://kgada.info/
I started my journey in Robotics by working on small personal projects such as a line follower with an arduino. I then pursued and graduated with a Masters in Robotics from University of Maryland in 2017.
After graduation, I have worked at Reality AI, Qualcomm and Brain Corp. With 3 years of professional experience, I understand that one of the biggest challenge in Robotics is implementation of algorithms in the real world and that is where my expertise are. Digging in at ground zero to implement solutions.
I spoke about my experience as a roboticist at Brain Corp on the RoboHub podcast, check it out here: https://robohub.org/commercializing-robot-brains/
I am also a YouTuber, it is my way of giving back and helping the community grow. As a women and an international student in the US, I am aware of the challenges to break through and have a successful career. I share my insights and also teach robotics through my youtube channel.
Subscribe to my youtube channel: http://youtube.com/kajalgada?sub_confirmation=1
========== Gear I usually use ==========
๐ Camera: YI 4K Action and Sports Camera
๐ Camera: iPhone XS
๐ Tripod: Ravelli APLT6M 72″ Light Weight Aluminum Tripod
๐ Lights: Neewer Ring Light Kit
๐ Mic: SoLID Lavalier Lapel Microphone
๐ Recording: Voice Memo App on iPhone or Mac
๐ Editing Software: Final Cut Pro X
๐ Thumbnail Designs: Canva
========== Credits ==========
๐ Like & subscribe short clip in the end:
, https://i.ytimg.com/vi/D0jhvFZJ5Ok/hqdefault.jpg
source
Excelent! Congratulations ๐๐๐ผ
Thanks for this great tutorial, you have a nice hearing voice ๐
muchas gracias, excelents.
Hi. Could you make a video of how to capture the robot's position?
Hugs.
the same project while I'm doing and running, facing indentation errors ma'am. The same program only I'm typing. Then how ma'am? @kajalgada ma'am. facing problems in lines 21 and 34
@Kajal Gada – Very good explanation of concepts. Can you share the final controller code? or webots project files?
Hi, I have downloaded a world that contains an e-punk, but its controller is .c. How do I change it to Python?
Sensors are not detecting the path ma'am what to do?
maam can you please share the python code
Can someone plz tell me what are them number in 8:57
How do u write that in c
Thanks
Great vid btw
What would happen if use this code for the 2 wheel differential drive robot? Will it work?
Hi kadjal, did you ever try to transfer code from webot to real epuck cause I'm having communication problem
could you please share the code link here
I followed the tutorial but my robot doesn't follow the line instead it goes straight (I imported my own track from thinkercad) don't know if that effects it. Please help
INFO: my_controller: Starting controller: python -u my_controller.py
File "my_controller.py", line 27
left_speed = max_speed
^
SyntaxError: invalid syntax
WARNING: 'my_controller' controller exited with status: 1.
I am getting this?
How to make tracked robots in webots ? Please help me…
Can we calculate the length of the boundary pls help
Hi, anyone knows how to make your robot go to one point to another. I've been trying a lot of things but can't do it. There isn't much tutorials of webots on the internet so there isn't much i can do. If anyone knows, if they can help me pls ๐
i have tried implementing your tutorial in webots but both my infrared sensors are showing the exact same value and it does not follow th liner can you help
I want all the files
what is 6 and 15 in line 38 and 41?
this is excellent tool and nice explanation, I am in search of any such tool thanks for sharing..
Thx for sharing. but I have some problem about syntax error. The console says me (left_speed = max_speed * 0.25
^
SyntaxError: invalid syntax)
this error. I wrote same code as you. Can you help me?
sis, if you can please make a video on PID line following
If obstacle are there , how to do the controller for the robot to detect the obstacle and get back to the line again?
How can we get the robots position and orientation directly and then set some coordinate (x,y,theta) so that our robot moves towards that coordinate directly instead of setting speed.
Where is the error?
left_ir_value = left_ir.getValue()
^
IndentationError: expected an indented block
WARNING: 'my_controller_line_follower' controller exited with status: 1.
python code:
while robot.step(time_step) != -1:
left_ir_value = left_ir.getValue()
right_ir_value = right_ir.getValue()
Hello, when I download the track, it downloads as a text file so I cannot open it on webots. What can I do?
Thank you very much, very helpful video!
Thx for sharing. Would be great to add also obstacles so that robot avoid them and get back to the line.
Hi Mam, another very helpful tutorial!
At 8:02, you have reset the simulation, however when I do so, e puck and track disappears from the simulation, what can be the reason?
how to download the track
how can we add a custom path to the simulation?
Traceback (most recent call last):
File "controller_linefollower.py", line 5, in <module>
from controller import Robot
File "D:Webotslibcontrollerpython37controller.py", line 31, in <module>
import _controller
ImportError: DLL load failed: The specified module could not be found.
WARNING: 'controller_linefollower' controller exited with status: 1.
im getting this error. please help
Thank you for the video. It was very helpful. How can you make the robot do a U turn?