Go to Post but eventually it seems that we realize that there's an I in FIRST, and the I stands for Inspiration, not for "me" - MrForbes [more]
Home
Go Back   Chief Delphi > Technical > Programming > Java
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
 
Thread Tools Rating: Thread Rating: 2 votes, 5.00 average. Display Modes
  #1   Spotlight this post!  
Unread 03-04-2010, 12:24
Robototes2412's Avatar
Robototes2412 Robototes2412 is offline
1 * 4 != 14
FRC #2412 (Robototes)
Team Role: Programmer
 
Join Date: Jan 2010
Rookie Year: 2007
Location: Bellevue
Posts: 312
Robototes2412 is on a distinguished road
What was the hardest to program this year in Java?

I was going around, and I know that people make classes/interfaces for doing the bizzare things that are used frequently on their robots.

For me is was getting DigitalInputs working, to do that, I made this class:

Code:
package com.shadowh511.mayor.inputs;

import edu.wpi.first.wpilibj.DigitalInput;

public class Switch {
    private DigitalInput source;

    public Switch(int channel) {
        this.source = new DigitalInput(4,channel);
    }

    public Switch(int slot, int channel) {
        this.source = new DigitalInput(slot,channel);
    }

    public boolean oldGet() {
        return this.source.get();
    }

    public boolean get() {
        if(!this.source.get()) {
            return true;
        } else {
            return false;
        }
    }
}
what you use to call this is:

Code:
Switch ballSwitch = new Switch(4);
or

Code:
Switch ballSwitch = new Switch(4,4);
I recommend the bottom one just to be on the safe side.
Reply With Quote
  #2   Spotlight this post!  
Unread 03-04-2010, 18:05
SavtaKenneth SavtaKenneth is offline
Registered User
AKA: Yotam Kenneth
FRC #2212
Team Role: Alumni
 
Join Date: Jan 2010
Rookie Year: 2009
Location: Israel
Posts: 63
SavtaKenneth will become famous soon enough
Re: What was the hardest to program this year in Java?

For us it'd have been making our own Gyro code. We used three gyros on the robot and so had to make our own. It ended up being just as accurate as the WPI code and now we are adding some filtering to it to solve for irregularities.
Reply With Quote
  #3   Spotlight this post!  
Unread 04-04-2010, 00:44
Robototes2412's Avatar
Robototes2412 Robototes2412 is offline
1 * 4 != 14
FRC #2412 (Robototes)
Team Role: Programmer
 
Join Date: Jan 2010
Rookie Year: 2007
Location: Bellevue
Posts: 312
Robototes2412 is on a distinguished road
Re: What was the hardest to program this year in Java?

I gave up on the gyro after 3 hours
Reply With Quote
  #4   Spotlight this post!  
Unread 04-04-2010, 17:41
FRC4ME FRC4ME is offline
Registered User
FRC #0339
 
Join Date: Feb 2008
Rookie Year: 2007
Location: Fredericksburg, VA
Posts: 324
FRC4ME has a brilliant futureFRC4ME has a brilliant futureFRC4ME has a brilliant futureFRC4ME has a brilliant futureFRC4ME has a brilliant futureFRC4ME has a brilliant futureFRC4ME has a brilliant futureFRC4ME has a brilliant futureFRC4ME has a brilliant futureFRC4ME has a brilliant futureFRC4ME has a brilliant future
Re: What was the hardest to program this year in Java?

I think the hardest part for us was working with the Cypress I/O board. I can't count the number of times I got the "Enhanced IO Missing" exception while trying to read inputs from that thing. It turns out you can't read them in robotInit() - you have to wait about a second for the board to be ready before attempting to read it.
__________________
Go directly to queue. Do not pass pit.
Reply With Quote
  #5   Spotlight this post!  
Unread 04-04-2010, 22:19
Robototes2412's Avatar
Robototes2412 Robototes2412 is offline
1 * 4 != 14
FRC #2412 (Robototes)
Team Role: Programmer
 
