![]() |
Code Failing
We are just trying to test our robot's drive system, but we cannot get the code to run properly. Here is our code:
package edu.wpi.first.wpilibj.templates; import edu.wpi.first.wpilibj.IterativeRobot; import edu.wpi.first.wpilibj.Joystick; import edu.wpi.first.wpilibj.RobotDrive; import edu.wpi.first.wpilibj.Solenoid; import edu.wpi.first.wpilibj.Timer; import edu.wpi.first.wpilibj.Watchdog; public class RobotTemplate extends IterativeRobot { RobotDrive robot; Joystick left; Joystick right; public void robotInit() { robot = new RobotDrive(1,2,3,4); left = new Joystick(1); right = new Joystick(2); System.out.println("RobotInit() completed.\n"); } public void autonomousPeriodic() { } public void teleopPeriodic() { robot.tankDrive(left.getThrottle(),(-1*right.getThrottle())); System.out.println("Tank Drive"); } } As you can see, all we hoped to do with this was make the robot move. These are the last few lines of output we get: [cRIO] Welcome to LabVIEW Real-Time 11.0rc14 [cRIO] task 0xec0090 (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: 0x1394f6dc1feb42ec6910e5767ed1d22c [cRIO] FPGA Software GUID: 0xa14c11bde4bb64aef6a86fc52a294cd9 [cRIO] DIO LoopTiming: 260, expecting: 261 [cRIO] edu.wpi.first.wpilibj.util.UncleanStatusException: Fatal status code detected: -1073807246 [cRIO] at edu.wpi.first.wpilibj.can.CANExceptionFactory.chec kStatus(CANExceptionFactory.java:46) [cRIO] at edu.wpi.first.wpilibj.can.JaguarCANDriver.sendMess age(JaguarCANDriver.java:36) [cRIO] at edu.wpi.first.wpilibj.CANJaguar.sendMessage(CANJag uar.java:574) [cRIO] at edu.wpi.first.wpilibj.CANJaguar.updateSyncGroup(CA NJaguar.java:1349) [cRIO] at edu.wpi.first.wpilibj.RobotDrive.setLeftRightMotor Outputs(RobotDrive.java:531) [cRIO] at edu.wpi.first.wpilibj.RobotDrive.drive(RobotDrive. java:212) [cRIO] at edu.wpi.first.wpilibj.RobotDrive.<init>(RobotDrive .java:119) [cRIO] at edu.wpi.first.wpilibj.templates.RobotTemplate.robo tInit(RobotTemplate.java:34) [cRIO] at edu.wpi.first.wpilibj.IterativeRobot.startCompetit ion(IterativeRobot.java:74) [cRIO] at edu.wpi.first.wpilibj.RobotBase.startApp(RobotBase .java:156) [cRIO] in virtual method #10 of javax.microedition.midlet.MIDlet(bci=17) [cRIO] at javax.microedition.midlet.MIDletTunnelImpl.callSta rtApp(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. [cRIO] task 0x25cabd8 (System Web Services Load Thread) deleted: errno=0 (0) status=0 (0) [cRIO] task 0x2b3c000 (mDNS resolve) deleted: errno=0 (0) status=0 (0) [cRIO] task 0x28a1760 (mDNS resolve) deleted: errno=0 (0) status=0 (0) I noticed it said "welcome to labview." When we imaged the cRIO we selected JAVA. Is this normal? |
Re: Code Failing
The labview message is normal. I would check the motor numbering first. Then see what CAN setting you have on the cRIO imaging utility. I don't know much about it, but we don't use the CAN option.
Are you using Jaguars? |
Re: Code Failing
I agree with nick. First check your DIO channels for your speed controllers, though this shouldn't throw an exception. Also verify that you are indeed using CAN Jaguar. We have not used CAN in the past and therefore have not seen this specific issue, but the stacktrace would indicate that it is expecting CAN.
Also, as a matter of what we consider to be best practice, we explicitly declare and configure our speed controllers. This way we know without a doubt what we are handing to the RobotDrive. Code:
SpeedController leftFront = new Jaguar(1, 1); |
Re: Code Failing
Also, another item I thought I'd mention. You might want to consider inverting your right side motors so that you don't have to multiply the output of the throttle by -1.
You can invert through the RobotDrive object. Code:
robotDrive.setInvertedMotor(RobotDrive.MotorType.kFrontRight, true); |
Re: Code Failing
1 Attachment(s)
We managed to get that issue solved. We had to turn off the console out dip switch. However, we seem to have run into another problem. No matter what, we cannot seem to get the robot to drive.
Here is our code. We have tried Code:
package edu.wpi.first.wpilibj.templates;The getMagnitude() methods do change when we move the joysticks. What really worries me is that the robot does not move even when I manually enter values into the tankDrive() method. Does this mean that something is wrong with our wiring? Also, we did use jaguars. We connected the 4 jaguard to the sidecar using the PWM cables. We connected the male ends to the servo ports on the jaguars, and the female ends to the 3 pin PWM out ports on the sidecar. I attached images of how we wired the jaguars. Is this correct? Thanks |
Re: Code Failing
getThrottle() returning 0 actually is normal in my experience. Try using getY() instead. (Or go into your controller's settings on your computer and investigate which axes are what)
And, I think you're inputting values out of range. tankDrive should take numbers -1 to 1. (2 is out of range) And if your robot is normal, a value of -1 or 1 will send your robot speeding towards you before you can disable it. :yikes: |
Re: Code Failing
init:
init: Deleting directory C:\Users\Robotics\Documents\NetBeansProjects\Robot Template\build Deleting directory C:\Users\Robotics\Documents\NetBeansProjects\Robot Template\suite Deleting directory C:\Users\Robotics\Documents\NetBeansProjects\Robot Template\j2meclasses clean: Created dir: C:\Users\Robotics\Documents\NetBeansProjects\Robot Template\build Compiling 1 source file to C:\Users\Robotics\Documents\NetBeansProjects\Robot Template\build compile: Created dir: C:\Users\Robotics\Documents\NetBeansProjects\Robot Template\j2meclasses preverify: Created dir: C:\Users\Robotics\Documents\NetBeansProjects\Robot Template\suite Building jar: C:\Users\Robotics\Documents\NetBeansProjects\Robot Template\suite\RobotTemplate_1.0.0.jar jar-app: 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 96 classes and generated 4 files. Expanding: C:\Users\Robotics\Documents\NetBeansProjects\Robot Template\suite\RobotTemplate_1.0.0.jar into C:\Users\Robotics\Documents\NetBeansProjects\Robot Template\suite Moving 1 file to C:\Users\Robotics\Documents\NetBeansProjects\Robot Template\suite Moving 1 file to C:\Users\Robotics\Documents\NetBeansProjects\Robot Template\suite Moving 1 file to C:\Users\Robotics\Documents\NetBeansProjects\Robot Template\suite Deleting: C:\Users\Robotics\Documents\NetBeansProjects\Robot Template\image.suite.api Host OS: Windows 7 6.1, 6.1 Host JVM: Java HotSpot(TM) 64-Bit Server VM 22.0-b10 Target IP: 10.28.88.2 Network interfaces on host: Intel(R) 82579V Gigabit Network Connection: address: 10.28.88.6 netmask: 255.255.255.0 <--- on robot's subnet Connecting FTP @10.28.88.2 upgrade: Sending local file image.suite flashapp: deploy: init: [cRIO] [OTA Server] ********* REBOOTING cRIO ********* [cRIO] 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: May 27 2011, 11:02:24 [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 4.0.0b8 started successfully. [cRIO] task 0xe2f0a8 (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 was compiled from SVN revision 2923 [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_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 11.0rc14 [cRIO] task 0xddb530 (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] DIO LoopTiming: 260, expecting: 261 [cRIO] Default IterativeRobot.disabledInit() method... Overload me! [cRIO] Default IterativeRobot.disabledContinuous() method... Overload me! This is our problem, and it constantly gets stuck here no matter how long we leave it. PLEASE HELP! |
Re: Code Failing
I don't think that your code is really freezing. Those are the last two lines of code you should see before going into teleop mode. What you need to do at this point is to go to your driver station and enable teleop mode. Otherwise, the code in your teleopPeriodic and teleopContinuous methods will not run
|
| All times are GMT -5. The time now is 22:21. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi