The goal for this project is to use path finding algorithms to navigate an agent around obstacles to reach a goal. In this simulation, a probabilistic roadmap (PRM) was used to first generate an obstacle intersecting free path and then use collision detection to prevent the agent from running into, or through, an obstacle.
This begins by randomly creating a cluttered environment of spheres. The A* pathfinding algorithm is used to find a non-obstacle intersecting path from a start node to the goal node. The resulting path is then traversed by an agent that avoids collisions with the surrounding obstacle environment and can skip to nodes that have a clear line of sight.
The scene is rendered in 3D with 2D navigation. Lighting effects have been used to simulate the shadow directions that are seen in the tennis court background image. Also, a camera has been added that allows the user to navigate the scene easily with WASDQE keys and the arrow keys.
Texturing has been applied the to agent to simulate a tennis ball on a tennis court. The obstacles have also been rendered in 3D with random colors applied to the them.
When ever the simulation is paused (such as at the beginning or toggled with the spacebar) the user can select an obstacle and move it with the mouse. To help with this, whenever the user holds down the left mouse button and an obstacle isn't selected, a yellow circle will appear. This is to help the user in selecting either objects since the view point in 3D warps the x and y coordinates of the mouse in relation to the screen's output.
While the simulation is running, the user can select the agent and move it off course or around obstacles.
Time - Feature
0:00 - User Scenario Editing
0:15 - 3D Rendering and Camera
0:32 - Improved Agent and Scene Rendering
1:00 - Single Agent Navigation
1:10 Improved Agent and Scene Rendering
WARNING. Before viewing this video, those with epilepsy and similar conditions should be cautious before viewing. This video contains fast flashing colors that may cause epileptic seizures and other similar symptoms.
My goal was to simply create sphere obstacles with random colors each time, however, it turned out that I added this random color assignment in the draw function which resulted in the video below.
Single Agent Navigation - The only problem I really had was getting my agent to navigate in smooth and fluid way. I ended up creating new functions in the CollisionLibrary that dealt with the agent actually colliding with an obstacle rather than trying to implement all of that code in the main proj3 file. The other part was to have my agent skip to a node further down the path towards the goal. I ended up comparing every single path point with curPathIdx and only would calculate the velocity to a node if it was higher than curPathIdx and had no intersecting obstacles. I spent most of my time on this part as the other features took considerable less time to implement.
PRM and collision detection algorithms are based on similar code provided by CSCI 5611 here. The camera class included was developed by Liam Tyler for CSCI 5611 with only some parameters tuned by me. The tennis ball image was from https://www.robinwood.com/Catalog/FreeStuff/Textures/TexturePages/BallMaps.html and the tennis court image from https://www.kourts.com/blog/posts/3-things-to-consider-when-picking-a-tennis-court/