Go to Post I'm a programmer by training and inclination, so my mechanical ideas are sometimes rather, um, loosely constrained by physical reality. - Alan Anderson [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 05-05-2014, 09:33
dmaciel10123 dmaciel10123 is offline
The Everything Guy
AKA: David Maciel
FRC #3525 (The Nuts and Bolts of Fury)
Team Role: Alumni
 
Join Date: Feb 2013
Rookie Year: 2013
Location: Waterbury, Connecticut
Posts: 100
dmaciel10123 is an unknown quantity at this point
Scenarios for Learning Java

Hi guys. I'm posting this thread to ask for some robot scenarios to program. I'm doing this because I'm experienced with Java but have not worked with it in FRC. My team primarily uses LabVIEW, but I would like to learn to work with Java and C++ as well. I may also use some of the scenarios you provide to help teach other programmers from my team who also wish to learn to work with these languages. I'll probably work with the 2013 version of the FRC libraries so I can use jRIO to test.

Edit: when I say scenarios I mean list different actuators, sensors, and functions that the robot would use.
__________________

Last edited by dmaciel10123 : 05-05-2014 at 10:07.
Reply With Quote
  #2   Spotlight this post!  
Unread 06-05-2014, 07:39
notmattlythgoe's Avatar
notmattlythgoe notmattlythgoe is offline
Flywheel Police
AKA: Matthew Lythgoe
FRC #2363 (Triple Helix)
Team Role: Mentor
 
Join Date: Feb 2010
Rookie Year: 2009
Location: Newport News, VA
Posts: 1,715
notmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond repute
Re: Scenarios for Learning Java

Quote:
Originally Posted by dmaciel10123 View Post
Hi guys. I'm posting this thread to ask for some robot scenarios to program. I'm doing this because I'm experienced with Java but have not worked with it in FRC. My team primarily uses LabVIEW, but I would like to learn to work with Java and C++ as well. I may also use some of the scenarios you provide to help teach other programmers from my team who also wish to learn to work with these languages. I'll probably work with the 2013 version of the FRC libraries so I can use jRIO to test.

Edit: when I say scenarios I mean list different actuators, sensors, and functions that the robot would use.
I'd say the beat one to start with is write a drive train. And having a complete robot to work with, reprogram the robot in java would be another good tool.
Reply With Quote
  #3   Spotlight this post!  
Unread 07-05-2014, 20:56
Cel Skeggs Cel Skeggs is offline
Robot Software Manager Alumnus
AKA: Previously known as Colby
FRC #1540 (The Flaming Chickens)
Team Role: Alumni
 
Join Date: Feb 2013
Rookie Year: 2009
Location: Portland, Oregon, USA
Posts: 107
Cel Skeggs is a glorious beacon of lightCel Skeggs is a glorious beacon of lightCel Skeggs is a glorious beacon of lightCel Skeggs is a glorious beacon of lightCel Skeggs is a glorious beacon of lightCel Skeggs is a glorious beacon of light
Re: Scenarios for Learning Java

Quote:
Originally Posted by dmaciel10123 View Post
Hi guys. I'm posting this thread to ask for some robot scenarios to program. I'm doing this because I'm experienced with Java but have not worked with it in FRC. My team primarily uses LabVIEW, but I would like to learn to work with Java and C++ as well. I may also use some of the scenarios you provide to help teach other programmers from my team who also wish to learn to work with these languages. I'll probably work with the 2013 version of the FRC libraries so I can use jRIO to test.

Edit: when I say scenarios I mean list different actuators, sensors, and functions that the robot would use.
Ideas for what your code could control:
  1. Drive Code (as notmattlythgoe suggested)
  2. Shifting Code
  3. Some sort of collector
  4. A pneumatic actuator (perhaps an Arm)
  5. Autonomous modes - drive forward, 1 ball, 2 ball, 3 ball
  6. Kid Mode for Drive Code (for robot demos - pretty much a quick way to set the robot to drive slower so that kids can drive it)
  7. Kinect control for Autonomous
  8. Compressor status & pressure sensor readouts
  9. A shooting mechanism, probably based on whatever your team used this year.

If you can do all of that, you can program most of what a robot might require.
__________________
Software manager alumnus. Developer of the CCRE, a powerful robot code framework based on dataflow and composibility.
Refer to as she/her/hers. Years of FRC: 2012, 2013, 2014, 2015, 2016. FLL for a few years beforehand.
Team 1540: The Flaming Chickens | Portland, Oregon | Twitter | Facebook
Reply With Quote
  #4   Spotlight this post!  
Unread 07-05-2014, 23:28
NWChen's Avatar
NWChen NWChen is offline
Alum
no team
 
Join Date: Oct 2012
Rookie Year: 2012
Location: New York City
Posts: 205
NWChen is a splendid one to beholdNWChen is a splendid one to beholdNWChen is a splendid one to beholdNWChen is a splendid one to beholdNWChen is a splendid one to beholdNWChen is a splendid one to beholdNWChen is a splendid one to behold
Re: Scenarios for Learning Java

Everything said before, and some:
__________________
2012 - 2015 • Team 2601

Reply With Quote
  #5   Spotlight this post!  
Unread 08-05-2014, 08:03
JesseK's Avatar
JesseK JesseK is offline
Expert Flybot Crasher
FRC #1885 (ILITE)
Team Role: Mentor
 
Join Date: Mar 2007
Rookie Year: 2005
Location: Reston, VA
Posts: 3,637
JesseK has a reputation beyond reputeJesseK has a reputation beyond reputeJesseK has a reputation beyond reputeJesseK has a reputation beyond reputeJesseK has a reputation beyond reputeJesseK has a reputation beyond reputeJesseK has a reputation beyond reputeJesseK has a reputation beyond reputeJesseK has a reputation beyond reputeJesseK has a reputation beyond reputeJesseK has a reputation beyond repute
Re: Scenarios for Learning Java

