Description
The goal of the contest is to visit all milestones in the fastest time without collision.
The map of the environment is generated by SLAM algorithm but the accurate location of a RC car is not given. So we use AMCL to localize the RC car's position.
We runs the RC car via ROS.
We simulated the implemented codes using ROS simulating tools.
Our Approach
1. RRT
We use RRT algorithm to find path visiting all given waypoints.
Our RRT should consider about RC car's kinematic. So each point of RRT has its own values relating to RC car's kinematics. (heading direction, steering angle, x and y coordinates, distance from starting point)
(path found by kinematic-aware RRT)
There're few issues to be handled.
2. Early determine hopeless starting point
- final point of RRT path connecting n-th waypoint and (n+1)-th waypoint should be starting point of the RRT path connecting (n+1)-th waypoint and (n+2)-th waypoint.
- But frequently the point is hopeless. In other words, RRT cannot generate the path from the point and next waypoint
(A starting point in the upper right corner is hopeless. Every car starting at the point hit the wall)
I need to detect such a point. Our course is not complicated so I use simple algorithm to determine whether the point is hopeless or not.
I set steering angles [-max_steering_angle, max_steering angle] uniformly and get maximum distance of each point until the car does not hit the wall.
Then I calculate the differences between adjacent maximum distances, and if all differences are smaller than predefined threshold, i determine the point is hopeless.
Of course, This algorithm have many exceptions but the map is not so difficult that our algorithm didn't work.
3. Path Optimizing
Our Controller is not stable. So Path Optimizing is good idea to make driving stable.
Our path optimization algorithm utilizes dubins curve. Dubins curve is simple path finding algorithm to connect two points considering car-like robot's kinematic.
I divide the path at constant intervals. And get all Dubins curves between every point pairs. (1~2, 2~3, ...., n-1~n, 1~3, 2~4, ..., 1~n)
Then, I use DP-algorithm to find shortest path.
I can remove redundant curves by path optimizing.
(path before optimization)
(path after optimization)
4. Test via AWS
Finding PID coefficients and running simulations multiple times is very time consuming task.
So I use AWS to running multiple simulations simultaneously.
I should set up Headless OpenGL Rendering Server to run Gazebo and Rviz on AWS. because there is no Monitor attached to AWS server.
Once I set up the server, I save it as AMI.
And I implement the python script that creates multiple AWS Instances and runs simulations at once.
The results (screen capture of Gazebo and Rviz, fail or success of our code) are stored in AWS EFS.
The Instances finishing the simulations are automatically shut downed.
Thanks for this AWS system, we can run simulations over 300 times. (If there wasn't AWS testing system, it will take over 300*10 minutes = 50 hours)
(I knew that there is AWS RoboMaker which is AWS ROS simulation service. But I didn't use it because I didn't know ROS much. I can just copy and paste my catkin workspace folder to AWS ec2 instance!)
5. Pure Pursuit Controller
I compared PID control and Pure Pursuit Controller.
Pure Pursuit Controller is more stable and easy to tuning.
For this reason, finally, I use Pure Pursuit controller.
I also implemented Stanley Controller and compare it with Pure Pursuit Controller but it was worse.
I tried to search PID coefficients using Optuna python package. but it was not good.