dynamic

package
v0.8.12 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2023 License: BSD-3-Clause Imports: 6 Imported by: 0

Documentation

Overview

Package dynamic provides incremental heuristic graph path finding functions.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DStarLite

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

DStarLite implements the D* Lite dynamic re-planning path search algorithm.

doi:10.1109/tro.2004.838026 and ISBN:0-262-51129-0 pp476-483

func NewDStarLite

func NewDStarLite(s, t graph.Node, g graph.Graph, h path.Heuristic, m WorldModel) *DStarLite

NewDStarLite returns a new DStarLite planner for the path from s to t in g using the heuristic h. The world model, m, is used to store shortest path information during path planning. The world model must be an empty graph when NewDStarLite is called.

If h is nil, the DStarLite will use the g.HeuristicCost method if g implements path.HeuristicCoster, falling back to path.NullHeuristic otherwise. If the graph does not implement graph.Weighter, path.UniformCost is used. NewDStarLite will panic if g has a negative edge weight.

func (*DStarLite) Here

func (d *DStarLite) Here() graph.Node

Here returns the current location.

func (*DStarLite) MoveTo

func (d *DStarLite) MoveTo(n graph.Node)

MoveTo moves to n in the world graph.

func (*DStarLite) Path

func (d *DStarLite) Path() (p []graph.Node, weight float64)

Path returns the path from the current location to the goal and the weight of the path.

func (*DStarLite) Step

func (d *DStarLite) Step() bool

Step performs one movement step along the best path towards the goal. It returns false if no further progression toward the goal can be achieved, either because the goal has been reached or because there is no path.

func (*DStarLite) UpdateWorld

func (d *DStarLite) UpdateWorld(changes []graph.Edge)

UpdateWorld updates or adds edges in the world graph. UpdateWorld will panic if changes include a negative edge weight.

type WorldModel

type WorldModel interface {
	graph.WeightedBuilder
	graph.WeightedDirected
}

WorldModel is a mutable weighted directed graph that returns nodes identified by id number.

Jump to

Keyboard shortcuts

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