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 >= 3.9, 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 (Waypoint, Segment, and Path).
    • Waypoint class (stores x, y, yaw of the waypoint and the curvature and length of the segment the waypoint is on as well as if the segment is a runway)
    • Segment class (stores left/right/straight type, forward/backward direction, 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

Installation

You can install this software using pip:

$ pip3 install -U rsplan

Running

See demo.py for example usage

path(start_pose, end_pose, turn_radius, runway_length, step_size, length_tolerance (optional))

  • return a Reeds-Shepp path from start_pose to end_pose 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_pose and end_pose are in the format Tuple[float, float, float] of x, y, yaw values.

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

How to run the demo

  • Clone this repository

  • Update _END_POSES path coordinates in demo.py to the paths you would like to visualize

  • In terminal in the rsplan subfolder of this rsplan repository, run: $ python3 demo.py

Example paths visualized 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.10.tar.gz (17.6 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.10-py3-none-any.whl (18.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: rsplan-1.0.10.tar.gz
  • Upload date:
  • Size: 17.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.4.2 requests/2.22.0 setuptools/45.2.0 requests-toolbelt/0.8.0 tqdm/4.30.0 CPython/3.8.10

File hashes

Hashes for rsplan-1.0.10.tar.gz
Algorithm Hash digest
SHA256 07c7202cc0d638f080d164563f9cec3c5d7c5159c43b24c340c40b53c29ebb91
MD5 7d7cab9810567139c7f3d95846fa97a2
BLAKE2b-256 bed6824a43a939afba7ac03cacc9d687a9d93736d5a52be2f8c07b77d891d1ea

See more details on using hashes here.

File details

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

File metadata

  • Download URL: rsplan-1.0.10-py3-none-any.whl
  • Upload date:
  • Size: 18.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.4.2 requests/2.22.0 setuptools/45.2.0 requests-toolbelt/0.8.0 tqdm/4.30.0 CPython/3.8.10

File hashes

Hashes for rsplan-1.0.10-py3-none-any.whl
Algorithm Hash digest
SHA256 31921e71883bc48aefd41c2aa0b414ca9d04f590f20de62f55d050b5da4d741c
MD5 ef0e6c3ebaa2e23f1a983fc0edfccea1
BLAKE2b-256 9644958c338824aae30b60a4f99bacf51d0d4ad01266e630e2403e06b2351af4

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