Robot constantly moves forward even in autonomous

Hi, I am the only programmer on my team and have run into some issues with the code. Basically when we first got it driving it constantly moved forward when enabled. I tried broadening the deadzones but that didn’t do anything. So I then put the robot into autonomous and it still moved forward constantly even when we had zero code in the autonomous section. I have since added some auto code to see if it can overwrite what is happening but it still kept on going forward. The only error that displays on our driver station is differential drive error output not updated often enough. Does anyone know how to fix this? Our comp is this Thursday. Heres the link to the code on github. https://github.com/7905-NightHawks/Infinite-recharge-2020/tree/master/src/main/java/frc/robot

Edit: We are using Java command based 2020 framework with 4 victor spx motor controllers CAN wired.

Hmm that is wierd. Do you have your Victor’s in brake or coast mode? Brake mode might fix your problem

I’ve tried them in both brake and coast mode, it didn’t change anything.

What are the color of the LEDs in the speed controllers while it’s doing this?

left is blinking green right is blinking red

Do you make sure to set the motors to 0 when you no longer want to use them? Otherwise when you enable they’ll try to go at the last speed you told them to, even if it was a while ago

I haven’t done that. Would I just add setm_leftMotor = to 0 and same for right motors in disabled.init?

A few observations:
You have two copies of DriveSubsytem in RobotContainer. You should probably only have one.
By making the autocommand an empty instant command, you keep running the same default command as teleop, so I would expect the same beavior. Does it happen if you run a command that sets the motors to 0 in autonomous?

The command we tried in auto ran should of ran for 3 seconds then set the motors to zero but it didn’t do anything.

How did you run that command? Is it different then what is posted in GitHub? This line just causes it to run an instantCommand. https://github.com/7905-NightHawks/Infinite-recharge-2020/blob/7771f83d01ba7f5c3283533767f236d6975956b7/src/main/java/frc/robot/RobotContainer.java#L170

Sorry, left it commented out because that how we drove it last.

I initiated it with

private final Command OffInitiationLine = new DriveForwardXForY(AutoConstants.simpleDriveForwardPower, AutoConstants.simpleDriveForwardtime);

// add auto options to chooser

m_chooser.setDefaultOption(“OffInitiationLine”, OffInitiationLine);

//put the chooser on the dashboard

Shuffleboard.getTab(“Autonomous”).add(m_chooser);

then I selected the option on the dashboard.

however the issue also happens in teleop whenever we aren’t directly putting in inputs.

That won’t do anything unless you also changed the line I linked in order to return the command selected by the chooser.

1 Like

ah ok, i’ll try that out and i’ll see if that stops the motors from always going forward. Thanks!

Do you configure the victors to factory default. There is a possibility that they have a non-zero default output. You can check for that in the tuner.

We calibrated them to our drive controller using the calibration mode but haven’t tried resetting them to factory default.

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.