Dönüşümler

Translation2d

Bir Translation2d üzerindeki işlemler, Translation2d ile temsil edilen vektör üzerinde işlemler gerçekleştirir.

  • Addition: Addition between two Translation2d a and b can be performed using plus in Java, or the + operator in C++/Python. Addition adds the two vectors.

  • Subtraction: Subtraction between two Translation2d can be performed using minus in Java, or the binary - operator in C++/Python. Subtraction subtracts the two vectors.

  • Multiplication: Multiplication of a Translation2d and a scalar can be performed using times in Java, or the * operator in C++/Python. This multiplies the vector by the scalar.

  • Division: Division of a Translation2d and a scalar can be performed using div in Java, or the / operator in C++/Python. This divides the vector by the scalar.

  • Döndürme: Bir Translation2d nin saat yönünün tersine dönüşle döndürülmesi \(\theta\), rotateBy kullanılarak orijin etrafında yapılabilir. Bu, vektörün matrisle çarpılmasına eşdeğerdir \(\begin{bmatrix} cos\theta & -sin\theta \\ sin\theta & cos\theta \end{bmatrix}\)

  • Additionally, you can rotate a Translation2d by 180 degrees by using unaryMinus in Java, or the unary - operator in C++/Python.

Rotation2d

Rotation2d için dönüşümler, Rotation2d ile temsil edilen açı ölçüsündeki aritmetik işlemlerdir.

  • plus (Java) or + (C++/Python): Adds the rotation component of other to this Rotation2d’s rotation component

  • minus (Java) or binary - (C++/Python): Subtracts the rotation component of other to this Rotation2d’s rotation component

  • unaryMinus (Java) or unary - (C++/Python): Multiplies the rotation component by a scalar of -1.

  • times (Java) or * (C++/Python) : Multiplies the rotation component by a scalar.

Transform2d ve Twist2d

WPILib provides 2 classes, Transform2d (Java, C++, Python), which represents a transformation to a pose, and Twist2d (Java, C++, Python) which represents a movement along an arc. Transform2d and Twist2d all have x, y and \(\theta\) components.

Transform2d, göreceli-relative bir dönüşümü temsil eder. Bir öteleme ve döndürme bileşenine sahiptir. Bir Pose2d nin bir Transform2d ile dönüştürülmesi, dönüşümün çeviri bileşenini pozun dönüşüyle döndürür ve ardından döndürülen çeviri bileşenini ve döndürme bileşenini poza ekler. Başka bir deyişle, Pose2d.plus(Transform2d) şunu döndürür \(\begin{bmatrix} x_p \\ y_p \\ \theta_p \end{bmatrix}+\begin{bmatrix} cos\theta_p & -sin\theta_p & 0 \\ sin\theta_p & cos\theta_p & 0 \\ 0 & 0 & 1 \end{bmatrix}\begin{bmatrix}x_t \\ y_t \\ \theta_t \end{bmatrix}\)

Twist2d, bir yay boyunca mesafedeki bir değişikliği temsil eder. Genellikle, bu sınıf, bir aktarma sisteminin hareketini temsil etmek için kullanılır; burada x bileşeni, sürülen ileri mesafedir, y bileşeni, yana sürülen mesafedir (sol pozitif) ve \(\theta\) bileşeni, başlıktaki değişiklik. Poz üstelini bulmanın ardında yatan matematik (pozu bükülmenin eğriliği boyunca ileriye doğru hareket ettirdikten sonra yeni poz) 10. bölümde burada _ bulunabilir.

Not

Holonomik olmayan aktarma organları için, bir Twist2d nin y bileşeni her zaman 0 olmalıdır.

Both classes can be used to estimate robot location. Twist2d is used in WPILib’s odometry classes to update the robot’s pose based on movement, while Transform2d can be used to estimate the robot’s global position from vision data.