Skip to content

ubcuas/Dubins-Path

Repository files navigation

Dubins Path Simulator

Algorithm for finding the optimal path of a vehicle given a minimum turning radius and destination

What it does

main.py:

Gets drone and waypoint positions and headings through HTTP and returns the path as an array of discretized points through a POST request.

Sample (truncated) request and response:

REQUEST

 {
    "current_waypoint": {
        "id": -1,
        "name": "",
        "latitude": 38.31513977050781,
        "longitude": -76.54875183105469,
        "altitude": 14.09999942779541
    },
    "desired_waypoint": {
        "id": -1,
        "name": "",
        "latitude": 38.315139532524324,
        "longitude": -76.54875183154353,
        "altitude": 14.09999942779541
    },
    "current_heading": 4.0,
    "desired_heading": 6.0
 }

RESPONSE

{
    "waypoints": [
        {
            "id": -1,
            "name": "",
            "latitude": 38.3151397705078,
            "longitude": -76.54875183105469,
            "altitude": 14.09999942779541
        },
        {
            "id": -1,
            "name": "",
            "latitude": 38.31514080633723,
            "longitude": -76.54874300740228,
            "altitude": 14.09999942779541
        },
        {
            "id": -1,
            "name": "",
            "latitude": 38.31514061883008,
            "longitude": -76.54874400164033,
            "altitude": 14.09999942779541
        },
        ...
    ]
}

dubins.py:

Generates a series of GPS coordinates (latitude/longitude) that map out the Dubins path between two inputted GPS coordinates and headings (in degrees):

For example, if the following were inputted to the dubin function:

Drone latitude = 49.263410
Drone longitude = -123.238651
Waypoint latitude = 49.263275
Waypoint longitude = -123.238456
Drone heading = -167.3
Waypoint heading = 23.1

The following list of GPS coordinates would be returned:

49.26340999999999, -123.238651
49.26340161316977, -123.23867810471107
49.26338646973052, -123.23869716975376
49.263367454224436, -123.23870456360221
49.26334818874659, -123.23869887788112
49.26333234300304, -123.23868119562559
49.263322935302654, -123.23865488497394
49.26327500000001, -123.238456
49.263261159225195, -123.23848337857115
49.26324034065914, -123.23849697786683
49.26321782433831, -123.23849334883079
49.26319932087951, -123.23847341188457
49.26318952314724, -123.23844222346918
49.26319091604964, -123.2384076936174
49.26320314631782, -123.23837857981358
49.26322311210169, -123.23836226592925
49.26324574965922, -123.23836288952451
49.26326531762369, -123.23838029246348
49.26327685313685, -123.23841006100086


The above GPS coordinates plotted on a map

dubins_graph.py:

Randomly generates a theoretical drone/waypoint position/orientation and calculates the optimal Dubins path. New waypoints can be generated by the user, in which the drone will be updated to the previous waypoint's position & orientation. Slider exists to play around with minimum turning radius