Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RevLib positionConversionFactor() config function doesn't work when using SparkMaxSim #81

Open
jwt388 opened this issue Dec 20, 2024 · 1 comment
Labels
bug Something isn't working REV Robotics

Comments

@jwt388
Copy link

jwt388 commented Dec 20, 2024

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:

  1. Create a simulation using SparkMaxSim per the Rev example
  2. In positionConversionFactor(N), use a number other than 1.0, ie one that is actual doing something other resetting to default
  3. In VSCode Simulate robot code
  4. Compare velocity and position outputs taking into account specified scaling on each

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)

@jwt388 jwt388 added the bug Something isn't working label Dec 20, 2024
@doleksy
Copy link

doleksy commented Dec 24, 2024

This will be fixed in the next release

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working REV Robotics
Projects
None yet
Development

No branches or pull requests

3 participants