tpspace

package
v0.8.0-rc1 Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2023 License: AGPL-3.0 Imports: 11 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

func NewPTGFrameFromPTGFrame added in v0.8.0

func NewPTGFrameFromPTGFrame(frame referenceframe.Frame, refDist float64) (referenceframe.Frame, error)

NewPTGFrameFromPTGFrame will create a new Frame from a preexisting ptgGroupFrame, allowing the adjustment of `refDist` while keeping other params the same. This may be expanded to allow altering turning radius, geometries, etc.

func NewPTGFrameFromTurningRadius added in v0.8.0

func NewPTGFrameFromTurningRadius(
	name string,
	logger golog.Logger,
	velocityMMps, turnRadMeters, refDist float64,
	geoms []spatialmath.Geometry,
) (referenceframe.Frame, error)

NewPTGFrameFromTurningRadius will create a new Frame which is also a PTGProvider. It will precompute the default set of trajectories out to a given distance, or a default distance if the given distance is <= 0.

Types

type PTG

type PTG interface {
	// Solve will return the (alpha, dist) TP-space coordinates whose corresponding relative pose minimizes the given function
	ik.InverseKinematics
	PrecomputePTG

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

	// Returns the set of trajectory nodes along the given trajectory, out to the requested distance
	Trajectory(alpha, dist float64) ([]*TrajNode, error)
}

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, endsOnly bool) (PTG, error)

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

func NewPTGIK added in v0.8.0

func NewPTGIK(simPTG PrecomputePTG, logger golog.Logger, refDist float64, randSeed int) (PTG, error)

NewPTGIK creates a new ptgIK, which creates a frame using the provided PrecomputePTG, and wraps it providing functions to fill the PTG interface, allowing inverse kinematics queries to be run against it.

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, dist float64) (float64, float64, error)
	Transform([]referenceframe.Input) (spatialmath.Pose, error)
}

PrecomputePTG is a precomputable PTG.

func NewCCPTG

func NewCCPTG(maxMMPS, maxRPS float64) PrecomputePTG

NewCCPTG creates a new PrecomputePTG of type ptgDiffDriveCC.

func NewCCSPTG

func NewCCSPTG(maxMMPS, maxRPS float64) PrecomputePTG

NewCCSPTG creates a new PrecomputePTG of type ptgDiffDriveCCS.

func NewCSPTG

func NewCSPTG(maxMMPS, maxRPS float64) PrecomputePTG

NewCSPTG creates a new PrecomputePTG of type ptgDiffDriveCS.

func NewCirclePTG

func NewCirclePTG(maxMMPS, maxRPS float64) PrecomputePTG

NewCirclePTG creates a new PrecomputePTG of type ptgDiffDriveC.

func NewSideSOverturnPTG added in v0.8.0

func NewSideSOverturnPTG(maxMMPS, maxRPS float64) PrecomputePTG

NewSideSOverturnPTG creates a new PrecomputePTG of type ptgDiffDriveSideS which overturns. It turns X amount in one direction, then countersteers X*countersteerFactor in the other direction.

func NewSideSPTG added in v0.8.0

func NewSideSPTG(maxMMPS, maxRPS float64) PrecomputePTG

NewSideSPTG creates a new PrecomputePTG of type ptgDiffDriveSideS.

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
	Alpha      float64          // 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
}

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.

func ComputePTG added in v0.8.0

func ComputePTG(simPTG PrecomputePTG, alpha, dist, diffT float64) ([]*TrajNode, error)

ComputePTG will compute all nodes of simPTG at the requested alpha, out to the requested distance, at the specified diffT resolution.

Jump to

Keyboard shortcuts

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