Robot Spins on Start

Hello, our team is reconstructing a robot, and it is simply giving full power to the chassis motors when starting. It is not a programming issue, as it is disabled, and there is no code in the disabled method. Any thoughts? It still happens whenever the PWM cables are removed.

Just to be safe, can you provide your code?

Is there any short or problem with your motor controllers that could be providing the motors power?

Verify that it can happen while the robot is disabled and when the PWMs are unplugged. If this is the case then you have an electrical issues which you should be able to find by tracing each of your wires.

If you can’t find it visually you could first unplug everything, then slowly plug things back in (after turning the robot off again) and finding which individual thing is causing, or part of the problem. Do this as a last resort though, as forcing your robot to short like this isn’t the best solution.

I am our team’s programmer, so I will post code, but I am certain that it is not the issue.

This code is from Ultimate Ascent, but it was our very basic rookie code.

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.Jaguar;
import edu.wpi.first.wpilibj.Joystick;
import edu.wpi.first.wpilibj.RobotDrive;
import edu.wpi.first.wpilibj.SimpleRobot;
import edu.wpi.first.wpilibj.Timer;
import edu.wpi.first.wpilibj.camera.AxisCamera;

/**
 * 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 RobotTemplate extends SimpleRobot {
    /**
     * This function is called once each time the robot enters autonomous mode.
     */
    
    RobotDrive chassis = new RobotDrive (1, 2);
    Joystick leftStick = new Joystick(1);
    Joystick rightStick = new Joystick(2);
    Jaguar shooterMotor1 = new Jaguar(3);
    Jaguar shooterMotor2 = new Jaguar(4);
    AxisCamera camera;
    
    public void autonomous() {
        /*
        chassis.setSafetyEnabled(false);
        chassis.drive(-0.5, 0.0);
        Timer.delay(2.0);
        chassis.drive(0.0, 0.0);
        */
    }
    
    public void disabled() {
        chassis.drive(0.0, 0.0);
        
    }
    
    /**
     * This function is called once each time the robot enters operator control.
     */
    public void operatorControl() {
        chassis.setSafetyEnabled(true);
        // value from joystick's wheel
        double v1;
        camera = AxisCamera.getInstance();
        chassis.drive(0.0, 0.0);
        while (isOperatorControl() && isEnabled()) {
            
            double left = leftStick.getY();
            double right = rightStick.getY();
            
//            if (left > -.1 && left < .1)
//            {
//                left = 0;
//            }
//            if (right > -.1 && right < .1)
//            {
//                right = 0;
//            }
            
            if (right < 0)
            {
                right = -1 * right * right;
            }
            if (right > 0)
            {
                right = right * right;
            }
            
            if (left < 0)
            {
                left = -1 * left * left;
            }
            if (left > 0)
            {
                left = left * left;
            }
            
            chassis.tankDrive(left, right);
            
            // get value from the little wheel below stick
            v1 = leftStick.getRawAxis(3);
            // -1.0 is all the way up, 1.0 all the way down
            //System.out.println(v1);
            shooterMotor1.set(-v1);
            shooterMotor2.set(-v1);
            
            Timer.delay(0.01);
            
            
        }

    }
    
    /**
     * This function is called once each time the robot enters test mode.
     */
    public void test() {
        chassis.setSafetyEnabled(false);
        chassis.drive(1, 1);
        Timer.delay(2.0);
        chassis.drive(-1, -1);
        Timer.delay(2.0);
        chassis.drive(0.0, 0.0);
    }
}

The robot is disabled and PWM unplugged and it is still occurring.

This sounds like a common failure mode when voltage is applied to the wrong side of your motor controllers.

Be sure that the power coming from the power distribution board goes into the terminals labelled V+ and V- on the case of your Jaguars. The motor leads should attach to the M+ and M- terminals. Unfortunately, there is no protection against applying power to the wrong side of them, and most times will not work properly again if this has occurred. The best thing to do is to trace all of your wiring to ensure it is going to the proper place.

Thank you. Apparently, the warning stickers are on the wrong side of all of our Jaguars! I hope we haven’t broken them. Can you believe that the warning sticker was on the wrong side? Can we sue?

All the terminals are marked with an M+, M-, V+, or V-. And there’s only one of each marking. The markings aren’t necessarily the clearest, though–shine a flashlight at the terminals, they’re molded into the case next to 'em.

As for breaking the Jags… Reverse voltage like that does have a tendency to release the magic smoke. If you’ve smelled magic smoke, your Jags are toast. They might work… but I wouldn’t trust them.

By the way, Cecil’s answer was the first thing I thought of when I saw the problem description…

Always double check your wiring, and then have another person double check just to be sure. Mistakes happen, and many teams have had the same thing happen (our team is no exception). If you correct the problem and they still work, then use them until they finally do die. I would highly recommend NOT using them in a competition environment again, as they will most likely fail unexpectedly, often at the worst time.

*Consider doing a root cause analysis to determine why the jags were wired improperly. This would necessarily involve determining who wired them that way, and under what circumstances. This is not a witch hunt. The purpose is not to assign blame. The purpose is to determine what changes need to be made to reduce the likelihood it will happen again. More and/or better training? Certification required in order to be permitted to do electrical work? Mandatory inspection by a second party before powering after wiring? Better labeling on all motor controllers? Better labeling of wires? All of the above? None of the above? Whatever is appropriate for your team.

What warning sticker do you mean?

Most Jaguars have a warning sticker that warns against applying an input of reversed polarity. Apparently the OP is saying the Jaguars they got had the stickers on the output side instead of the input side.

My bet is that the pwm’s are wired backward, so power is going through the signal, which is telling the motor to always be on

Power is the center pin.

I had this problem with the spike. The pwm was backward, so the compressor was always running. Maybe not the power replacing signal, but still a result of backward pwm.

I find a backwards PWM to be hard to believe. Unless someone built either the end of the PWM or the socket for it without the tabs that usually prevent backwards PWMs, OR installed the end of the PWM backwards (which is highly possible if you’re making your own cable).

The Jags are rather known for being easy to wire backwards, for a number of reasons (colored screws that can be easily swapped to denote which wire goes where, difficult markings to read, and there isn’t anything really obvious if the screws are swapped around). I’ve seen someone wire power to both sides of one, and motors to both sides of another one–thankfully that was caught before power-on! I’ve yet to hear of anybody actually swapping a PWM around on one. Talons and Victors were harder to mistake the markings, but still could have their input/output swapped fairly easily.

In this case a Sharpie could have been a real friend. In the future use one to mark** permanently **the power inputs and motor outputs. They work the same with ugly markings as they do without and it ultimately will save big bucks. There really is not way to make protection for these devices to prevent mis-wiring.

How very sad.

Yes, you can sue the inattentive student(s) who wired these. And you can sue the ignorant student(s) who did not read the instructions for using these expensive pieces of equipment. While you are at it, also sue the mentor(s) who let inattentive and ignorant students near a robot. Those actions will definitely ensure that reverse polarity will neither happen again, nor will damage Jaguars if it does.