Це відео не доступне.
Перепрошуємо.
Simulating an Obstacle Avoidance Robot Using Python | From Scratch
Вставка
- Опубліковано 8 сер 2024
- in this video 🔥we will present a step-by-step tutorial on simulating an Obstacle Avoidance Robot equipped with an Ultrasonic sensor from scratch using the python programming language.
📁 Files:
images: imgur.com/a/MyjxAxM
🛑 make sure to change the images names after you download them to be the same as the video
🗃️ source code : ko-fi.com/s/1a38e1563b
💻 my services are available on Fiverr: www.fiverr.com/mouad2021
⏱️ TimeStamps :
0:00 introduction
0:55 Preparations
2:16 Code Structure
2:55 Coding
12:38 Testing and outro
🏷️ HashTags: #Robot #sensor
i hope you enjoyed this , don't forget to leave a like if you did. 😊😊
🗃️ source code : ko-fi.com/s/1a38e1563b
@@sharefyusuf5769 in the discription box
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
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
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.
sure, nice idea.
@@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
Nice tutorial
Man, you forgot uploading the 2nd part of lane detection. Have been waiting for 5 months 😂😂😂👍🤐
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.
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...
Can we set a designated point for the robot to find its way there? Thanks u
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
Im having the same issue
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
Hi. I followed the code but encountered this error: Graphics() takes no arguments. Any help
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 .
you have to put both of the images in the description in the project folder
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 :/
Great video though am unable to download the image
WHERE DO I GET DDR.PNG','Obstacle.png
what is Vl and Vr?
left and right wheels linear velocities
Robot keeps on going forward through map without detecting any obstacle .. any help !
Were you able to fix the problem? My robot keeps moving in circles
:(
@@blackwidow8447 Change color[1], color[2], color[3] to color = (0,0,0)
this is 2d what about 3d space
Horrible
hi bro, amazing content, can i contact you for a small information pleaaaaaaaaase ? i tried to find you on fiver, but couldnt
hi walid, just send me an email. check the contacts on the channel home page.
@@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
@@welidbenchouche i found it and sent a reply :)
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😌