![]() |
Java Help
Hello I am new to Java for FRC and need help. I want to control two motors connected to jaguars hook up to PWM 1 and 2 to create tank drive. I will control them from one gamepad with two joysticks. This is my code:
Code:
package edu.wpi.first.wpilibj.templates;The code has no errors or warnings and builds successfully. When I run it, the console shows this: Code:
init:Does my code do what I intend for it to do? Is the code being sent to the robot? Thanks in advance! |
Re: Java Help
Same error. Does anybody know why the the digital module is not being detected?
|
Re: Java Help
Ok, so I wrote a simpler version of your code to reduce redundancy.
Only problem you had was that u stored your left and right values before the loop. so once it had a value, that loop would continuously give the motors that value. Code:
public void operatorControl() { |
Re: Java Help
We are having a similar issue: we are unable to get inputs or set outputs through the cRIO. However, we are not getting the "Digital module 1 is not present" error message. You can use code like the following to detect module presence:
Code:
for(int i = 0; i < 2; ++i) {[cRIO] DIO LoopTiming: 260, expecting: 261 [cRIO] DIO LoopTiming: 260, expecting: 261 |
Re: Java Help
So it turns out, we unplugged and re-plugged in our modules, and it magically started working.
You guys should make sure your modules are in the following slots: Analog - Slot 1 Digital - Slot 2 Solenoid - Slot 3 |
Re: Java Help
So it seems like it isn't a coding issue. I'll check the connections in the robot tomorrow and see if this works.
|
Re: Java Help
We are having this same issue. We have the same problem with both the cRIO and the cRIO II. Are there any updates on why this is happening? Could there be an issue with the Digital IO Sidecar?
|
Re: Java Help
I compared the source code for WPILib 2011 & 2012 and the developers changed the constructors for all the I/O to use
Code:
ConstructorName(int moduleNumber, int channel)Code:
ConstructorName(int slot, int Channel)Team 997 was also seeing the exception “Solenoid channel 1 on module 3 is already allocated", which makes it sound like our code had allocated solenoid channel 1 twice. We made it work by using the simple constructor where only the channel is specified. A better error message could have saved us time. The error really should say something about 3 being an invalid module number and suggest using 1 or 2 (The solenoid module in slot 3 is module 1). In fact the incorrect exception message actually appears to be masking an only slightly more useful exception CheckedAllocationException("Index " + index + " out of range");. Hiding an exception with one that gives false information is a bad programming practice.:mad: Another way to fix this problem in WPILib would be to deprecate the old constructor and add a new one with a different signature. You can only have one of each module type, so a Boolean value would work for the module number. Code:
ConstructorName(boolean isModuleOne, int Channel) |
Re: Java Help
Quote:
|
Re: Java Help
I havent fixed that error but my codes running fine. Lol... our electronic team forgot to connect the sidecar to the crio. Thats why i was recieving code but i wasnt able to move the robot :p
|
| All times are GMT -5. The time now is 09:56. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi