downloading code on to robot difficulty

my team is having difficulty with downloading code once we edit it. we can download the default code just fine, but once we edit it we start having issues. we used java last year with no real problems like this.

when we compile our code there are no problems, but when we download our code it gives us an error saying that one of the jaguars we declared in our code is already being used, even though it isnt being used in anyway that i can see. we tried removing it then which made the code the same as the default, but we continue to have the same problem.

Does anyone know why its doing this?

Wanna share the error?

you mean like imaging the Crio with the code right? or do you mean like what netbeans does. Are you running the code from netbeans or like what you would do in the competition with the drivers station stuff?

Are you just adding a Jaguar without any other modifications? Is there a stack trace/exception being given?

The default code may have defined some things as examples, though I doubt it. What is the exact error and how is it shown? In the console output, error dialog?

And what/where are you coding? Java w/ FRC Plug-ins in NetBeans or Eclipse? Also, have you updated to the latest version of whichever plug-ins you are using? (the SDK was updated in the last few days)

we’re using netbeans, and w’ere declaring Jaguars the same way we did last year:

Jaguar one = new Jaguar(4,1);

um well this is what the error comes up as:

Uncaught exception in Thread.run():
[cRIO] on thread edu.wpi.first.wpilibj.defaultCode.DefaultRobot - main
[cRIO] edu.wpi.first.wpilibj.util.AllocationException: PWM channel 1 on module 4 is already allocated
[cRIO] at edu.wpi.first.wpilibj.PWM.initPWM(PWM.java:112)
[cRIO] at edu.wpi.first.wpilibj.PWM.<init>(PWM.java:141)
[cRIO] at edu.wpi.first.wpilibj.SafePWM.<init>(SafePWM.java:33)
[cRIO] at edu.wpi.first.wpilibj.Jaguar.<init>(Jaguar.java:41)
[cRIO] at edu.wpi.first.wpilibj.RobotDrive.<init>(RobotDrive.java:84)
[cRIO] at edu.wpi.first.wpilibj.defaultCode.DefaultRobot.<init>(DefaultRobot.java:125)
[cRIO] in virtual method #11 of com.sun.squawk.Klass(bci=53)
[cRIO] at com.sun.squawk.imp.MIDletMainWrapper.main(99)
[cRIO] in virtual method #95 of com.sun.squawk.Klass(bci=25)
[cRIO] at com.sun.squawk.Isolate.run(1506)
[cRIO] at java.lang.Thread.run(231)
[cRIO] in virtual method #47 of com.sun.squawk.VMThread(bci=42)
[cRIO] in static method #3 of com.sun.squawk.VM(bci=6)

Can we please see your code?

Do you have anything else using PWM channel 1? Victors, Jaguars? even if it’s declared as:

new Jaguar(1)

instead of:

new Jaguar(4,1)

Slot 4 is the default Digital IO slot in the cRio.

we are having the same exact error except with a DigitalInput. the error line is instead:

[cRIO] edu.wpi.first.wpilibj.util.AllocationException: Digital channel 1 on module is already allocated

i dont think anyone replied with advice to the team and it has been a week or two so i assume the problem has been fixed. help? only 14 days left!:ahh:

module 4*

Solution to the original problem in case anyone else has this problem:

Check if you are declaring any new RobotDrive objects. If I recall the default code robot drive takes 4 PWM channels as arguments, but it will work if you are running the motors off the first 2 PWM channels. If you are only using 2 PWMs to run your motors, you can free up the extra channels like so:

Find this line:

m_robotDrive = new RobotDrive(1, 3, 2, 4);

Change to:

m_robotDrive = new RobotDrive(1, 2);

See if that helps. :slight_smile:

@LiquidMagik

check along the same lines as above. Make sure none of the other objects are using the digital channel 1. If you can’t find anything, see if the problem goes away when you change channels.

Thank you for the help but we use different classes since we are using omni drive. We have each individual motor object from the victor class. We’ll talk with our programming brobo tomorrow.

THANKS team 649

Our team is using omni/mecanum wheels this year as well. I was just thinking, we had this same error and all too with our servos, and I think it might have something to do with not defining slots on any of the others.

such as


// see driver station dashboard for module numbers
Gyro gyro = new Gyro(1); // Gyro in PWM channel 1
Servo servo = new Servo(4,1); // Servo in Digital IO channel 1

Do you think it might have to be


Gyro gyro = new Gyro(1,1);
Servo servo = new Servo(4,1);

for it to work correctly?

All just complete guessing, I’m kind of hopeless right now, it seems the robot just doesn’t want to cooperate this month. :yikes:
If anyone finds the real answer, please share!

Thanks.