PoseAcceleration2d

Represents the acceleration of a 2D pose in the global (field) frame.

A pose acceleration describes how a pose velocity changes over time and consists of:

  • Linear acceleration: \(\mathbf{a}\) - the acceleration of the position in field coordinates

  • Angular acceleration: \(\alpha\) - the rate of change of angular velocity (frame-invariant)

PoseAcceleration2d vs ChassisAccelerations

PoseAcceleration2d represents accelerations in the global (field) frame:

  • The x-axis and y-axis are fixed to the field

  • Linear accelerations are expressed in field coordinates

  • Natural for trajectory generation and feedforward control

  • Includes effects from changing the robot's orientation

ChassisAccelerations represents accelerations in the robot's local frame (body frame):

  • The x-axis points forward, y-axis points left (from robot's perspective)

  • Linear accelerations are relative to the robot's orientation

  • Natural for motor control and dynamic modeling

  • Does not directly include centripetal acceleration effects

Important Note on Rotating Frames

When a robot is rotating, the relationship between chassis and field accelerations is more complex than for velocities. The field acceleration includes:

  1. The rotated chassis acceleration

  2. Centripetal acceleration: \(\mathbf{a}_{centripetal} = \omega \times \mathbf{v}\)

Where \(\omega\) is angular velocity and \(\mathbf{v}\) is the velocity vector.

Kinematic Integration

Given an initial velocity \(\mathbf{v}_0\) and a time step \(\Delta t\), the new velocity is: \(\mathbf{v}(t + \Delta t) = \mathbf{v}_0 + \mathbf{a} \cdot \Delta t\)

Similarly for angular components: \(\omega(t + \Delta t) = \omega_0 + \alpha \cdot \Delta t\)

Example Usage

// Robot accelerating at 5 in/s² in the field's x-direction
val poseAcc = PoseAcceleration2d(
linearAcc = Vector2d(5.0.inchesPerSecondSquared, 0.0.inchesPerSecondSquared),
angAcc = 0.1.radiansPerSecondSquared
)

// Integrate to get velocity after 0.1 seconds
val dt = 0.1.seconds
val initialVel = PoseVelocity2d.zero
val newVel = poseAcc.integrateToVel(dt, initialVel)

// For trajectory control, often converted to chassis frame:
val chassisAcc = ChassisAccelerations(
linearAcc = pose.heading.inverse() * poseAcc.linearAcc,
angAcc = poseAcc.angAcc
)

See also

for accelerations in the robot's local frame

Constructors

Link copied to clipboard

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard

angular acceleration (frame-invariant)

Link copied to clipboard

linear acceleration in the global (field) frame

Functions

Link copied to clipboard
operator fun div(scalar: Double): PoseAcceleration2d

Divides the pose acceleration by a scalar.

Link copied to clipboard
fun integrateToVel(dt: Time, initial: PoseVelocity2d = PoseVelocity2d.zero): PoseVelocity2d

Uses kinematic integration to compute a new velocity given a time step and initial velocity.

Link copied to clipboard

Linear interpolation (lerp) toward another pose acceleration.

Link copied to clipboard

Subtracts two pose accelerations component-wise.

Link copied to clipboard

Adds two pose accelerations component-wise.

Link copied to clipboard
operator fun times(scalar: Double): PoseAcceleration2d

Multiplies the pose acceleration by a scalar.

Link copied to clipboard

Converts this pose acceleration (global frame) to a chassis acceleration (local frame).

Link copied to clipboard

Negates the pose acceleration.