You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
The positionConversionFactor() function used to configure encoder input scaling works as expected with real hardware, but not in simulation. In simulation a scale factor of N is being applied as 1/N making the position returned in simulation off by N^2.
To Reproduce
Steps to reproduce the behavior:
Create a simulation using SparkMaxSim per the Rev example
In positionConversionFactor(N), use a number other than 1.0, ie one that is actual doing something other resetting to default
In VSCode Simulate robot code
Compare velocity and position outputs taking into account specified scaling on each
Apply code at line 87 and remove workaround at line 123 to display raw getposition()
Expected behavior
In mode real and simulation modes getposition() returns a position that changes at a rate consistent with velocity when considering the specified scaling for both
Additional context
This is a both a bad example of how to use the new API and an (almost) useless test case:
Something like this would be nice. (correct if I got it wrong):
// Configure scaling to show output for Gear ratio of 10:1 and position in degrees
config
.encoder
.positionConversionFactor(0.1)
.velocityConversionFactor(0.1 * 360.0)
The text was updated successfully, but these errors were encountered:
Describe the bug
The positionConversionFactor() function used to configure encoder input scaling works as expected with real hardware, but not in simulation. In simulation a scale factor of N is being applied as 1/N making the position returned in simulation off by N^2.
To Reproduce
Steps to reproduce the behavior:
https://github.com/ToughTechs151/MotorSpeedControl/blob/InvestigateRevLibBugs/src/main/java/frc/robot/subsystems/MotorSubsystem.java
Expected behavior
In mode real and simulation modes getposition() returns a position that changes at a rate consistent with velocity when considering the specified scaling for both
Additional context
This is a both a bad example of how to use the new API and an (almost) useless test case:
config
.encoder
.positionConversionFactor(1.0)
.velocityConversionFactor(1.0)
Something like this would be nice. (correct if I got it wrong):
// Configure scaling to show output for Gear ratio of 10:1 and position in degrees
config
.encoder
.positionConversionFactor(0.1)
.velocityConversionFactor(0.1 * 360.0)
The text was updated successfully, but these errors were encountered: