:py:mod:`phoenix6.swerve.utility.wheel_force_calculator` ======================================================== .. py:module:: phoenix6.swerve.utility.wheel_force_calculator Module Contents --------------- .. py:class:: WheelForceCalculator(module_locations: list[phoenix6.swerve.utility.geometry.Translation2d], mass_kg: float, moi_kg_m_sq: float) Calculates wheel force feedforwards for a SwerveDrivetrain. Wheel force feedforwards can be used to improve accuracy of path following in regions of acceleration. Many path planning libraries (such as PathPlanner and Choreo) already provide per-module force feedforwards, which should be preferred over this class. Constructs a new wheel force feedforward calculator for the given drivetrain characteristics. :param module_locations: The drivetrain swerve module locations :type module_locations: list[Translation2d] :param mass_kg: The mass of the robot in kg :type mass_kg: float :param moi_kg_m_sq: The moment of inertia of the robot in kg m^2 :type moi_kg_m_sq: float .. py:class:: Feedforwards(num_modules: int) Wheel force feedforwards to apply to a swerve drivetrain. Constructs a new set of wheel force feedforwards. :param num_modules: The number of swerve modules :type num_modules: int .. py:attribute:: x_newtons The X component of the forces in Newtons. .. py:attribute:: y_newtons The Y component of the forces in Newtons. .. py:method:: calculate(acceleration: phoenix6.swerve.utility.kinematics.ChassisAccelerations, center_of_rotation: phoenix6.swerve.utility.geometry.Translation2d = Translation2d()) -> Feedforwards Calculates wheel force feedforwards for the desired robot acceleration. This can be used with either robot-centric or field-centric accelerations; the returned force feedforwards will match in being robot-/field-centric. :param acceleration: Acceleration of the robot :type acceleration: ChassisAccelerations :param center_of_rotation: Center of rotation :type center_of_rotation: Translation2d :returns: Wheel force feedforwards to apply :rtype: Feedforwards .. py:method:: calculate_from_velocities(dt: float, prev: phoenix6.swerve.utility.kinematics.ChassisVelocities, current: phoenix6.swerve.utility.kinematics.ChassisVelocities, center_of_rotation: phoenix6.swerve.utility.geometry.Translation2d = Translation2d()) -> Feedforwards Calculates wheel force feedforwards for the desired change in velocity. This can be used with either robot-centric or field-centric velocities; the returned force feedforwards will match in being robot-/field-centric. :param dt: The change in time between the path setpoints :type dt: float :param prev: The previous ChassisVelocities setpoint of the path :type prev: ChassisVelocities :param current: The new ChassisVelocities setpoint of the path :type current: ChassisVelocities :param center_of_rotation: Center of rotation :type center_of_rotation: Translation2d :returns: Wheel force feedforwards to apply :rtype: Feedforwards