tpspace

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Aug 4, 2023 License: AGPL-3.0 Imports: 3 Imported by: 0

Documentation

Overview

Package tpspace defines an assortment of precomputable trajectories which can be used to plan nonholonomic 2d motion

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PTG

type PTG interface {
	// CToTP Converts an (x, y) cartesian coord to a (k, d) TP-space coord
	// d is the distance along a trajectory, k is a discretized uint index corresponding to an alpha value in [-pi, pi]
	// See `index2alpha` for more
	// Also returns a bool representing whether the xy is a within-traj match vs an extrapolation
	CToTP(x, y float64) []*TrajNode

	// RefDistance returns the maximum distance that a single precomputed trajectory may travel
	RefDistance() float64

	// Returns the set of trajectory nodes for alpha index K
	Trajectory(uint) []*TrajNode
}

PTG is a Parameterized Trajectory Generator, which defines how to map back and forth from cartesian space to TP-space PTG coordinates are specified in polar coordinates (alpha, d) One of these is needed for each sort of motion that can be done.

func NewPTGGridSim

func NewPTGGridSim(simPTG PrecomputePTG, arcs uint, simDist float64) (PTG, error)

NewPTGGridSim creates a new PTG by simulating a PrecomputePTG for some distance, then cacheing the results in a grid for fast lookup.

type PTGProvider

type PTGProvider interface {
	// PTGs returns the list of PTGs associated with this provider
	PTGs() []PTG
}

PTGProvider is something able to provide a set of PTGs associsated with it. For example, a frame which precomputes a number of PTGs.

type PrecomputePTG

type PrecomputePTG interface {
	// PTGVelocities returns the linear and angular velocity at a specific point along a trajectory
	PTGVelocities(alpha, t, x, y, phi float64) (float64, float64, error)
}

PrecomputePTG is a precomputable PTG.

func NewAlphaPTG

func NewAlphaPTG(maxMMPS, maxRPS, k float64) PrecomputePTG

NewAlphaPTG creates a new PrecomputePTG of type simPtgAlpha. K is unused for alpha PTGs *for now* but we may add in the future.

func NewCCPTG

func NewCCPTG(maxMMPS, maxRPS, k float64) PrecomputePTG

NewCCPTG creates a new PrecomputePTG of type ptgDiffDriveCC.

func NewCCSPTG

func NewCCSPTG(maxMMPS, maxRPS, k float64) PrecomputePTG

NewCCSPTG creates a new PrecomputePTG of type ptgDiffDriveCCS.

func NewCSPTG

func NewCSPTG(maxMMPS, maxRPS, k float64) PrecomputePTG

NewCSPTG creates a new PrecomputePTG of type ptgDiffDriveCS.

func NewCirclePTG

func NewCirclePTG(maxMMPS, maxRPS, k float64) PrecomputePTG

NewCirclePTG creates a new PrecomputePTG of type ptgDiffDriveC.

type TrajNode

type TrajNode struct {
	// TODO: cache pose point and orientation so that we don't recompute every time we need it
	Pose       spatialmath.Pose // for 2d, we only use x, y, and OV theta
	Time       float64          // elapsed time on trajectory
	Dist       float64          // distance travelled down trajectory
	K          uint             // alpha k-value at this node
	LinVelMMPS float64          // linvel in millimeters per second at this node
	AngVelRPS  float64          // angvel in radians per second at this node
	// contains filtered or unexported fields
}

TrajNode is a snapshot of a single point in time along a PTG trajectory, including the distance along that trajectory, the elapsed time along the trajectory, and the linear and angular velocity at that point.

Jump to

Keyboard shortcuts

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