Join Date: Jan 2010
Rookie Year: 2007
Location: Bellevue
Posts: 312
Robototes2412 is on a distinguished road
Re: What was the hardest to program this year in Java?

I hated that too.

I used a seperate class for the cypress i/o module (com.shadowh511.mayor.inputs.DomBoard) that did all the work by itself.
Reply With Quote
  #6   Spotlight this post!  
Unread 05-04-2010, 00:01
cybiko123's Avatar
cybiko123 cybiko123 is offline
Roving Mentor
no team (Illinois FIRST)
Team Role: Mentor
 
Join Date: Mar 2008
Rookie Year: 2007
Location: Chicago
Posts: 16
cybiko123 is an unknown quantity at this point
Re: What was the hardest to program this year in Java?

Some issues we had included:

1. Getting the cRIO not to throw random exceptions when using known working code (gotta love that cRIO imaging tool...)

2. Getting our drivetrain working (and not curving). We ended up scrapping RobotDrive and implementing our own Drivetrain class.

3. Making sure we didn't lose communication.
Reply With Quote
  #7   Spotlight this post!  
Unread 05-04-2010, 00:08
FRC4ME FRC4ME is offline
Registered User
FRC #0339
 
Join Date: Feb 2008
Rookie Year: 2007
Location: Fredericksburg, VA
Posts: 324
FRC4ME has a brilliant futureFRC4ME has a brilliant futureFRC4ME has a brilliant futureFRC4ME has a brilliant futureFRC4ME has a brilliant futureFRC4ME has a brilliant futureFRC4ME has a brilliant futureFRC4ME has a brilliant futureFRC4ME has a brilliant futureFRC4ME has a brilliant futureFRC4ME has a brilliant future
Re: What was the hardest to program this year in Java?

Oh, and I forgot to mention: finding and fixing bugs in WPI's code.

