Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Java (http://www.chiefdelphi.com/forums/forumdisplay.php?f=184)
-   -   downloading code on to robot difficulty (http://www.chiefdelphi.com/forums/showthread.php?t=89554)

mint564 19-01-2011 11:10

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?

drakesword 19-01-2011 22:24

Re: downloading code on to robot difficulty
 
Wanna share the error?

sand500 20-01-2011 13:13

Re: downloading code on to robot difficulty
 
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?

Ryan O 20-01-2011 15:11

Re: downloading code on to robot difficulty
 
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)

mint564 22-01-2011 09:22

Re: downloading code on to robot difficulty
 
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.<in it>(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)

flameout 23-01-2011 13:13

Re: downloading code on to robot difficulty
 
Can we please see your code?

Fletch1373 23-01-2011 14:00

Re: downloading code on to robot difficulty
 
Do you have anything else using PWM channel 1? Victors, Jaguars? even if it's declared as:
Code:

new Jaguar(1)
instead of:
Code:

new Jaguar(4,1)
Slot 4 is the default Digital IO slot in the cRio.

LiquidMagik 08-02-2011 23:06

Re: downloading code on to robot difficulty
 
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:

LiquidMagik 08-02-2011 23:07

Re: downloading code on to robot difficulty
 
module 4*

Ben_R_R 09-02-2011 11:17

Re: downloading code on to robot difficulty
 
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. :)

@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.

LiquidMagik 09-02-2011 23:00

Re: downloading code on to robot difficulty
 
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

Robby Unruh 09-02-2011 23:40

Re: downloading code on to robot difficulty
 
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
Code:

// 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
Code:

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.


All times are GMT -5. The time now is 09:45.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi