A generated drone autonomously flys through a set of randomly placed hoops
Using advanced RRT, Rapid Random Tree, a drones path is planned through a set of randomly generted hoops. The drone has to find the shortest way through these hoops over a testing set of 200. A logarithmic loss function is used to exponentially reduce the error between each test run and by the 100th run the drone is able to pass through all the hoops.
By constantly adjusting the angular speed and setting a reward function with a gradient towards the final hoop the drone is able to learn its path within 200 test runs rather than a much longer 1000 or 10000 sanple size that is usually the convention. Below there is a video of the drone through all of its test runs and a snippet of the loss function code and reward function code.
def drone_racing_rrt(start_pose: gtsam.Pose3, target_poses: List[gtsam.Pose3]) -> List[gtsam.Pose3]:
'''
Arguments:
- start_pose: gtsam.Pose3, initial pose of the drone
- target_poses: List[gtsam.Pose3], list of hoop poses (RRT targets)
Returns:
- drone_path: List[gtsam.Pose3], entire path from start to last hoop
'''
drone_path = []
cStart = start_pose
for t in target_poses:
rrt, parents = run_rrt(cStart, t, generate_random_pose, steer, helpers.distance_between_poses, find_nearest_pose, threshold=1.5)
path = get_rrt_path(rrt,parents)
helpers.pass_through_the_hoop(t,path)
cStart = path[-1]
drone_path += path
return drone_path