So far we're overriding three of WPI's classes with our own versions: PWM, because someone forgot to cast two integers to doubles before dividing them; Encoder, because someone divided by 0.25 when they should have divided by four; and DriverStation, because the scaling on the joystick axes is wrong (it goes from -1.0 to 0.9 rather than -1.0 to 1.0 due to the use of two's complement).

Not that I'm complaining; when volunteers write 20,000 lines of code there are bound to be a few errors. In fact, I'm glad WPILib isn't perfect, because then my programming team would have nothing to do after week one.
__________________
Go directly to queue. Do not pass pit.

Last edited by FRC4ME : 05-04-2010 at 09:24.
Reply With Quote
  #8   Spotlight this post!  
Unread 05-04-2010, 00:27
Robototes2412's Avatar
Robototes2412 Robototes2412 is offline
1 * 4 != 14
FRC #2412 (Robototes)
Team Role: Programmer
 
Join Date: Jan 2010
Rookie Year: 2007
Location: Bellevue
Posts: 312
Robototes2412 is on a distinguished road
Re: What was the hardest to program this year in Java?

It was actually student voulenteers
Reply With Quote
  #9   Spotlight this post!  
Unread 05-04-2010, 01:19
davidthefat davidthefat is offline
Alumni
AKA: David Yoon
FRC #0589 (Falkons)
Team Role: Alumni
 
Join Date: Jan 2011
Rookie Year: 2010
Location: California
Posts: 792
davidthefat has much to be proud ofdavidthefat has much to be proud ofdavidthefat has much to be proud ofdavidthefat has much to be proud ofdavidthefat has much to be proud ofdavidthefat has much to be proud ofdavidthefat has much to be proud ofdavidthefat has much to be proud ofdavidthefat has much to be proud of
Re: What was the hardest to program this year in Java?

The hardest and most frustrating is debugging... But a lot of times, it ended up being electrical that was messed up... e.g. IR Sensor not lined up, Pressure sensor not wired up correctly, and ect
__________________
Do not say what can or cannot be done, but, instead, say what must be done for the task at hand must be accomplished.
Reply With Quote
  #10   Spotlight this post!  
Unread 05-04-2010, 15:48
cybiko123's Avatar
cybiko123 cybiko123 is offline
Roving Mentor
no team (Illinois FIRST)
Team Role: Mentor
 
Join Date: Mar 2008
Rookie Year: 2007
Location: Chicago
Posts: 16
cybiko123 is an unknown quantity at this point
Re: What was the hardest to program this year in Java?

Was anyone else having a problem getting the debugger to work?
Reply With Quote
  #11   Spotlight this post!  
Unread 05-04-2010, 18:03
LukeS LukeS is offline
4272 mentor, 1024 alumnus
AKA: Luke Shumaker
FRC #4272
Team Role: Mentor
 
Join Date: Mar 2009
Rookie Year: 2009
Location: Indianapolis, IN
Posts: 60
LukeS is an unknown quantity at this point
Re: What was the hardest to program this year in Java?

The hardest part of programming is always convincing everyone that it's not a code problem! Fine, it was twice, when someone accidentally would comment out `break;' on one-line cases in switches.

Things we did abstract farther:
Our side kicker was incredibly complex. So, I created a the `hardware.SideKicker' class that made it work work like ``sideKicker.set(SideKicker.Mode.kLoad);''. It had 4 states: kick, load, close, and wait (which are normally run in that order). Beside that, I further broke the kicker down into the `hardware.sideKicker.Loader' and `hardware.sideKicker.Latch', both of which `hardware.SideKicker' used. Even after that, all the timing logic and such is still fairly complex, but I did manage to make it pretty zen.

Same thing with the front kicker, although it is a lot more straight forward (kick and load), no timer issues other than the 2 second rules of the competition.

We also further abstracted the driverstation ``LCD''.
  • LCD.lines[0-5] is an array storing the desired text.
  • LCD.update() updates the hardware based on the array, adding spaces if necessary (having parts of long numbers left over can be very confusing when debugging a problem).
  • LCD.println(str) adds a line, scrolling the other lines (this changes the array, and runs LCD.update()
Reply With Quote
  #12   Spotlight this post!  
Unread 22-04-2010, 05:26
jhersh jhersh is offline
National Instruments
AKA: Joe Hershberger
FRC #2468 (Appreciate)
Team Role: Mentor
 
Join Date: May 2008
Rookie Year: 1997
Location: Austin, TX
Posts: 1,006
jhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond repute
Re: What was the hardest to program this year in Java?

Quote:
Originally Posted by FRC4ME View Post
Oh, and I forgot to mention: finding and fixing bugs in WPI's code.

So far we're overriding three of WPI's classes with our own versions: PWM, because someone forgot to cast two integers to doubles before dividing them; Encoder, because someone divided by 0.25 when they should have divided by four; and DriverStation, because the scaling on the joystick axes is wrong (it goes from -1.0 to 0.9 rather than -1.0 to 1.0 due to the use of two's complement).

Not that I'm complaining; when volunteers write 20,000 lines of code there are bound to be a few errors. In fact, I'm glad WPILib isn't perfect, because then my programming team would have nothing to do after week one.
Have you reported all the bugs you found so that the library can be improved for everyone? Even better would be patches that implement the fixes.

Visit http://firstforge.wpi.edu/sf/tracker...wpilib/tracker to report bugs!

Thanks,
-Joe
Reply With Quote
  #13   Spotlight this post!  
Unread 24-04-2010, 02:58
FRC4ME FRC4ME is offline
Registered User
FRC #0339
 
Join Date: Feb 2008
Rookie Year: 2007
Location: Fredericksburg, VA
Posts: 324
FRC4ME has a brilliant futureFRC4ME has a brilliant futureFRC4ME has a brilliant futureFRC4ME has a brilliant futureFRC4ME has a brilliant futureFRC4ME has a brilliant futureFRC4ME has a brilliant futureFRC4ME has a brilliant futureFRC4ME has a brilliant futureFRC4ME has a brilliant futureFRC4ME has a brilliant future
Re: What was the hardest to program this year in Java?

Quote:
Originally Posted by jhersh View Post
Have you reported all the bugs you found so that the library can be improved for everyone? Even better would be patches that implement the fixes.

Visit http://firstforge.wpi.edu/sf/tracker...wpilib/tracker to report bugs!

Thanks,
-Joe
Does the Java tracker actually get used? I noticed that, unlike the C++ tracker which has twelve bugs, the Java tracker only has one; the one that I submitted this January and has still not been fixed. Perhaps this is because, at least when I submitted that one, no Java developers' names were in the assignment list (only C++ and LabVIEW).

I will gladly fix them myself if that is possible. Can you explain further what the process of submitting a patch is? Thanks.

EDIT - I went ahead and submitted the other bugs to the tracker anyway.
__________________
Go directly to queue. Do not pass pit.

Last edited by FRC4ME : 24-04-2010 at 13:35.
Reply With Quote
  #14   Spotlight this post!  
Unread 25-04-2010, 22:31
jhersh jhersh is offline
National Instruments
AKA: Joe Hershberger
FRC #2468 (Appreciate)
Team Role: Mentor
 
Join Date: May 2008
Rookie Year: 1997
Location: Austin, TX
Posts: 1,006
jhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond repute
Re: What was the hardest to program this year in Java?

Quote:
Originally Posted by FRC4ME View Post
Does the Java tracker actually get used? I noticed that, unlike the C++ tracker which has twelve bugs, the Java tracker only has one; the one that I submitted this January and has still not been fixed. Perhaps this is because, at least when I submitted that one, no Java developers' names were in the assignment list (only C++ and LabVIEW).

I will gladly fix them myself if that is possible. Can you explain further what the process of submitting a patch is? Thanks.

EDIT - I went ahead and submitted the other bugs to the tracker anyway.
Sounds good...

I'm not sure why the Java guys aren't on the list. I can address the issues as well, if you don't find one.

If you fix them yourself, you can attach patchs to the artifacts and we'll apply them.

-Joe
Reply With Quote
  #15   Spotlight this post!  
Unread 01-12-2010, 22:32
ksanger's Avatar
ksanger ksanger is offline
Registered User
FRC #0211 (MaK)
 
Join Date: Mar 2010
Rookie Year: 2010
Location: Rochester NY
Posts: 62
ksanger is on a distinguished road
Re: What was the hardest to program this year in Java?

I joined Mak211 last year, three weeks before the ship date. The night before we had crashed our kicker as members had removed parts to modify without telling me. Kick, (too far), bend the forward bracket and eliminated the encoder so the return to reload the kick went back (too far) and destroyed the sensor telling it to stop. The morning of shipping we rebuilt the kicker.

But the most difficult part was that our position sensors on our four wheel steering kept coming loose. Plus we had no means of adjusting the wheels to a known starting position. After shipping we used a spare Crio to figure out how to make a Can Jaguar go from position control to speed control so we could rotate the wheels while reading the pots and displaying their position on the Dashboard. (Last year we were using C++ and to reconfigure the Cans we needed to destruct them then initialize them in either diagnostic speed mode or run position mode). I don't know if I can destruct them in Java and haven't seen a Java example that enables position mode.

Did I mention that I've never coded for C++ objects before? I have been using C since 1980, and I've only read about C++ before and I don't code for a living. Its amazing that we're teaching students Java for next year. Objects rule. Its going to be a while before I'm confident enough to write my own though. Maybe if I had the source I could modify that, but I haven't found the Java wpilibj source.
Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Java this year? Mo_Shen General Forum 6 06-01-2010 10:52
What is the hardest (yet possible) task in this year's game? Wayne C. General Forum 88 16-01-2008 18:30
What year was the hanging bar from? Jeremy General Forum 3 11-01-2004 23:00
What was your best memory from this year/ever? miketwalker General Forum 30 01-05-2003 13:24
What was the most innovative feature this year? archiver 2001 15 24-06-2002 04:17


All times are GMT -5. The time now is 10:35.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


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