Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Picture problems of start, end and grass #2

Open
Shame-fight opened this issue Feb 25, 2022 · 12 comments
Open

Picture problems of start, end and grass #2

Shame-fight opened this issue Feb 25, 2022 · 12 comments

Comments

@Shame-fight
Copy link

Thanks for your work, I want to replace the corresponding squares of start, end and grass on the map with pictures instead of filling like red, purple or green. The goal is that the effect will look more realistic. But I'm new to pygame, trying to modify the code but can't achieve what I want. can you help me? Is it possible to provide an example such as modifying the picture of start.
Looking forward to hearing from you.
@Sana-078

@Sana-130
Copy link
Owner

Sana-130 commented Mar 1, 2022

As u asked, I modified the code and this is how it looks ,
pfpic

Also since we are representing the green area with a grass image I thought it would be a good idea to give them a fixed weight rather than a random value since the user wont be able to see it. Right now , the start and end points contain a flag image , u can change it to whatever u want, just the image would be scaled to the size of that cell, before displaying. Let me know if there is anything else u want to add @Shame-fight .

@Shame-fight
Copy link
Author

Shame-fight commented Mar 9, 2022

Thanks for your reply, I want to do the following things.

  1. Add a variety of obstacles. At present, the program supports one obstacle: grass, whether it is possible to add a variety of different obstacles, such as hills, lakes, swamps, etc.
  2. Support three algorithms, including A*, Dijkstra and BFS algorithms. One is currently supported.
  3. Multiple start and end pairs. Simulate multiple cars running the path planning algorithm at the same time.
  4. Dynamic display of paths. There is currently an orange path between the start and end points. Whether the path changes can be displayed dynamically, for example, there is a car icon that goes from the starting point to the ending point step by step, so that the final path can be displayed more conveniently.
  5. Save and load maps. Whether the constructed map can be saved, including obstacles, etc. If there is this function, you can load the saved map, select the starting point, the ending point, add obstacles, etc. without building a new map every time.
    3rd and 4th if it's more difficult to implement, can you implement 1st and 2nd?
    Thanks again for your work.

@Sana-078

@Shame-fight
Copy link
Author

The first requirement I have done, by binding keyboard events。
I want to finish the second and third points, can you help me。
@Sana-078

@Sana-130
Copy link
Owner

Sana-130 commented Mar 19, 2022

Sorry i had a hard time replying, was caught up in another project. Anyway I tried to implement the dynamic display of paths.. (it's a really cool idea btw) and it's not really working the way it's supposed to.. about the rest, I will check it out and will let u know @Shame-fight .

@Sana-130
Copy link
Owner

Dynamic display of paths, finally worked, u can check that out.

About the algorithm, I'm not really sure how bfs would work on a weighted graph. And by the third, did u mean threading?? @Shame-fight

@Shame-fight
Copy link
Author

Dynamic display of paths, finally worked, u can check that out.

About the algorithm, I'm not really sure how bfs would work on a weighted graph. And by the third, did u mean threading?? @Shame-fight

Thanks for your time, the dynamic effect is cool.
Have you ever thought about achieving the following effect:
Instead of generating a dynamic path at the end, the cart moves to the corresponding grid with each step. This path may not be optimal, but it can truly reflect the path planning of unmanned vehicles in reality.
@Sana-078

@Shame-fight
Copy link
Author

Can you add the A*s algorithm, I tried to add this algorithm, but the final path does not consider the high pass cost of the grass, the algorithm treats the grass as a general path, I don't know how to solve this problem.
@Sana-078

@Sana-130
Copy link
Owner

Sana-130 commented Apr 3, 2022

Can you add the A*s algorithm, I tried to add this algorithm, but the final path does not consider the high pass cost of the grass, the algorithm treats the grass as a general path, I don't know how to solve this problem. @Sana-078

Yeah I have added it. Check the code. @Shame-fight

@Sana-130
Copy link
Owner

Sana-130 commented Apr 3, 2022

Dynamic display of paths, finally worked, u can check that out.
About the algorithm, I'm not really sure how bfs would work on a weighted graph. And by the third, did u mean threading?? @Shame-fight

Thanks for your time, the dynamic effect is cool. Have you ever thought about achieving the following effect: Instead of generating a dynamic path at the end, the cart moves to the corresponding grid with each step. This path may not be optimal, but it can truly reflect the path planning of unmanned vehicles in reality. @Sana-078

Care to elaborate the last part.

@Shame-fight
Copy link
Author

Dynamic display of paths, finally worked, u can check that out.
About the algorithm, I'm not really sure how bfs would work on a weighted graph. And by the third, did u mean threading?? @Shame-fight

Thanks for your time, the dynamic effect is cool. Have you ever thought about achieving the following effect: Instead of generating a dynamic path at the end, the cart moves to the corresponding grid with each step. This path may not be optimal, but it can truly reflect the path planning of unmanned vehicles in reality. @Sana-078

Care to elaborate the last part.

In the real world, the path planning of the unmanned vehicle should be like this: the unmanned vehicle only walks one grid, and then decides the grid position to go next according to the current algorithm and the position of the surrounding obstacles. Repeat this cycle until you reach the end.
At present, our implementation method is: after finding the path of the starting point and the ending point, select the shortest path.
So, is there a possibility to take the shortest path currently implemented as the "reference answer", the actual path is that the unmanned vehicle only walks one grid at a time, and iterates through this, and finally reaches the end point, of course, this path is very large It may not be a "reference answer", and the actual path obtained from each run should be different, because we have four grids to go in each step.
The final effect: two paths are displayed, the first is the shortest path, that is, the "reference answer"; the other is the actual path displayed step by step.
These are my thoughts, thanks for your work!
@Sana-078

@Shame-fight
Copy link
Author

Dynamic display of paths, finally worked, u can check that out.

About the algorithm, I'm not really sure how bfs would work on a weighted graph. And by the third, did u mean threading?? @Shame-fight

Yes, there are multiple autonomous vehicles on the same map. Different cars can choose different starting and ending points and algorithms, and finally start path planning at the same time.

@Sana-130
Copy link
Owner

Dynamic display of paths, finally worked, u can check that out.
About the algorithm, I'm not really sure how bfs would work on a weighted graph. And by the third, did u mean threading?? @Shame-fight

Yes, there are multiple autonomous vehicles on the same map. Different cars can choose different starting and ending points and algorithms, and finally start path planning at the same time.

It's possible but the issue is that the GUI is going to glitch a lot even though it's just one thread that's currently running. @Shame-fight

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants