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 - Наука та технологія
Very elegant illustration !
Great!
Great Brother
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?
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 ?
did you find the solution? I am having the same problem
Did you remember pygame.display.update()?
@@hajranaeem4201 Most likely you moved the pygame.display.update() command out of the main while(running) loop. Check that all indents are correct
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) ?
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 ).
@@hobby_coding
I live in the US. Thanks for the A2A
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
Thanks!
you'r welcome ;)
How the points are joined? Which key is pressed for that?
the red points are not joined but you can join them using pygame.draw.line
@@hobby_coding where to use that
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
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 .
I think they are generally the same thing, just people call it differently in different area
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
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
@@transientaardvark6231 Yes, I eventually figured that out. Thanks for trying to help though!
why am i getting the black screen
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)
I am pretty sure that scipy was updated and this no longer works.
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.