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
In REVLib C++, simulating a Spark using SparkFlexSim or SparkMaxSim results in no change to the reported position or velocity of the device.
Expected behavior
when the robot state in sim gui is set to enabled, the spark devices should gain a positive velocity and change position over time. Applied output, motor current and setpoint should also change.
Actual behavior
position, velocity, applied output and motor current all stay at zero. The setpoint does change as expected.
Screenshots
As a reference, this is what happens when the equivalent code in Java in simulated:
(A little strange that the velocity jumps at the beginning, but that seems like a different issue.)
The above java example uses this code:
Attempting to "bypass" the iterate() function and instead calling m_flexSim.SetVelocity() or m_flexSim.SetPosition() directly results in the same issue: no change to the device velocity in sim gui.
There is also no change to the various encoder devices in sim gui ("SPARK MAX [1] RELATIVE ENCODER", etc)
The text was updated successfully, but these errors were encountered:
Thanks for looking into the issue.
Interestingly, that is not the behavior I am seeing when running with constant numbers in iterate(). This is the simplest I can think to make it, and I still don't see any movement on the sim:
I can also bypass iterate() entirely by running SetVelocity() and SetPosition() and the sim still stays at all zero (except the setpoint, which does change to match any spark.Set() calls)
The core of this issue seems to be fixed in REVLib beta 4. Iterate() now successfully changes the sim position and velocity 🙂.
However, applied output still stays at zero (unlike the Java version, where it changes accordingly after any spark.Set() calls or closedLoopController.SetReference() calls). Fixing that to behave the same as it does in the Java version should enable the use of WPI mechanism simulation like in my example code linked above.
Simulated motor current also still has some strange behavior. Rather than spiking during accelerations and then dropping back to zero as the motor reaches its max velocity, the current instead stays at its maximum. I see my simulated flex+vortex sitting at -211 Motor Current in the sim with a 1.0 duty cycle, whereas with the equivalent Java code it hits that value then decreases back to 0.
Describe the bug
In REVLib C++, simulating a Spark using SparkFlexSim or SparkMaxSim results in no change to the reported position or velocity of the device.
To Reproduce
Error is present when simulating this project: https://github.com/Liam-Stow/2025-spark-sim/blob/main/src/main/cpp/Robot.cpp
As a quick reference:
Expected behavior
when the robot state in sim gui is set to enabled, the spark devices should gain a positive velocity and change position over time. Applied output, motor current and setpoint should also change.
Actual behavior
position, velocity, applied output and motor current all stay at zero. The setpoint does change as expected.
Screenshots
As a reference, this is what happens when the equivalent code in Java in simulated:
(A little strange that the velocity jumps at the beginning, but that seems like a different issue.)
The above java example uses this code:
Desktop:
Additional context
The text was updated successfully, but these errors were encountered: