Files
allwpilib/wpimath/src/main/python/semiwrap/MecanumDriveKinematics.yml
Tyler Veness 9bd9656871 [wpimath] Replace Speeds with Velocities (#8479)
I left "free speed" alone since that's the technical term for it. In
general, velocity is a vector quantity, and speed is a magnitude (i.e.,
a strictly positive value).

This PR also replaces the speed verbiage in MotorController with duty
cycle.

Fixes #8423.
2026-03-06 14:19:15 -08:00

56 lines
2.4 KiB
YAML

extra_includes:
- wpystruct.h
classes:
wpi::math::MecanumDriveKinematics:
methods:
MecanumDriveKinematics:
ToWheelVelocities:
doc: |
Performs inverse kinematics to return the wheel velocities from a desired
chassis velocity. This method is often used to convert joystick values into
wheel velocities.
This function also supports variable centers of rotation. During normal
operations, the center of rotation is usually the same as the physical
center of the robot; therefore, the argument is defaulted to that use case.
However, if you wish to change the center of rotation for evasive
maneuvers, vision alignment, or for any other use case, you can do so.
:param chassisVelocities: The desired chassis velocity.
:param centerOfRotation: The center of rotation. For example, if you set the
center of rotation at one corner of the robot and
provide a chassis velocity that only has a dtheta
component, the robot will rotate around that
corner.
:returns: The wheel velocities. Use caution because they are not normalized.
Sometimes, a user input may cause one of the wheel velocities to go
above the attainable max velocity. Use the
:meth:`MecanumDriveWheelVelocities.normalize` method to rectify
this issue. In addition, you can use Python unpacking syntax
to directly assign the wheel velocities to variables::
fl, fr, bl, br = kinematics.toWheelVelocities(chassisVelocities)
overloads:
const ChassisVelocities&, const Translation2d& [const]:
const ChassisVelocities& [const]:
ToChassisVelocities:
ToTwist2d:
overloads:
const MecanumDriveWheelPositions&, const MecanumDriveWheelPositions& [const]:
const MecanumDriveWheelPositions& [const]:
GetFrontLeft:
GetFrontRight:
GetRearLeft:
GetRearRight:
Interpolate:
ToChassisAccelerations:
ToWheelAccelerations:
overloads:
const ChassisAccelerations&, const Translation2d& [const]:
const ChassisAccelerations& [const]:
inline_code: |
SetupWPyStruct<wpi::math::MecanumDriveKinematics>(cls_MecanumDriveKinematics);