Skip to main content

Reeds-Shepp algorithm implementation in Python

Project description

README

Overview

This package is a Reeds-Shepp library implementation with Python that is compatible with Python versions including 3.11.

Contains the following files:

  • planner: Path planning code. path function outputs the optimal Reeds-Shepp path with or without a runway.
  • curves: Curve formulas for all of the curve types in the Reeds-Shepp paper.
  • primitives: Three class architectures (path, waypoint, and segment).
    • Waypoint class (stores x, y, yaw, as well as the curvature and angle/length of the segment the waypoint is on)
    • Segment class (stores left/right/straight type, forward/backward direction, magnitude (arc angle or straight length), and turn radius of the segment)
    • Path class (stores start and end points, turn radius, step size, and list of Segments. Also contains a cached waypoints function to get a list of Waypoints for the path)
  • helpers: Helper functions for planner, primitives, and curves files.
  • demo: Demo/visualization of paths.

Usage

Running

See demo.py for example usage

path(start_pt, end_pt, turn_radius, runway_length, step_size, length_tolerance (optional))

  • return a Reeds-Shepp path from start_pt to end_pt with specified turning radius and step_size between points. The length_tolerance default is 2 meters but can be set to user preference — if paths’ total lengths are within length tolerance of each other, the path function will choose the one with fewer segments as the optimal path. The runway_length is for the runway at the end of the path that helps improve accuracy in reaching the final position — this can be set to 0, or a positive or negative number for a forwards or backwards driving runway.
  • start_pt and end_pt are in the format Tuple[float, float, float] of x, y, yaw values.

Demo

$ python demos/demo.py

FAQ

What are t, u, and v parameters?

  • As a whole, t, u, v are segment parameters generated in each of the curve helper functions that represent the distance (angular distance for curved segments, linear distance for straight segments) of their respective segments.
  • If there are 3 segments (ccc or csc), t is for segment 1, u is for segment 2, and v is for segment 3.
  • If there are 4 or 5 segments, the format is:
    • t, u, u, v for cccc paths (2nd and 3rd segments have same angular distance)
    • t, pi/2, u, v for ccsc paths (2nd segment has angle pi/2)
    • t, u, pi/2, v for cscc paths (3rd segment has angle pi/2)
    • t, pi/2, u, pi/2, v for ccscc paths (2nd and 4th segments have angle pi/2)
  • These are represented generally in the Segment class in the "distance" parameter, which we pass in t, u, v, or pi/2 for depending on the segment.

Exhibits

From demo.py:

Paths start from origin Format: (end x, end y, yaw, turn radius, runway length)

  1. (5, 6, np.pi, 1, 0)
  2. (15, 3, np.pi / 2.0, 2, 6)
  3. (-2, -4, np.pi, 4, 3)
  4. (-7, 2, np.pi, 4, 0)
  5. (-7, -7, 0.0, 6, 1)
  6. (0.7, 1.8, 1, 1, 1)
  7. (-5, 6, np.pi / 3.0, 2, 1)
  8. (7, 2, 0.0, 6, 3)
  9. (-4, -1, -np.pi / 2.0, 1, 3)

Screenshot from 2023-07-18 11-50-32

References

Paper providing more information on the algorithm: Reeds, J., & Shepp, L. (1990). Optimal paths for a car that goes both forwards and backwards. https://msp.org/pjm/1990/145-2/pjm-v145-n2-p06-s.pdf

Curve formulas can be found on page 390-391. Inspiration for this Python implementation of the Reeds-Shepp algorithm: https://github.com/boyali/reeds_and_shepp_curves/tree/master

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

rsplan-1.0.2.tar.gz (18.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

rsplan-1.0.2-py3-none-any.whl (19.1 kB view details)

Uploaded Python 3

File details

Details for the file rsplan-1.0.2.tar.gz.

File metadata

  • Download URL: rsplan-1.0.2.tar.gz
  • Upload date:
  • Size: 18.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.4

File hashes

Hashes for rsplan-1.0.2.tar.gz
Algorithm Hash digest
SHA256 d4be60314403b0cebf9782fb9a20f17c2ecc8b951e5b11f6d0a756274d3902fe
MD5 b20ad87f2e44696fee9da778b2191f3a
BLAKE2b-256 5bec5efde6615c132f0e1746647162bfc1b9e6d6b84d9ffbe67793ebf1bfd087

See more details on using hashes here.

File details

Details for the file rsplan-1.0.2-py3-none-any.whl.

File metadata

  • Download URL: rsplan-1.0.2-py3-none-any.whl
  • Upload date:
  • Size: 19.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.4

File hashes

Hashes for rsplan-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 9d875182ffc4322b02e250d88f0362b3d3c9ff93b8e2b1aea8fd7e369ce16257
MD5 82c104596e118bd090bac665c924c9d2
BLAKE2b-256 997c24b7e137c9269fe55ff5aba1ede3ae707fd3fcf2913e403e2fb31dc99471

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page