Path Smoothing in Python | with just 10 lines of code

Поділитися
Вставка
  • Опубліковано 8 сер 2024
  • in this practical quick tutorial, we make a path smoothing function in python with just 10 lines of code using the pygame library to visualize our work.
    content :
    0:00 intro
    1:05 making a simple visualization environment
    3:22 the path smoothing function
    5:50 path visualization
    6:47 test / outro
    hashtags :
    #pathsmoothing #python
  • Наука та технологія

КОМЕНТАРІ • 28

  • @harshalsakhale4587
    @harshalsakhale4587 2 роки тому

    Very elegant illustration !

  • @diegox4122
    @diegox4122 3 роки тому +2

    Great!

  • @yuka1367
    @yuka1367 3 роки тому

    Great Brother

  • @zahrarezazadeh293
    @zahrarezazadeh293 2 роки тому

    Hi Algobotics, thanks for this interesting video! Can you please tell me if there is a way to implement this in PsychoPy? Should I use the screen window instead of the map defined in your code?

  • @ediharllysantos3631
    @ediharllysantos3631 3 роки тому +4

    hey I tried to do this, but when I run this, it my map black and it doesn't work.. could you please help me ?

    • @hajranaeem4201
      @hajranaeem4201 2 роки тому

      did you find the solution? I am having the same problem

    • @chesschad81
      @chesschad81 Рік тому

      Did you remember pygame.display.update()?

    • @user-zm2ex2vs3j
      @user-zm2ex2vs3j Місяць тому

      @@hajranaeem4201 Most likely you moved the pygame.display.update() command out of the main while(running) loop. Check that all indents are correct

  • @cardcode8345
    @cardcode8345 3 роки тому

    Great work.
    What should I major in if I want to work in theoretical computer science and Robotics.
    Double major in Math and Computer science or A major in Computer engineering (focus on firmware) ?

    • @hobby_coding
      @hobby_coding  3 роки тому +2

      depends on the country you live in, but generally, I say yes theoretical computer science and Robotics would be a reasonable choice, I study automation/instrumentation engineering in Africa so I had to teach myself a lot of these concepts ( robotics and computer science ).

    • @cardcode8345
      @cardcode8345 3 роки тому

      @@hobby_coding
      I live in the US. Thanks for the A2A

    • @transientaardvark6231
      @transientaardvark6231 10 місяців тому

      I'd make sure you throw some physics in there too. Robots are "real" and they demand to be treated accordingly, so you want to really understand forces and acceleration and bearings and motors and friction and ...
      Although I guess it is a bit late now, because you've just finished whatever you chose

  • @purpledragonstudio9431
    @purpledragonstudio9431 2 роки тому +1

    Thanks!

  • @anujaS
    @anujaS 3 роки тому +1

    How the points are joined? Which key is pressed for that?

    • @hobby_coding
      @hobby_coding  3 роки тому +1

      the red points are not joined but you can join them using pygame.draw.line

    • @adarshgowda2039
      @adarshgowda2039 2 роки тому +1

      @@hobby_coding where to use that

  • @hadjer168
    @hadjer168 3 роки тому

    Please can you tell me what's the difference between path planning and routing ? Cause in the 2 main problems we're looking for the shortest path, it's pretty confusing

    • @hobby_coding
      @hobby_coding  3 роки тому +1

      path planning is a term we use a lot in robotics, but the same algorithms(most of them ) are used in other areas as well, in networks they call it routing i think .

    • @jeffhan1239
      @jeffhan1239 2 роки тому

      I think they are generally the same thing, just people call it differently in different area

  • @chesschad81
    @chesschad81 Рік тому +1

    I copied your code exactly, but I'm getting an error when I press space to show the red dots:
    TypeError: m > k must hold

    • @transientaardvark6231
      @transientaardvark6231 10 місяців тому

      I get this when I only have one point in my list (or only a few - I'm not sure what the limit is). I'm guessing the maths requires at least as many points as the order of the polynomial (or one more or 2 more or whatever) - because each point ties down one more coefficient.
      TL;DR - try adding more points before calling the spline stuff

    • @chesschad81
      @chesschad81 10 місяців тому

      @@transientaardvark6231 Yes, I eventually figured that out. Thanks for trying to help though!

  • @adarshgowda2039
    @adarshgowda2039 2 роки тому

    why am i getting the black screen

    • @transientaardvark6231
      @transientaardvark6231 10 місяців тому

      Do you seriously expect anyone to help when you've posted absolutely no information ? My best guess - you haven't turned your computer on (or you are trying it on a piano)

  • @jakecomay9138
    @jakecomay9138 3 роки тому

    I am pretty sure that scipy was updated and this no longer works.

    • @transientaardvark6231
      @transientaardvark6231 10 місяців тому

      I've just tried it, but I could only pip the Py2 libraries (proxy issue). The libs that are downloaded as of today for Py2 work with this code.