Deploying Problems with Gyros and Victors

Hello CD,

Using Commandbased robot templating system, our programming department has successfully created tankdrive code. We are trying to implement the gyroscope for drivestraight methods, but we keep getting deploying errors, especially:

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

Would it be possible for any team to post working java code with a gyro enabled, so we can see how you initialize the gyros, as well as your speed controllers.

Thank you so much. :]

This error means that you have created two sensors on the same channel in your code. Look through your code to check if two of your ports are the same or that two identical objects are created in different places.

I have posted a new project just with the gyro initialized. Here is the Github link and console error output.

Can someone please help us? We cannot figure out the problem. Thank you so much CD. :]

https://github.com/team4element/team4gyro

ant -f "/App Development/github/team4gyro/team4gyro" deploy run
clean:
Deleting directory /App Development/github/team4gyro/team4gyro/build
Created dir: /App Development/github/team4gyro/team4gyro/build
Created dir: /App Development/github/team4gyro/team4gyro/build/classes
[crio-compile] ./src, /Users/Shawn/sunspotfrcsdk/lib/wpilibj.jar:/Users/Shawn/sunspotfrcsdk/lib/networktables-crio.jar, /Users/Shawn/sunspotfrcsdk/lib/squawk.jar -> ./build/classes
Compiling 8 source files to /App Development/github/team4gyro/team4gyro/build/classes
compile:
preverify:
Created dir: /App Development/github/team4gyro/team4gyro/build/preverify
Created dir: /App Development/github/team4gyro/team4gyro/build/preverify.raw.util
[crio-preverify] ./build/classes, , /Users/Shawn/sunspotfrcsdk/lib/wpilibj.jar:/Users/Shawn/sunspotfrcsdk/lib/networktables-crio.jar, /Users/Shawn/sunspotfrcsdk/lib/squawk.jar -> ./build/preverify
Expanding: /Users/Shawn/sunspotfrcsdk/lib/wpilibj.jar into /App Development/github/team4gyro/team4gyro/build/preverify
Expanding: /Users/Shawn/sunspotfrcsdk/lib/networktables-crio.jar into /App Development/github/team4gyro/team4gyro/build/preverify
jar:
[crio-jar] ./build/preverify, ./resources -> ./build/app.jar
Building jar: /App Development/github/team4gyro/team4gyro/build/app.jar
suite:
Created dir: /App Development/github/team4gyro/team4gyro/build/suite
[crio-suite] ./build/app.jar -> ./build/suite/image
CompilerOracle: exclude com/sun/squawk/Method.getParameterTypes
CompilerOracle: exclude com/sun/squawk/SymbolParser.getSignatureTypeAt
CompilerOracle: exclude com/sun/squawk/SymbolParser.stripMethods
[translating suite image [closed: false, parent: squawk] ...]
### Excluding compile: com.sun.squawk.Method::getParameterTypes
### Excluding compile: com.sun.squawk.SymbolParser::getSignatureTypeAt
[Including resource: META-INF/MANIFEST.MF]
Romizer processed 384 classes and generated 4 files.
Expanding: /App Development/github/team4gyro/team4gyro/build/app.jar into /App Development/github/team4gyro/team4gyro/build/suite
Moving 1 file to /App Development/github/team4gyro/team4gyro/build/suite
Moving 1 file to /App Development/github/team4gyro/team4gyro/build/suite
Moving 1 file to /App Development/github/team4gyro/team4gyro/build/suite
Deleting: /App Development/github/team4gyro/team4gyro/image.suite.api
deploy:
[crio-configure] Configuration files not included in this version of the sdk
[crio-configure] Checking that crio is configured for Java
Host OS: Mac OS X 10.8.2, 10.8.2
Host JVM: Java HotSpot(TM) 64-Bit Server VM 23.6-b04
Target IP: 10.0.4.2
Network interfaces on host:
    en2:  address: 10.0.4.10 netmask: 255.255.255.0 <--- on robot's subnet
Connecting FTP @10.0.4.2
[crio-deploy] ./build/suite/image.suite -> 10.0.4.2
Sending local file image.suite
run:
[cRIO] [OTA Server] ********* REBOOTING cRIO *********
[cRIO] 
[cRIO] task 0x3bdfa68 (FTP Server Connection Thread) deleted: errno=0 (0) status=0 (0)
[cRIO] task 0x3bcff48 (FTP Server Connection Thread) deleted: errno=0 (0) status=0 (0)
   Waiting for cRIO to reboot (1s)
   Waiting for cRIO to reboot (2s)
   Waiting for cRIO to reboot (3s)
   Waiting for cRIO to reboot (4s)
   Waiting for cRIO to reboot (5s)
   Waiting for cRIO to reboot (6s)
   Waiting for cRIO to reboot (7s)
   Waiting for cRIO to reboot (8s)
   Waiting for cRIO to reboot (9s)
   Waiting for cRIO to reboot (10s)
