Это видео недоступно.
Сожалеем об этом.

Simulating an Obstacle Avoidance Robot Using Python | From Scratch

Поделиться
HTML-код
  • Опубликовано: 17 авг 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/My...
    🛑 make sure to change the images names after you download them to be the same as the video
    🗃️ source code : ko-fi.com/s/1a...
    💻 my services are available on Fiverr: www.fiverr.com...
    ⏱️ TimeStamps :
    0:00 introduction
    0:55 Preparations
    2:16 Code Structure
    2:55 Coding
    12:38 Testing and outro
    🏷️ HashTags: #Robot #sensor

Комментарии • 33

  • @hobby_coding
    @hobby_coding  2 года назад +8

    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

  • @tomersidis1225
    @tomersidis1225 2 года назад +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 Год назад

      @@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 года назад +2

    Man, you forgot uploading the 2nd part of lane detection. Have been waiting for 5 months 😂😂😂👍🤐

  • @alanperez7551
    @alanperez7551 5 месяцев назад

    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...

  • @profmoek7813
    @profmoek7813 Год назад

    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

  • @manishsaini2172
    @manishsaini2172 2 года назад +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

  • @simplymohan
    @simplymohan 11 месяцев назад

    Nice tutorial

  • @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.

  • @kabiratolayemi7570
    @kabiratolayemi7570 Год назад

    Hi. I followed the code but encountered this error: Graphics() takes no arguments. Any help

  • @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 :/

  • @oliverhudson8821
    @oliverhudson8821 2 года назад +1

    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

  • @QuangDong1010
    @QuangDong1010 Год назад

    Can we set a designated point for the robot to find its way there? Thanks u

  • @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

  • @jhanolaer8286
    @jhanolaer8286 2 года назад +1

    what is Vl and Vr?

    • @hobby_coding
      @hobby_coding  2 года назад +1

      left and right wheels linear velocities

  • @dharanijagan8032
    @dharanijagan8032 11 месяцев назад

    WHERE DO I GET DDR.PNG','Obstacle.png

  • @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)

  • @raginigupta4857
    @raginigupta4857 29 дней назад

    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😌

  • @dinnyuylfruangu3069
    @dinnyuylfruangu3069 Год назад

    Great video though am unable to download the image

  • @petagriffed8337
    @petagriffed8337 Год назад

    this is 2d what about 3d space

  • @lilyvmax6642
    @lilyvmax6642 2 года назад +1

    Horrible

  • @welidbenchouche
    @welidbenchouche 2 года назад +1

    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 :)