You wouldn't have to use Java at all on the robot to use it for the driver's station. There are some pretty nifty things you can do with data from the robot during the build season and during the competition season.
__________________

Drive Coach, 1885 (2007-present)
CAD Library Updated 5/1/16 - 2016 Curie/Carver Industrial Design Winner
GitHub
Reply With Quote
  #6   Spotlight this post!  
Unread 09-05-2014, 16:24
sthreet's Avatar
sthreet sthreet is offline
Registered User
AKA: scott threet
FRC #4692
 
Join Date: Oct 2012
Rookie Year: 2012
Location: Toutle Lake
Posts: 84
sthreet is an unknown quantity at this point
Re: Scenarios for Learning Java

Quote:
Originally Posted by JesseK View Post
You wouldn't have to use Java at all on the robot to use it for the driver's station. There are some pretty nifty things you can do with data from the robot during the build season and during the competition season.
Is it alright if I ask how one language can communicate with another directly? I mean, I could make a file of some sort (txt?) and get the data from it, if both languages supported that, but something that would work better in realtime?
__________________
Spoiler for gif:
Reply With Quote
  #7   Spotlight this post!  
Unread 10-05-2014, 01:51
Cel Skeggs Cel Skeggs is offline
Robot Software Manager Alumnus
AKA: Previously known as Colby
FRC #1540 (The Flaming Chickens)
Team Role: Alumni
 
Join Date: Feb 2013
Rookie Year: 2009
Location: Portland, Oregon, USA
Posts: 107
Cel Skeggs is a glorious beacon of lightCel Skeggs is a glorious beacon of lightCel Skeggs is a glorious beacon of lightCel Skeggs is a glorious beacon of lightCel Skeggs is a glorious beacon of lightCel Skeggs is a glorious beacon of light
Re: Scenarios for Learning Java

Quote:
Originally Posted by sthreet View Post
Is it alright if I ask how one language can communicate with another directly? I mean, I could make a file of some sort (txt?) and get the data from it, if both languages supported that, but something that would work better in realtime?
You can usually use TCP sockets to communicate between devices in general, and pretty much all modern languages support sockets.

Alternatively, you could use an existing protocol written on top of sockets, such as NetworkTables (comes with FRC robots and usable from at least C++ or Java, although there may be a LabVIEW interface as well) or a team's released network communication library (My team, for example, wrote an open source communication framework, although that's only in Java. I'm sure that you can find some others if you look through the code releases from various teams that have been popping up in the various Programming forums here.)
__________________
Software manager alumnus. Developer of the CCRE, a powerful robot code framework based on dataflow and composibility.
Refer to as she/her/hers. Years of FRC: 2012, 2013, 2014, 2015, 2016. FLL for a few years beforehand.
Team 1540: The Flaming Chickens | Portland, Oregon | Twitter | Facebook

Last edited by Cel Skeggs : 10-05-2014 at 02:06.
Reply With Quote
  #8   Spotlight this post!  
Unread 10-05-2014, 13:12
JesseK's Avatar
JesseK JesseK is offline
Expert Flybot Crasher
FRC #1885 (ILITE)
Team Role: Mentor
 
Join Date: Mar 2007
Rookie Year: 2005
Location: Reston, VA
Posts: 3,637
JesseK has a reputation beyond reputeJesseK has a reputation beyond reputeJesseK has a reputation beyond reputeJesseK has a reputation beyond reputeJesseK has a reputation beyond reputeJesseK has a reputation beyond reputeJesseK has a reputation beyond reputeJesseK has a reputation beyond reputeJesseK has a reputation beyond reputeJesseK has a reputation beyond reputeJesseK has a reputation beyond repute
Re: Scenarios for Learning Java

Quote:
Originally Posted by sthreet View Post
Is it alright if I ask how one language can communicate with another directly? I mean, I could make a file of some sort (txt?) and get the data from it, if both languages supported that, but something that would work better in realtime?
A byte is a byte is a byte, regardless of language.

Say you have an array of 14 Floats (have no idea why you'd have 14 of them in FRC). C++ has a way to cast/interpret all 14 floats into an array of bytes. Java has a way to cast/interpret the bytes to Floats. You can do this all yourself (faster to implement from scratch, doesn't depend on 'flavor of the month' frameworks, often easier to increase performance) or use something like Google protobufs (easier to understand and add new features, once you understand the framework).

Some frameworks even support sending a method call with parameters across the socket between multiple languages - such as CORBA and Java RMI. However in FRC this usually isn't necessary. Our messages are is a byte array of (1)An integer which identifies how to decode the byte array (message id that, when converted to hex, usually states what the message is - 0x60B0760 = 'Go Bot Go', i.e. the HOT message) (2) An integer which is the Message length - useful for custom generic messages where the id changes based upon bit flags so that bandwidth can be saved when necessary and (3) the rest of the message. The rest of the message is an array of bytes, and each 'float' or 'int' in the array is always a 4-byte value (i.e. no doubles or longs).

Our team tried the SmartDashboard & NetworkTables in 2012 for a few things, but it wasn't working out for what we wanted. That year and every year since, we have implemented our own network code. From what I hear, it's wonky and was somewhat unreliable (we still don't reliably get a message from the D/S to the robot without killing the robot...) so we won't open-source it. Next year, we have plan to evaluate alternative approaches.
__________________

Drive Coach, 1885 (2007-present)
CAD Library Updated 5/1/16 - 2016 Curie/Carver Industrial Design Winner
GitHub

Last edited by JesseK : 10-05-2014 at 13:16.
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 09:32.

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