Skip to content
This repository has been archived by the owner on Jan 15, 2021. It is now read-only.

CANSparkMax.set(0) does not stop PID from running #147

Open
Rain-Alderson opened this issue Feb 8, 2020 · 2 comments
Open

CANSparkMax.set(0) does not stop PID from running #147

Rain-Alderson opened this issue Feb 8, 2020 · 2 comments

Comments

@Rain-Alderson
Copy link

Describe the bug
When a PID control mode has been running on the Spark Max controller, the PID cannot be stopped by setting the output to zero. See "Additional context" for a possible cause and solution.

Quick Glance Configuration

  1. SnobotSimPlugin version 2020-0.0.1
  2. SnobotSim version 2020-0.0.1
  3. GradleRIO version 2020.2.2
  4. Your Operating System: Linux 5.3.0 (Pop!_OS 19.10)

To Reproduce

  1. Create a robot with a Spark Max controller.
  2. Simulate the robot, and run the motor with closed-loop velocity or position control.
  3. Try to stop outputting from the motor using CANSparkMax.set(0) on the motor controller.
  4. Observe that the motor continues to output.

Expected behavior
Calling the CANSparkMax.set(0) function should cause the motor to stop outputting. I have confirmed that this is what the real hardware does.

Additional context
I belive the problem is in RevManager.java:48. I think the issue is that set does not update mControlType. Changing set to setRawGoal should fix this.

I haven't tested this, but it looks like there might be a similar problem in the CTRE motor controllers as well: CtreManager:72, CtreManager:92, CtreManager:132

@pjreiniger
Copy link
Collaborator

What version of rev do are you using? I just noticed today that CTRE added super simple set() / get() stuff for the wpilib simulator in 5.17.6, REV might have done the same. I'm fixing CTRE right now

@Rain-Alderson
Copy link
Author

I'm using RevRobotics version 1.5.1. The set function I was talking about was this one.

Are you talking about these functions in the phoenix API? I'm not aware of any similar simulation functions for REV.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants