dubins

package module
v0.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 4, 2024 License: MIT Imports: 2 Imported by: 1

README

dubins

Pure Golang implementation of Dubins Path, based on C++ Dubins-Curves

Installation

go get github.com/dohyeunglee/dubins

API

Visit https://pkg.go.dev/github.com/dohyeunglee/dubins

Example

An example is available in example/main.go

Demo

A demo with plot is available in demo

Test

go test

Benchmark

go test -bench .
Result

Run on M1 Macbook Pro

BenchmarkMinLengthPath-8   	 1000000	      1126 ns/op

Note

If you want ReedsSheppPath, check https://github.com/dohyeunglee/reedsshepp.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Path

type Path struct {
	// contains filtered or unexported fields
}

Path corresponds to DubinsPath.

func AvailablePaths

func AvailablePaths(start State, goal State, turingRadius float64) []Path

AvailablePaths returns all possible DubinsPath that can reach the `goal` state from the `start` state, given a `turningRadius`.

func MinLengthPath

func MinLengthPath(start State, goal State, turningRadius float64) (Path, bool)

MinLengthPath returns the shortest DubinsPath among all possible paths from the `start` state to the `goal` state, given a `turningRadius`. In case there are multiple paths with the same length, one of them is randomly selected and returned. The shortest DubinsPath length can be obtained using the `Length` function of the returned DubinsPath.

func PathByType

func PathByType(start State, goal State, turingRadius float64, pathType PathType) (Path, bool)

PathByType returns DubinsPath that can reach the `goal` state from the `start` state, given a `turningRadius` and `pathType`

func (*Path) Interpolate

func (p *Path) Interpolate(stepSize float64) []State

Interpolate interpolates DubinsPath by `stepSize`, returning `State` list.

func (*Path) Length

func (p *Path) Length() float64

Length returns the total length of DubinsPath.

func (*Path) PathType

func (p *Path) PathType() PathType

PathType returns the type of DubinsPath.

func (*Path) Segments

func (p *Path) Segments() []PathSegment

Segments returns all `PathSegment` information about DubinsPath.

type PathCourseType

type PathCourseType string

PathCourseType represents DubinsPath segment course type: L, S, R.

const (
	CourseTypeLeft     PathCourseType = "L"
	CourseTypeStraight PathCourseType = "S"
	CourseTypeRight    PathCourseType = "R"
)

type PathSegment

type PathSegment struct {
	Length     float64
	CourseType PathCourseType
}

type PathType

type PathType string

PathType represents 6 DubinsPath type.

const (
	LSL PathType = "LSL"
	LSR PathType = "LSR"
	RSL PathType = "RSL"
	RSR PathType = "RSR"
	RLR PathType = "RLR"
	LRL PathType = "LRL"
)

type State

type State struct {
	X   float64
	Y   float64
	Yaw float64
}

State represents the 3D state, x, y coordinate and yaw angle.

func (State) String

func (s State) String() string

Directories

Path Synopsis
demo module

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL