Robot Arm Victor Motor

Our team’s mechanical engineer insist’s our arm not working is a program error. I don’t think so, so I just want to double check here.


Victor arm;

public void robotMain() {
    arm = new Victor(10);
}

public void operatorControl() {
    while(isOperatorControl()) {
        getWatchdog().setEnabled(true);
        getWatchdog().feed();

        if(joy.getRawButton(10)) {
            arm.set(-0.2); // arm goes down.
        } else if(joy.getRawButton(11)) {
            arm.set(0.2); // arm goes up.
        }
    }
}

Can you describe what the problem with the arm is? Just looking at the code, once the arm starts moving, the arm will always be moving in one direction or the other, which might not be desirable.

public void operatorControl() {
    while(isOperatorControl()) {
        getWatchdog().setEnabled(true);
        getWatchdog().feed();

        if(joy.getRawButton(10)) {
            arm.set(-0.2); // arm goes down.
        } else if(joy.getRawButton(11)) {
            arm.set(0.2); // arm goes up.
        } else {
            arm.set(0);
        }
    }
}

Did you check the pwm?

Sorry, I mean the arm doesn’t move at all.
It is plugged in to channel 10.

Can you show us where you initialize arm? That may be the problem.

All arm-related code is given above. It is initalized in the robotMain function.

Here’s a number of non-code related things that could cause a motor not to move:

You didn’t enable the robot on the driver station
You didn’t plug the PWM cables from the victor to the digital sidecar PWM ports
The PWM cable missed the connector inside the shroud on the victor (this is very easy to do).
You didn’t power the digital sidecar
The digital sidecar isn’t plugged into the digital module in slot 4 of the cRIO
You have the PWM cables plugged in backwards. B is for black wire.
You have the PWM cables plugged into the wrong PWM ports on the digital sidecar.
The circuit breaker is immediately tripping.
The speed controller isn’t powered.
The motor isn’t connected to the speed controller.

Knowing what the LED is doing on the speed controller would help narrow down the problem

We covered the majority of those grounds last night. We plan on re-checking today after school.

However, the motor is getting power, and is blinking orange.

Are you sure you are pushing “Button 10 and Button 11”?

For laughs and tickles try using the joystick value to eliminate any posability that it is the mechanical/elecrtical problems.

x2 on checking the connection of the pwm cable.

I hated redoing pwm cables on the victors they always seem to not go into the header when you need it to!

Blinking orange on the Victor suggests a problem with the PWM cable connection (or you never initialized “arm”).

In the actual code we had only done:

Victor arm = new Victor(10);

outside of robotMain. Could that actually be the problem? I never thought it mattered.

Are you sure that 0.2 will overcome the inertia of the arm? Do the motors hum or get warm at all? You can test the output side of the victor with a multimeter.

The multimeter shows no change.

The code shown is too simple to be ‘wrong’. (though the addition of else … 0.0 is a good idea).
The initialization issue mentioned by Jared341 would throw an exception (null pointer) in most, but not all cases. You need to make sure the object stays in scope all the time. Its not clear from your response to him if it does or not. Are you leaving the scope of the declaration right after setting the motor for instance? That would show no errors and not work.

What do you mean “leaving the scope”?

An object only exists when in scope. For instance if you declare a variable in a method it is created and destroyed when the method is entered and exited.
I usually declare a motor in a class and call that classes constructor from my top level class (I use SimpleRobot usually) that way the motor exists from when the class is first instantiated and never goes away until exit.

The scenario I mentioned in the previous post only occurs when you do something like

public void motorStuff(){
motor = new Jaguar(1);
Jaguar.set(0.5);
}

The motor controller object will go away before it has time to do anything. Even if you call it repeatedly it won’t last long enough to run for more than microseconds.

It doesn’t seem to be the problem from the code you posted, but it doesn’t hurt to ask.

To me, this remains the most conspicuous clue. A blinking orange speed controller is one that does not have a working connection to a properly configured PWM port on the digital sidecar. Be absolutely, positively sure your PWM connector is fully seated at both ends.

Our mechanical team is tinkering with it now. I’ll let you guys know what happens in the end. Thanks for all the advice.

Try connecting the arm to a pwm port with an address less than 9 (ie. 1 to 8). I have not personally used so many motors in the past but the schematics show that channels 9 and 10 are wired slightly differently than 1 - 8. You should try using a higher pulse duty cycle. Finally check to make sure that the black wire in the WRB cable is in the correct position. Victors allow the wire header to be inserted backwards.