Skip to content

Commit

Permalink
Port the change to python
Browse files Browse the repository at this point in the history
  • Loading branch information
TheComputer314 committed Dec 31, 2024
1 parent 6ccae3c commit 0d2f681
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion pathplannerlib-python/pathplannerlib/util/swerve.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,12 @@ def generateSetpoint(self, prev_setpoint: SwerveSetpoint, desired_state_robot_re
else:
input_voltage = max(input_voltage, self._brownoutVoltage)

maxSpeed = self._config.moduleConfig.maxDriveVelocityMPS * min(1, input_voltage / 12)

desired_module_states = self._config.toSwerveModuleStates(desired_state_robot_relative)
# Make sure desired_state respects velocity limits.
SwerveDrive4Kinematics.desaturateWheelSpeeds(desired_module_states,
self._config.moduleConfig.maxDriveVelocityMPS)
maxSpeed)
desired_state_robot_relative = self._config.toChassisSpeeds(desired_module_states)

# Special case: desired_state is a complete stop. In this case, module angle is arbitrary, so
Expand Down

0 comments on commit 0d2f681

Please sign in to comment.