Pose

class Pose(var x: Double = 0.0, var y: Double = 0.0, var r: Double = 0.0)

Class describing a position and rotation in 2D. This class can also be used to describe things like 2D velocity or chassis power.

Parameters

x

X Position

y

Y Position

r

Rotation in radians

Constructors

Link copied to clipboard
constructor(x: Double = 0.0, y: Double = 0.0, r: Double = 0.0)

Properties

Link copied to clipboard
var r: Double
Link copied to clipboard
var x: Double
Link copied to clipboard
var y: Double

Functions

Link copied to clipboard
fun add(input: Pose, rotate: Boolean = false)

Add another pose to this pose

Link copied to clipboard
fun clone(): Pose

Clone the pose

Link copied to clipboard

Get the euclidean length of the XY component of the pose

Link copied to clipboard
fun normalize()

Normalize the position of the pose

Link copied to clipboard
fun rotate(amount: Double, pivot: Pose = Pose(0.0,0.0,0.0))

Rotate the position of the pose around a pivot. NOTE: This does not affect the R value of the pose

Link copied to clipboard
fun scale(scalar: Double, rotate: Boolean = false)

Scale the pose

Link copied to clipboard
fun setOrigin(origin: Pose, rotate: Boolean = true)

Change the reference frame of the to another pose. Equivalent to subtract operation but with an added rotation transform.

Link copied to clipboard
fun stepAlongR(distance: Double, offset: Double = 0.0)

Move the XY of the pose in the direction of R

Link copied to clipboard
fun subtract(input: Pose, rotate: Boolean = true)

Subtract a this pose by another pose.

Link copied to clipboard
open override fun toString(): String