Robot motors don't turn

Two weeks ago, everything in the robot was working, then one day we come in, and nothing works anymore; the motors don’t turn.

After a while, we find out that the jaguars are all broken somehow, so we replaced them with Victors. However, the robot still won’t work. We’ve reduced our code to the most basic so it is only controlling the motors. However, the motors still won’t turn at all.

Is there something wrong with our code?

/*----------------------------------------------------------------------------*/
/* Copyright (c) FIRST 2008. All Rights Reserved.                             */
/* Open Source Software - may be modified and shared by FRC teams. The code   */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project.                                                               */
/*----------------------------------------------------------------------------*/
package edu.wpi.first.wpilibj.templates;

import edu.wpi.first.wpilibj.RobotDrive;


import edu.wpi.first.wpilibj.SimpleRobot;

/**
 * The VM is configured to automatically run this class, and to call the
 * functions corresponding to each mode, as described in the SimpleRobot
 * documentation. If you change the name of this class or the package after
 * creating this project, you must also update the manifest file in the resource
 * directory.
 */
public class RobotTemplate1 extends SimpleRobot
  {

    /**
     * This function is called once each time the robot enters autonomous mode.
     */
    RobotDrive m_robotDrive;		// robot w'ill use PWM 1-4 for drive motors
    static final int UNINITIALIZED_DRIVE = 0;
    static final int ARCADE_DRIVE = 1;
    static final int TANK_DRIVE = 2;
    int m_driveMode;

    public void autonomous()
      {
      }

    /**
     * This function is called once each time the robot enters operator control.
     */
    public void operatorControl()
      {
        m_robotDrive = new RobotDrive(1, 2, 3, 4);
        while (isOperatorControl() && isEnabled())
          {
            m_robotDrive.setSafetyEnabled(false);
            m_driveMode = ARCADE_DRIVE;
            //m_robotDrive.arcadeDrive();
            m_robotDrive.arcadeDrive(-0.5, 1);
            System.out.println("hello");

          }
      }
  }

OK, after a few weeks of going crazy, it turns out five jaguars broke was well as the sidecar.

I would start by saying that you should initialize your robotDrive variable in a constructor to reference from anywhere.

Ex:


Public RobotTemplate1()
{
    
    m_robotDrive.setSafetyEnabled(false);
    m_robotDrive = new RobotDrive(1, 2, 3, 4);
}

And now robotDrive is set up to reference everywhere within the program.

I see that this is a test program, so arcade drive would have joystick input, but his is for it to move. You should add this to teleopPeriodic

arcadeDrive()
Timer.delay()

So does that mean that you’ve replaced those components and it’s working now? Are you all set?

Brad

Your program is fine. Tell the electrical guys that something is wrong on their end.