l am a new to swerve and l am reading the Swerve Drive Manual by Ether.pdf. While l read this pdf , l have some question about it and my question is below.

Deriving the inverse kinematics of swerve is basically finding the module velocity vectors that correspond to the robot state, which consists of the robot’s translation velocity, and its angular velocity. Those module velocity vectors are found by calculating the vector sum of velocity vectors resulting from only translation and only rotation. In your question, the circled part concerns rotation.

To rotate the swerve, each module will have to drive in a direction perpendicular to the center–or else, there would be wheel scrub. The vector r could be denoted by (W/2, L/2). The vector perpendicular to it would then be (L/2, -W/2). Multiply this vector by the rotation magnitude, and you would get what is shown in Ether’s derivation.

IIRC, omega should also be a vector, pointing outside the page, and the multiplication is actually a cross product, which would yield a vector perpendicular to both of the given vectors according to the right hand rule

Thanks . l have found it , l do this because l just want to know the work principle of swerve. And when l read the WPILIB’s official swerve code , l have some questions , and that is below;

In the code below , what 's the unit of 0.381

Translation2d m_frontLeftLocation = new Translation2d(0.381, 0.381);

For a lot of the examples, we started in imperial units then converted to SI units since WPILib is standardized on SI units. In C++, it’s clearer because the “meter” unit is part of the type system. We couldn’t do something similar in Java without incurring unacceptable performance overhead.

You should choose whatever origin you want, then plug in the distances from that origin to each wheel module as it pertains to your robot. The geometric center is an obvious choice. The kinematics class lets you move that origin on the fly, so it doesn’t really matter as long as you’re consistent.

public SwerveModuleState[] toSwerveModuleStates(
ChassisSpeeds chassisSpeeds, Translation2d centerOfRotationMeters) {