Тёмный

Simulating an Obstacle Avoidance Robot Using Python | From Scratch 

Mouad Boumediene - Hobby Coding
Подписаться 86 тыс.
Просмотров 34 тыс.
50% 1

Опубликовано:

 

27 окт 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 34   
@hobby_coding
@hobby_coding 2 года назад
i hope you enjoyed this , don't forget to leave a like if you did. 😊😊 🗃️ source code : ko-fi.com/s/1a38e1563b
@hobby_coding
@hobby_coding 2 года назад
@@sharefyusuf5769 in the discription box
@akashbhagabati5519
@akashbhagabati5519 Год назад
i am getting an error at the main file. in the line " if event.type == pygame.QUIT():" the error is shown that "int' object is not callable. I have checked for any typing errors but there are not any. Please help
@thePavuk
@thePavuk 2 месяца назад
Real Ultrasonics sensors has few additional parameters 1) typical sampling frequency is 50Hz so they won't update in real time. If robot moves with speed 1m/s toward wall, it moves 2cm before update. It's even more significant during rotation. 2) ultasonic sensors has high noise. Usually +/- 2cm for cheap one with 250cm range. 3) They can have issue... Same model of US usually works on same frequency = you has to trigger sensors one by one because they interfere with each other.
@alanperez7551
@alanperez7551 7 месяцев назад
If you did all right and still having and error try this: "File" -> "Invalidate Caches / Restart" -> "Invalidate and Restart". This restart the old cache and validates the added modules like: import pygame etc...
@tomersidis1225
@tomersidis1225 2 года назад
Nice work! Your tutorial is informative and creates an easy to follow simulation of using an ultrasonic sensor for obstacle avoidance. It would be excellent if you could extend this tutorial and expand on sensor based motion planning, such as by combining this simulation with your RRT tutorial.
@hobby_coding
@hobby_coding 2 года назад
sure, nice idea.
@profmoek7813
@profmoek7813 2 года назад
@@hobby_coding thanks for the great tutorials on SLAM. I HAVE SO MANY unanswered questions about kahman filter. Please can you 🙏 make tutorial on that
@senaysew8231
@senaysew8231 2 года назад
Man, you forgot uploading the 2nd part of lane detection. Have been waiting for 5 months 😂😂😂👍🤐
@profmoek7813
@profmoek7813 2 года назад
Thanks alot sir for the information. I learnt a lot from the SLAM Lecture series. Please you indicated as part of the series extended kalman filter. Please I have been waiting for that tutorial. I really need to see your perspective and implementation of the filter as I have so many unanswered questions, which I hope I will get the answers from the tutorial. Thanks for the great video. They really changed my perspective of what I thought I knew before
@simplymohan
@simplymohan Год назад
Nice tutorial
@raginigupta4857
@raginigupta4857 3 месяца назад
ROBOT.py----> import pygame import math import numpy as np def distance(point1,point2): point1 = np.array(point1) point2 = np.array(point2) return np.linalg.norm(point1- point2) class Robot: def __init__(self, startpos,width): self.m2p= 3779.52 #from meters to pixels #robot dims self.w = width self.x= startpos[0] self.y = startpos[1] self.heading =0 self.vl = 0.01*self.m2p #meters/s self.vr = 0.01*self.m2p self.maxspeed = 0.02*self.m2p self.minspeed = 0.01*self.m2p self.min_obs_dist = 100 self.count_down = 5 #seconds def avoid_obstacle(self,point_cloud,dt): closest_obs = None dist = np.inf if len(point_cloud) > 1: for point in point_cloud: if dist > distance([self.x, self.y], point): dist = distance([self.x,self.y], point) closest_obs = (point,dist) if closest_obs[1] < self.min_obs_dist and self.count_down > 0: self.count_down -= dt self.move_backward() else: #reset count down self.count_down = 5 #move forward self.move_forward() def move_backward(self): self.vr = - self.minspeed self.vl = - self.minspeed/2 def move_forward(self): self.vr = self.minspeed self.vl = self.minspeed def kinematics(self, dt): self.x += ((self.vl+self.vr)/2) * math.cos(self.heading) * dt self.y -= ((self.vl+self.vr)/2) * math.sin(self.heading) * dt self.heading += (self.vr - self.vl) / self.w * dt if self.heading>2*math.pi or self.heading import math import pygame from ROBOT import Graphics, Robot, Ultrasonic MAP_DIMENSIONS = (600, 1200) #the environment graphics gfx = Graphics(MAP_DIMENSIONS, 'D:\college\internship\INTERNSHIP TASK\obstacle detection\images\DDR.png', 'D:\college\internship\INTERNSHIP TASK\obstacle detection\images\Obstacle.png') #the robot start = (200, 200) robot = Robot(start, 0.01*3779.52) #the sensor sensor_range = 250, math.radians(40) ultra_sonic = Ultrasonic(sensor_range, gfx.map) dt=0 last_time = pygame.time.get_ticks() running = True #simulation loop while running: for event in pygame.event.get(): if event.type == pygame.QUIT: running = False dt= (pygame.time.get_ticks()-last_time)/1000 last_time = pygame.time.get_ticks() gfx.map.blit(gfx.map_img, (0,0)) robot.kinematics(dt) gfx.draw_robot(robot.x, robot.y, robot.heading) point_cloud = ultra_sonic.sense_obstacles(robot.x, robot.y, robot.heading) robot.avoid_obstacles(point_cloud, dt) gfx.draw_sensor_data(point_cloud) pygame.display.update THANK ME LATER😌
@blackwidow8447
@blackwidow8447 2 года назад
Hey, I replicated the whole code, fixed all the errors, but somehow my robot keeps moving in circles, without sensing any obstacles, or moving in any direction :/
@kabiratolayemi7570
@kabiratolayemi7570 Год назад
Hi. I followed the code but encountered this error: Graphics() takes no arguments. Any help
@manishsaini2172
@manishsaini2172 2 года назад
Robot's ultrasonic sensor is rotating the opposite direction when robot takes turn. For instance, for the first obstacle (first wall), robot turns around 90 degree clockwise but ultrasonic sensor turns 90 degree anticlockwise which as a result makes the ultrasonic sensor heading towards the backside of robot instead of front side. Please help me to resolve this issue. @Algobotics
@timothygultom6194
@timothygultom6194 9 месяцев назад
Im having the same issue
@red_orangetech1738
@red_orangetech1738 2 года назад
Hey,just jumped in here ,Are these series going to to reach a point of really making an autonomous robot? I'm understanding we are only doing simulations and not the actual thing, please clarify for me, would like to follow the series of videos if that's what we are heading to,a real life autonomous robot with slam, thanks.
@QuangDong1010
@QuangDong1010 Год назад
Can we set a designated point for the robot to find its way there? Thanks u
@oliverhudson8821
@oliverhudson8821 2 года назад
I have followed the tutorial and i have an error , i don't understand could you help? Traceback (most recent call last): File "main.py", line 10, in gfx = Graphics(MAP_DIMENSIONS, 'DDR.png', 'ObstacleMap.png') File "/home/runner/Wall-Detection/ROBOT.py", line 83, in __init__ self.map.blit(self.map_img, (0,0)) AttributeError: 'Graphics' object has no attribute 'map_img' . Also i am using repl.it .
@hobby_coding
@hobby_coding 2 года назад
you have to put both of the images in the description in the project folder
@SACKO0731
@SACKO0731 2 года назад
Algobotics where does self.map.get_at comes from it seems like that don't work in 10:52 the "get_at could'nt" be solved thanks
@dinnyuylfruangu3069
@dinnyuylfruangu3069 Год назад
Great video though am unable to download the image
@dharanijagan8032
@dharanijagan8032 Год назад
WHERE DO I GET DDR.PNG','Obstacle.png
@jhanolaer8286
@jhanolaer8286 2 года назад
what is Vl and Vr?
@hobby_coding
@hobby_coding 2 года назад
left and right wheels linear velocities
@xfiretun5934
@xfiretun5934 2 года назад
Robot keeps on going forward through map without detecting any obstacle .. any help !
@blackwidow8447
@blackwidow8447 2 года назад
Were you able to fix the problem? My robot keeps moving in circles :(
@vanminhnguyen8402
@vanminhnguyen8402 Год назад
@@blackwidow8447 Change color[1], color[2], color[3] to color = (0,0,0)
@petagriffed8337
@petagriffed8337 2 года назад
this is 2d what about 3d space
@lilyvmax6642
@lilyvmax6642 2 года назад
Horrible
@welidbenchouche
@welidbenchouche 2 года назад
hi bro, amazing content, can i contact you for a small information pleaaaaaaaaase ? i tried to find you on fiver, but couldnt
@hobby_coding
@hobby_coding 2 года назад
hi walid, just send me an email. check the contacts on the channel home page.
@welidbenchouche
@welidbenchouche 2 года назад
@@hobby_coding I have just sent you an e mail, please check spam if you can't find it. thanks a lot for your time
@hobby_coding
@hobby_coding 2 года назад
@@welidbenchouche i found it and sent a reply :)
Далее
Can we simulate a real robot?
21:26
Просмотров 108 тыс.
MAGIC TIME ​⁠@Whoispelagheya
00:28
Просмотров 4,3 млн
Robotics Toolbox for Python
35:27
Просмотров 21 тыс.
F1TENTH L05 - Follow the Gap for Obstacle Avoidance
47:46
Teaching Robots to Walk w/ Reinforcement Learning
22:03
What are Genetic Algorithms?
12:13
Просмотров 51 тыс.
Building a ROS Robot for Mapping and Navigation #1
19:53
Easy SLAM with ROS using slam_toolbox
25:47
Просмотров 140 тыс.