[cRIO] 
[cRIO] -> * Loading debug.o: debug
[cRIO] Debugging is up, target server mounted at /tsfs
[cRIO] 
[cRIO] 
[cRIO]                 VxWorks
[cRIO] 
[cRIO] Copyright 1984-2006  Wind River Systems, Inc.
[cRIO] 
[cRIO]              CPU: MPC5200 -- Wind River Lite5200 BSP.
[cRIO]     Runtime Name: VxWorks
[cRIO]  Runtime Version: 6.3
[cRIO]      BSP version: 2.0/10
[cRIO]          Created: Jun 14 2012, 08:46:35
[cRIO] ED&R Policy Mode: Deployed
[cRIO]    WDB Comm Type: WDB_COMM_END
[cRIO]              WDB: Ready.
[cRIO] 
[cRIO] * Loading nisysrpc.out: nisysrpc
[cRIO] * Loading NiRioRpc.out: NiRioRpc
[cRIO] * Loading nivissvc.out: nivissvc
[cRIO] * Loading nivision.out: nivision
[cRIO] NI-RIO Server 12.0.0b10 started successfully.
[cRIO] task 0xdb2258 (NiRioRpc) deleted: errno=0 (0) status=0 (0)
[cRIO] * Loading visa32.out: visa32
[cRIO] * Loading niserial.out: niserial
[cRIO] * Loading NiFpgaLv.out: NiFpgaLv
[cRIO] * Loading FRC_FPGA.out: FRC_FPGA
[cRIO] * Loading FRC_NetworkCommunication.out: FRC_NetworkCommunication
[cRIO] FRC_NetworkCommunication version: p4-1.4.0a10
[cRIO] FPGA Hardware GUID: 0xA14C11BDE4BB64AEF6A86FC52A294CD9
[cRIO] FPGA Software GUID: 0xA14C11BDE4BB64AEF6A86FC52A294CD9
[cRIO] FPGA Hardware Version: 2012
[cRIO] FPGA Software Version: 2012
[cRIO] FPGA Hardware Revision: 1.6.4
[cRIO] FPGA Software Revision: 1.6.4
[cRIO] * Loading FRC_BlackJagBridgePlugin.out: FRC_BlackJagBridgePlugin
[cRIO] FRC_BlackJagBridgePlugin_5200 was compiled from SVN revision 72
[cRIO] task 0x10df2f8 (VISA Jungo Init Thread) deleted: errno=196709 (0x30065) status=-1073807360 (0xbfff0000)
[cRIO] * Loading FRC_JavaVM.out: FRC_JavaVM
[cRIO] 
[cRIO] 
[cRIO] [OTA Server] Version: 2012 FRC, Jan  5 2012, 17:20:48
[cRIO] 
[cRIO] 
[cRIO] Welcome to LabVIEW Real-Time 12.0rc7
[cRIO] task 0xcb7258 (sysapi-rpc) deleted: errno=0 (0) status=0 (0)
[cRIO] 
[cRIO] [Squawk VM] Version: 2011 FRC, Nov  5 2011, 14:34:13
[cRIO] FPGA Hardware GUID: 0xa14c11bde4bb64aef6a86fc52a294cd9
[cRIO] FPGA Software GUID: 0xa14c11bde4bb64aef6a86fc52a294cd9
[cRIO] edu.wpi.first.wpilibj.networktables2.server.ServerConnectionAdapter@8 entered connection state: GOT_CONNECTION_FROM_CLIENT
[cRIO] edu.wpi.first.wpilibj.networktables2.server.ServerConnectionAdapter@8 entered connection state: CONNECTED_TO_CLIENT
[cRIO] edu.wpi.first.wpilibj.util.AllocationException: Analog channel 1 on module 1 is already allocated
[cRIO]     at edu.wpi.first.wpilibj.AnalogChannel.<init>(AnalogChannel.java:66)
[cRIO]     at edu.wpi.first.wpilibj.AnalogChannel.<init>(AnalogChannel.java:48)
[cRIO]     at edu.wpi.first.wpilibj.Gyro.<init>(Gyro.java:93)
[cRIO]     at edu.wpi.first.wpilibj.templates.subsystems.Chassis.<init>(Chassis.java:35)
[cRIO]     at edu.wpi.first.wpilibj.templates.team4gyro.robotInit(team4gyro.java:42)
[cRIO]     at edu.wpi.first.wpilibj.IterativeRobot.startCompetition(IterativeRobot.java:72)
[cRIO]     at edu.wpi.first.wpilibj.RobotBase.startApp(RobotBase.java:169)
[cRIO]     in virtual method #10 of javax.microedition.midlet.MIDlet(bci=17)
[cRIO]     at javax.microedition.midlet.MIDletTunnelImpl.callStartApp(64)
[cRIO]     at com.sun.squawk.imp.MIDletMainWrapper.main(110)
[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)
[cRIO] WARNING: Robots don't quit!
[cRIO] ---> The startCompetition() method (or methods called by it) should have handled the exception above.

your problem is that your creating a new gyro for every instance of the command. create the gyro in robotmap or OI and reference it instead of creating a new one

You’re creating two chassis objects, once in CommandBase and once in team4gyro. Because of that, two gyro objects are created.