tpspace

package
v0.11.1 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2023 License: AGPL-3.0 Imports: 14 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 NewPTGFrameFromKinematicOptions added in v0.9.0

func NewPTGFrameFromKinematicOptions(
	name string,
	logger golog.Logger,
	velocityMMps, angVelocityDegps, turnRadMeters, refDist float64,
	trajCount int,
	geoms []spatialmath.Geometry,
	diffDriveOnly bool,
) (referenceframe.Frame, error)

NewPTGFrameFromKinematicOptions 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.

func NewPTGFrameFromPTGFrame added in v0.8.0

func NewPTGFrameFromPTGFrame(frame referenceframe.Frame, refDist float64, trajCount int) (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.

Types

type PTG

type PTG interface {
	// Velocities returns the linear and angular velocity at a specific point along a trajectory
	Velocities(alpha, dist float64) (float64, float64, error)
	Transform([]referenceframe.Input) (spatialmath.Pose, 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 NewCCPTG

func NewCCPTG(maxMMPS, maxRPS float64) PTG

NewCCPTG creates a new PTG of type ptgCC.

func NewCCSPTG

func NewCCSPTG(maxMMPS, maxRPS float64) PTG

NewCCSPTG creates a new PTG of type ptgCCS.

func NewCSPTG

func NewCSPTG(maxMMPS, maxRPS float64) PTG

NewCSPTG creates a new PTG of type ptgCS.

func NewCirclePTG

func NewCirclePTG(maxMMPS, maxRPS float64) PTG

NewCirclePTG creates a new PTG of type ptgC.

func NewDiffDrivePTG added in v0.9.0

func NewDiffDrivePTG(maxMMPS, maxRPS float64) PTG

NewDiffDrivePTG creates a new PTG of type ptgDiffDrive.

func NewSideSOverturnPTG added in v0.8.0

func NewSideSOverturnPTG(maxMMPS, maxRPS float64) PTG

NewSideSOverturnPTG creates a new PTG of type ptgSideS 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) PTG

NewSideSPTG creates a new PTG of type ptgSideS.

type PTGProvider

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

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

type PTGSolver added in v0.9.0

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

	// 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)
}

PTGSolver wraps a PTG with the ability to perform Inverse Kinematics.

func NewPTGGridSim

func NewPTGGridSim(simPTG PTG, arcs uint, simDist float64, endsOnly bool) (PTGSolver, error)

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

func NewPTGIK added in v0.8.0

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

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

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 PTG, 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