Class Twist3d

java.lang.Object
edu.wpi.first.math.geometry.Twist3d
All Implemented Interfaces:
ProtobufSerializable, StructSerializable, WPISerializable

public class Twist3d extends Object implements ProtobufSerializable, StructSerializable
A change in distance along a 3D arc since the last pose update. We can use ideas from differential calculus to create new Pose3d objects from a Twist3d and vice versa.

A Twist can be used to represent a difference between two poses.

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    double
    Linear "dx" component.
    double
    Linear "dy" component.
    double
    Linear "dz" component.
    static final Twist3dProto
    Twist3d protobuf for serialization.
    double
    Rotation vector x component (radians).
    double
    Rotation vector y component (radians).
    double
    Rotation vector z component (radians).
    static final Twist3dStruct
    Twist3d struct for serialization.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Default constructor.
    Twist3d(double dx, double dy, double dz, double rx, double ry, double rz)
    Constructs a Twist3d with the given values.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Checks equality between this Twist3d and another object.
    exp()
    Obtain a new Transform3d from a (constant curvature) velocity.
    int
     
     

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Field Details

    • dx

      public double dx
      Linear "dx" component.
    • dy

      public double dy
      Linear "dy" component.
    • dz

      public double dz
      Linear "dz" component.
    • rx

      public double rx
      Rotation vector x component (radians).
    • ry

      public double ry
      Rotation vector y component (radians).
    • rz

      public double rz
      Rotation vector z component (radians).
    • proto

      public static final Twist3dProto proto
      Twist3d protobuf for serialization.
    • struct

      public static final Twist3dStruct struct
      Twist3d struct for serialization.
  • Constructor Details

    • Twist3d

      public Twist3d()
      Default constructor.
    • Twist3d

      public Twist3d(double dx, double dy, double dz, double rx, double ry, double rz)
      Constructs a Twist3d with the given values.
      Parameters:
      dx - Change in x direction relative to robot.
      dy - Change in y direction relative to robot.
      dz - Change in z direction relative to robot.
      rx - Rotation vector x component.
      ry - Rotation vector y component.
      rz - Rotation vector z component.
  • Method Details

    • exp

      public Transform3d exp()
      Obtain a new Transform3d from a (constant curvature) velocity.

      See Controls Engineering in the FIRST Robotics Competition section 10.2 "Pose exponential" for a derivation.

      The twist is a change in pose in the robot's coordinate frame since the previous pose update. When the user runs exp() on the twist, the user will receive the pose delta.

      "Exp" represents the pose exponential, which is solving a differential equation moving the pose forward in time.

      Returns:
      The pose delta of the robot.
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • equals

      public boolean equals(Object obj)
      Checks equality between this Twist3d and another object.
      Overrides:
      equals in class Object
      Parameters:
      obj - The other object.
      Returns:
      Whether the two objects are equal or not.
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object