Go to Post I normally prefer my speed controllers to brake, rather then break. - Joe Ross [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 Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 23-10-2011, 00:05
Jared Russell's Avatar
Jared Russell Jared Russell is offline
Taking a year (mostly) off
FRC #0254 (The Cheesy Poofs), FRC #0341 (Miss Daisy)
Team Role: Engineer
 
Join Date: Nov 2002
Rookie Year: 2001
Location: San Francisco, CA
Posts: 3,077
Jared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond repute
New Java (and C++) features for 2012

Link to FIRST Forums post: http://forums.usfirst.org/showthread...2995#post52995

As Team 341 continues our Beta test of the 2012 FRC Control System Java programming language and hardware, I thought it would be a good time to explain some of the new features we have been testing. This post will focus exclusively on the software side - and most of the Java changes also go for C++.

Aside from support for the new hardware (4-slot cRIO II, Microsoft Kinect, and maybe a couple other things), the 2012 Java environment offers some new helpful utilities, a new SmartDashboard application, and an entirely new style of programming (CommandBasedRobot) that supplements the existing SimpleRobot and IterativeRobot styles.

In many cases, the extensions to the Java/C++ programming options are things that some enterprising teams have been doing for a few years now. For example, if you look at the code posted on ChiefDelphi by teams 125 and 254 in the past couple seasons, you will find a lot of similarities.

Here are some of the new features that we are currently testing:
  • A built-in "Preferences" class to load and save important values from/to the cRIO's non-volatile memory. Imagine things like PID constants, autonomous mode values, etc. What is even cooler, the Preferences class has a network interface to the new SmartDashboard - you can tweak your values on your Classmate, send them over, and have them stored onboard!
  • As part of the new CommandBasedRobot template, the idea of "Subsystems" has been created. A subsystem class is a single functional part of your robot - such as a driveline, an arm, a gripper, etc. For example, a gripper subsystem might have methods to Grip and Release game pieces. Subsystems help you logically group together the sensors and actuators that work together, and help you to define your robot code while the mechanical team is still putting it together.
  • Along with Subsystems, the 2012 version introduces Commands. Commands are discrete pieces of code that manipulate the Subsystems of your robot. For example, a "GrabATube" Command might tell a roller claw to run until a tube is detected by some sort of sensor on the claw. Commands have specific methods that get called when they start, as they execute, and when they finish (allowing you a lot of flexibility in what can be put into a Command). Commands can be scheduled in sequence or in parallel - you can imagine that button presses may create new Commands, just as your autonomous mode would be a sequence of Commands. Commands have a method of "requiring" specific Subsystems - this makes sure that you never have multiple commands telling your drive to do different things, for example (the second command which requires the drive would cancel the first).
  • There are new ways to interface with your Classmate and OI. A new OI class captures all of your Joystick, Kinect, and Cypress board interfacing in one place. New Button classes are used to asynchronously map button presses to Commands (when you create the Button, you associate it with a Command - no need to do anything else!)
  • The new SmartDashboard lets you tweak Preferences on the fly, as I previously mentioned. It also has a couple of other nifty features. Buttons that you define have a virtual interface in the SmartDashboard - simply point and click, and you can test that a piece of code is working. It also displays the currently active Commands for your Subsystems, helping you debug (did one of your Commands forget to finish?). Lastly, there is a new function to help you choose your autonomous mode directly from the dashboard - something that many teams have had to figure out how to do on their own for years.
  • You now have the option to do vision processing on your Driver Station Laptop in addition or instead of doing it on the cRIO! Your laptop (whether a Classmate or something else) definitely has more power available to it than the cRIO, so this gives you an option to move all of that processor-heavy image processing code offboard.

It is important to note that although there is a ton of new stuff in 2012, all of the 2011 templates and classes work in exactly the same way (for example, our 2011 robot code worked without modification using the 2012 libraries).

Per the beta test agreement, I am happy to answer any questions on these new features, but cannot provide code or documentation until after the beta period.
Reply With Quote
  #2   Spotlight this post!  
Unread 23-10-2011, 14:03
AllenGregoryIV's Avatar
AllenGregoryIV AllenGregoryIV is offline
Engineering Coach
AKA: Allen "JAG" Gregory
FRC #3847 (Spectrum)
Team Role: Coach
 
Join Date: Jul 2008
Rookie Year: 2003
Location: Texas
Posts: 2,549
AllenGregoryIV has a reputation beyond reputeAllenGregoryIV has a reputation beyond reputeAllenGregoryIV has a reputation beyond reputeAllenGregoryIV has a reputation beyond reputeAllenGregoryIV has a reputation beyond reputeAllenGregoryIV has a reputation beyond reputeAllenGregoryIV has a reputation beyond reputeAllenGregoryIV has a reputation beyond reputeAllenGregoryIV has a reputation beyond reputeAllenGregoryIV has a reputation beyond reputeAllenGregoryIV has a reputation beyond repute
Send a message via AIM to AllenGregoryIV
Re: New Java (and C++) features for 2012

Wow, those are a lot of really nice improvements. It should elevate a lot of teams.

What is used to do image processing on the driver station? How is that programmed? Do you have to use Labview or are there sample java (or C++) projects for it?
__________________

Team 647 | Cyber Wolf Corps | Alumni | 2003-2006 | Shoemaker HS
Team 2587 | DiscoBots | Mentor | 2008-2011 | Rice University / Houston Food Bank
Team 3847 | Spectrum | Coach | 2012-20... | St Agnes Academy
LRI | Alamo Regional | 2014-20...
"Competition has been shown to be useful up to a certain point and no further, but cooperation, which is the thing we must strive for today, begins where competition leaves off." - Franklin D. Roosevelt
Reply With Quote
  #3   Spotlight this post!  
Unread 24-10-2011, 14:26
~Cory~'s Avatar
~Cory~ ~Cory~ is offline
Student
AKA: Cory Rypkema
FRC #0706
Team Role: Alumni
 
Join Date: Jan 2010
Rookie Year: 2010
Location: Worcester MA
Posts: 216
~Cory~ is a splendid one to behold~Cory~ is a splendid one to behold~Cory~ is a splendid one to behold~Cory~ is a splendid one to behold~Cory~ is a splendid one to behold~Cory~ is a splendid one to behold~Cory~ is a splendid one to behold
Post Re: New Java (and C++) features for 2012

1. Can you post a copy of your test code that uses these new features? (comments )
2. Just to clarify "on the fly" How easily is the preferences changed? On the fly? Or is something that needs to be changed and the robot needs to reset? Do you have to refresh the class to use preferences?
__________________
corin.rypkema.org
WPI Class of '17
'12 Dean's List Finalist, Mentor of 706 - Cyberhawks
Reply With Quote
  #4   Spotlight this post!  
Unread 24-10-2011, 18:11
Jared Russell's Avatar
Jared Russell Jared Russell is offline
Taking a year (mostly) off
FRC #0254 (The Cheesy Poofs), FRC #0341 (Miss Daisy)
Team Role: Engineer
 
Join Date: Nov 2002
Rookie Year: 2001
Location: San Francisco, CA
Posts: 3,077
Jared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond repute
Re: New Java (and C++) features for 2012

1. I cannot (yet), due to the beta test non-disclosure agreement. This is primarily to make sure that things don't get confusing as multiple versions of the 2012 code are published (remember, things are still a work in progress). I will share my code as soon as I am allowed.

2. By default, the Preferences are loaded from a file when the cRIO boots. However, you can set up your own code to read values from the SmartDashboard at any time. You would then tell Preferences to "save" the values if you are happy with them.
Reply With Quote
  #5   Spotlight this post!  
Unread 24-10-2011, 22:19
~Cory~'s Avatar
~Cory~ ~Cory~ is offline
Student
AKA: Cory Rypkema
FRC #0706
Team Role: Alumni
 
Join Date: Jan 2010
Rookie Year: 2010
Location: Worcester MA
Posts: 216
~Cory~ is a splendid one to behold~Cory~ is a splendid one to behold~Cory~ is a splendid one to behold~Cory~ is a splendid one to behold~Cory~ is a splendid one to behold~Cory~ is a splendid one to behold~Cory~ is a splendid one to behold
Re: New Java (and C++) features for 2012

Ok thank you for the information. And isnt subsystems just like normal c++ classes and functions?
__________________
corin.rypkema.org
WPI Class of '17
'12 Dean's List Finalist, Mentor of 706 - Cyberhawks
Reply With Quote
  #6   Spotlight this post!  
Unread 25-10-2011, 01:30
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: New Java (and C++) features for 2012

Quote:
Originally Posted by ~Cory~ View Post
Ok thank you for the information. And isnt subsystems just like normal c++ classes and functions?
Essentially it just makes it much easier for rookies, but I am going to recommend staying away from that (along with the drive code that is provided). It gets even more higher level than it is already. I honestly think there are great benefits of writing the functions and classes by yourself.

Also, stay away from image processing on the laptop... There will be great delays. Assume each RGB pixel has 24 bits and the image is 640x480. That is essentially:
640 * 480 = 307200
307200 * 24 = 7372800 bits = 921600 bytes

That data has to travel from the camera to the cRio then to the laptop. Also, the big endian needs to be converted to little endian on the laptop end. Assume the cache of the cpu is 512KB. The cpu is already preoccupied by system processes and other processes. So assume only 24KB are available for the image processing. The image has to be retrieved from the RAM then stuffed into the cache. But look, the whole image can not be stuffed into the cache. There needs to be multiple times it has to go to RAM to retrieve data then send it to the cRio and then the cRio utilized that data. Keep in minds x86 cpus have 8 General purpose registers. It takes about 1-3 cycles to retrieve data from the cache. So only about 1 pixel can be handled at one time by the cpu. BUT powerpc architecture has 32 general purpose resisters. That can effectively quadruple the number of pixels that can be handled by cpu at any given time. Now, I am away my argument is flaws because I do not take account of the clock speed of the cRio into account. But I take my bet on the cRio any day over sending data over wifi and sending back.
__________________
Do not say what can or cannot be done, but, instead, say what must be done for the task at hand must be accomplished.

Last edited by davidthefat : 25-10-2011 at 01:46.
Reply With Quote
  #7   Spotlight this post!  
Unread 25-10-2011, 01:47
Tom Bottiglieri Tom Bottiglieri is offline
Registered User
FRC #0254 (The Cheesy Poofs)
Team Role: Engineer
 
Join Date: Jan 2004
Rookie Year: 2003
Location: San Francisco, CA
Posts: 3,186
Tom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond repute
Re: New Java (and C++) features for 2012

Quote:
Originally Posted by davidthefat View Post

Also, stay away from image processing on the laptop... There will be great delays. Assume each RGB pixel has 24 bits and the image is 640x480. That is essentially:
640 * 480 = 307200
307200 * 24 = 7372800 bits = 921600 bytes

That data has to travel from the camera to the cRio then to the laptop.
The webcam is hooked up to a switch on the robot, so the driver station can http get an image from the webcam without the cRio in the middle. A good driver station laptop can grab an image, process it, and send the results back to the cRIO before the cRIO could process the image itself.
Reply With Quote
  #8   Spotlight this post!  
Unread 25-10-2011, 01:58
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: New Java (and C++) features for 2012

Quote:
Originally Posted by davidthefat View Post
Also, stay away from image processing on the laptop... There will be great delays. Assume each RGB pixel has 24 bits and the image is 640x480. That is essentially:
640 * 480 = 307200
307200 * 24 = 7372800 bits = 921600 bytes
The images are sent as compressed JPEGs. They are not anywhere near as big as you've calculated.
Reply With Quote
  #9   Spotlight this post!  
Unread 25-10-2011, 01:59
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: New Java (and C++) features for 2012

Quote:
Originally Posted by jhersh View Post
The images are sent as compressed JPEGs. They are not anywhere near as big as you've calculated.
Disregarded that fact.
__________________
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 20-11-2011, 19:16
RoboRealm RoboRealm is offline
Registered User
FRC #0443
 
Join Date: Nov 2011
Location: United States
Posts: 34
RoboRealm is a jewel in the roughRoboRealm is a jewel in the roughRoboRealm is a jewel in the roughRoboRealm is a jewel in the rough
Re: New Java (and C++) features for 2012

Jared,

I assume based on your statements that this means that you are now allowed to use an application like RoboRealm to process the images on the PC and send back any results? If so, we will check with FIRST about making this available to team members.

Thanks for the info!
STeven.
Reply With Quote
  #11   Spotlight this post!  
Unread 20-11-2011, 20:22
~Cory~'s Avatar
~Cory~ ~Cory~ is offline
Student
AKA: Cory Rypkema
FRC #0706
Team Role: Alumni
 
Join Date: Jan 2010
Rookie Year: 2010
Location: Worcester MA
Posts: 216
~Cory~ is a splendid one to behold~Cory~ is a splendid one to behold~Cory~ is a splendid one to behold~Cory~ is a splendid one to behold~Cory~ is a splendid one to behold~Cory~ is a splendid one to behold~Cory~ is a splendid one to behold
Re: New Java (and C++) features for 2012

As far as I know, you were able to do that last year...
__________________
corin.rypkema.org
WPI Class of '17
'12 Dean's List Finalist, Mentor of 706 - Cyberhawks
Reply With Quote
  #12   Spotlight this post!  
Unread 21-11-2011, 08:50
kinganu123 kinganu123 is offline
Registered User
FRC #1747
Team Role: Mentor
 
Join Date: Jan 2010
Rookie Year: 2008
Location: Piscataway, NJ
Posts: 243
kinganu123 is on a distinguished road
Re: New Java (and C++) features for 2012

does java now support the top part of the dashboard? last year, we needed to manually create a dashboard class so that values on the dashboard would be updated as it does natively in LabView
__________________
Reply With Quote
  #13   Spotlight this post!  
Unread 21-11-2011, 09:04
Jared Russell's Avatar
Jared Russell Jared Russell is offline
Taking a year (mostly) off
FRC #0254 (The Cheesy Poofs), FRC #0341 (Miss Daisy)
Team Role: Engineer
 
Join Date: Nov 2002
Rookie Year: 2001
Location: San Francisco, CA
Posts: 3,077
Jared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond repute
Re: New Java (and C++) features for 2012

Quote:
Originally Posted by RoboRealm View Post
Jared,

I assume based on your statements that this means that you are now allowed to use an application like RoboRealm to process the images on the PC and send back any results? If so, we will check with FIRST about making this available to team members.

Thanks for the info!
STeven.
I am not familiar with "RoboRealm". However, in concept, I believe that you would be able to pull this off. Even in past seasons you were able to transmit raw images back to the Driver Station for viewing by the drivers; wrapping your image processing code in a custom Dashboard is totally doable. This year, an implementation of OpenCV for the Driver Station side will be supplied to accomplish exactly this.
Reply With Quote
  #14   Spotlight this post!  
Unread 24-10-2011, 22:16
Tom Bottiglieri Tom Bottiglieri is offline
Registered User
FRC #0254 (The Cheesy Poofs)
Team Role: Engineer
 
Join Date: Jan 2004
Rookie Year: 2003
Location: San Francisco, CA
Posts: 3,186
Tom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond repute
Re: New Java (and C++) features for 2012

Quote:
Originally Posted by Jared341 View Post
if you look at the code posted on ChiefDelphi by teams 125 and 254 in the past couple seasons, you will find a lot of similarities.
I'm glad someone else noticed the similarities.
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


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

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