MotionState

data class MotionState<U : Unit<U>> @JvmOverloads constructor(val position: Measure<U>, val velocity: Per<U, TimeUnit> = position.unit.per(Seconds).of(0.0), val acceleration: Per<PerUnit<U, TimeUnit>, TimeUnit> = position.unit.per( Seconds, ).per(Seconds).of(0.0))(source)

The kinematic state of a system, parameterized by position unit type.

Represents the complete motion state of a system at a point in time, including position, velocity, and acceleration. Velocity is derived as position per time, and acceleration as velocity per time.

This class is generic over the position unit type, allowing it to be used for both linear motion (with dev.nextftc.units.unittypes.DistanceUnit) and angular motion (with dev.nextftc.units.unittypes.AngleUnit).

Type Parameters

U

The position unit type (e.g., dev.nextftc.units.unittypes.DistanceUnit for linear motion, dev.nextftc.units.unittypes.AngleUnit for angular motion)

Constructors

Link copied to clipboard
constructor(position: Measure<U>, velocity: Per<U, TimeUnit> = position.unit.per(Seconds).of(0.0), acceleration: Per<PerUnit<U, TimeUnit>, TimeUnit> = position.unit.per( Seconds, ).per(Seconds).of(0.0))
constructor(unit: U, position: Double = 0.0, velocity: Double = 0.0, acceleration: Double = 0.0)

Convenience constructor that accepts raw numeric magnitudes and a unit, converting them into strongly-typed Measure and Per values used by this class.

Properties

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Functions

Link copied to clipboard
fun copy(position: Double = this.position.magnitude, velocity: Double = this.velocity.magnitude, acceleration: Double = this.acceleration.magnitude): MotionState<U>

Creates a copy of this motion state with optionally modified values using raw doubles.

Link copied to clipboard
operator fun div(divisor: Double): MotionState<U>
operator fun div(divisor: Number): MotionState<U>

Divides this motion state by a scalar, component-wise.

Link copied to clipboard
operator fun minus(other: MotionState<U>): MotionState<U>

Subtracts another motion state from this one, component-wise.

Link copied to clipboard
operator fun plus(other: MotionState<U>): MotionState<U>

Adds another motion state to this one, component-wise.

Link copied to clipboard
operator fun times(scalar: Double): MotionState<U>
operator fun times(scalar: Number): MotionState<U>

Multiplies this motion state by a scalar, component-wise.

Link copied to clipboard

Converts this motion state to a 3-element vector.

Link copied to clipboard
operator fun unaryMinus(): MotionState<U>

Returns the negation of this motion state.