Go to Post Contrary to the term, common sense isn't all that common. - RoboChair [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 15-04-2014, 09:38
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,728
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
Command Based Java Topics

This past fall our team presented a Basic Command Based Java course at the VA FRC Workshops that VirginiaFIRST organizes every year. This summer I'd like to put together an intermediate to advanced presentation and would like some input on what are some things people would be interested in learning about if they were to attend a course on something like this.

The basic course covered:
The basic srtucture
Subsystems
Commands
Writing a basic drivetrain and autonomous.

Some more advanced topics I was thinking about are:
Creating reusable commands
CommandGroups
PIDSubsystems and PIDCommands
Case based CommandGroups

What other topics do you think would be useful? I'd also like to use this as a research opportunity for our team for things that we have not figured out the best practice for yet, and we can post our results here as we find them, even if it doesn't make it into the final presentation.
Reply With Quote
  #2   Spotlight this post!  
Unread 15-04-2014, 11:23
mwtidd's Avatar
mwtidd mwtidd is offline
Registered User
AKA: mike
FRC #0319 (Big Bad Bob)
Team Role: Mentor
 
Join Date: Feb 2005
Rookie Year: 2003
Location: Boston, MA
Posts: 714
mwtidd has a reputation beyond reputemwtidd has a reputation beyond reputemwtidd has a reputation beyond reputemwtidd has a reputation beyond reputemwtidd has a reputation beyond reputemwtidd has a reputation beyond reputemwtidd has a reputation beyond reputemwtidd has a reputation beyond reputemwtidd has a reputation beyond reputemwtidd has a reputation beyond reputemwtidd has a reputation beyond repute
Re: Command Based Java Topics

I for one have been converted into a huge proponent of robot builder.

Sooo...

Creating a Project in RobotBuilder
Maintaining a Project in RobotBuilder
Using Git to manage a RobotBuilder based project.

Interrupted vs Finished Commands
Planning for Edge Cases (i.e. no hot goal)
Extendable Commands (may be more advanced than intermediate)
Analog Buttons (many teams don't utilize the xbox triggers because they're analog)
Command - Subsystem Dependencies and Interrupts.
__________________
"Never let your schooling interfere with your education" -Mark Twain

Last edited by mwtidd : 15-04-2014 at 11:30.
Reply With Quote
  #3   Spotlight this post!  
Unread 15-04-2014, 11:28
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,728
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: Command Based Java Topics

Quote:
Originally Posted by lineskier View Post
I for one have been converted into a huge proponent of robot builder.

Sooo...

Creating a Project in RobotBuilder
Maintaining a Project in RobotBuilder
Using Git to manage a RobotBuilder based project.

Interrupted vs Finished Commands
Planning for Edge Cases (i.e. no hot goal)
Extendable Commands (may be more advanced than intermediate)
Analog Buttons (many teams don't utilize the xbox triggers because their analog)
Command - Subsystem Dependencies and Interrupts.
Great list, thank you.

Quote:
Creating a Project in RobotBuilder
Maintaining a Project in RobotBuilder
Using Git to manage a RobotBuilder based project.
We used RobotBuilder our first year and were not big fans of it, but maybe that's because we weren't using it correctly. Its something we can look into and see what we can come up with.

Quote:
Using Git to manage a RobotBuilder based project.
I love this suggestion and will probably just expand it into "Using a repository to manage your code." This is something that we finally started doing more of this year and it has help. we haven't completely figured out our best process yet but we're improving.

Last edited by notmattlythgoe : 15-04-2014 at 11:34.
Reply With Quote
  #4   Spotlight this post!  
Unread 15-04-2014, 11: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,188
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: Command Based Java Topics

Quote:
Originally Posted by notmattlythgoe View Post
I love this suggestion and will probably just expand it into "Using a repository to manage your code." This is something that we finally started doing more of this year and it has help. we haven't completely figured out our best process yet but we're improving.
Yes. 100 times yes. I can't even count how many teams have asked for help in the pits saying they made one change that broke their entire robot but have no version control system to fall back on.

We should teach proper version control system usage BEFORE we teach people how to program.

(and oh yeah, save yourself some headache and just use git.)
Reply With Quote
  #5   Spotlight this post!  
Unread 15-04-2014, 11:50
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,728
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: Command Based Java Topics

Quote:
Originally Posted by Tom Bottiglieri View Post
Yes. 100 times yes. I can't even count how many teams have asked for help in the pits saying they made one change that broke their entire robot but have no version control system to fall back on.

We should teach proper version control system usage BEFORE we teach people how to program.

(and oh yeah, save yourself some headache and just use git.)
The thing we're struggling with right now is when to branch, when to tag, etc. We just haven't figured out the best process for us yet. What do you guys do?
Reply With Quote
  #6   Spotlight this post!  
Unread 15-04-2014, 12:00
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,188
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: Command Based Java Topics

Quote:
Originally Posted by notmattlythgoe View Post
The thing we're struggling with right now is when to branch, when to tag, etc. We just haven't figured out the best process for us yet. What do you guys do?
Typically, everything lives in master. Sometimes we will tag at the end of an event so we can dial the comp bot back to where it was (as we change code a lot between events), but most times we forget to do this. Usually there is only a small group of developers using one laptop to write code, so keeping branches in sync isn't really an issue.

If a student is working on a feature that is easy to break off, I will have them make a branch that we can pull in later. An example of this is something like a tiny HTTP server or your vision code. Define the interface then let them hack on the implementation in a branch.

The main rule is don't commit code that breaks the build!
Reply With Quote
  #7   Spotlight this post!  
Unread 15-04-2014, 12:07
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,728
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: Command Based Java Topics

Quote:
Originally Posted by Tom Bottiglieri View Post
Typically, everything lives in master. Sometimes we will tag at the end of an event so we can dial the comp bot back to where it was (as we change code a lot between events), but most times we forget to do this. Usually there is only a small group of developers using one laptop to write code, so keeping branches in sync isn't really an issue.

If a student is working on a feature that is easy to break off, I will have them make a branch that we can pull in later. An example of this is something like a tiny HTTP server or your vision code. Define the interface then let them hack on the implementation in a branch.

The main rule is don't commit code that breaks the build!
Ok, so it sounds like you're doing pretty much the same thing we're doing. We keep a trunk version and a branch version. Once we're sure the code is working in the branch the way we want we'll merge it into the trunk. We also do a lot of code changes between competitions (adding in a 3rd ball pickup to our 2 ball autp after week 4 and adding in CheesyVision for hot goal 1 and 2 balls currently), the first thing we did was tag our competition code from week 6. I've heard of teams that make tags after each meeting, this just seems excessive to me but we're still trying to hash out our best practice.

The pain in the butt thing we ran into this year was our practice bot is using 2 solenoid cards instead of 1 like our competition bot is using because of a lack of correctly voltaged solenoids, so making sure we don't merge in our address changes can get annoying. We currently have 2 working branches open, one for competition and one for practice so we're not constantly having to make sure we have the right addresses in. Keeping both branches and the trunk in sync is a bit annoying.

Last edited by notmattlythgoe : 15-04-2014 at 12:11.
Reply With Quote
  #8   Spotlight this post!  
Unread 15-04-2014, 12:12
mwtidd's Avatar
mwtidd mwtidd is offline
Registered User
AKA: mike
FRC #0319 (Big Bad Bob)
Team Role: Mentor
 
Join Date: Feb 2005
Rookie Year: 2003
Location: Boston, MA
Posts: 714
mwtidd has a reputation beyond reputemwtidd has a reputation beyond reputemwtidd has a reputation beyond reputemwtidd has a reputation beyond reputemwtidd has a reputation beyond reputemwtidd has a reputation beyond reputemwtidd has a reputation beyond reputemwtidd has a reputation beyond reputemwtidd has a reputation beyond reputemwtidd has a reputation beyond reputemwtidd has a reputation beyond repute
Re: Command Based Java Topics

Quote:
Originally Posted by notmattlythgoe View Post
The thing we're struggling with right now is when to branch, when to tag, etc. We just haven't figured out the best process for us yet. What do you guys do?
This is actually one of my biggest qualms with robotbuilder, is that it doesn't support feature branching that well.

Typically I find that the drive train and the mechanisms are separate enough that, as a general rule, work on them (and they're commands) can be split into separate branches.

I personally prefer a mechanism based package structure for this reason. Something like this:

Code:
edu.pmhs
     - drive
             -subsystems
             -commands
     - arm
             -subsystems
             -commands
    - robot
             -commands (multi mechanism commands)
This allows you to quickly branch the mechanism (subsystems and commands together). It also helps to isolate the modifications that are being done.

Obviously there are still modifications that have to be made to core class (i.e. OI) but these are typically simple enough that they shouldn't require a branch.

I also encourage a "test before you commit" even for the local repo. This ensures that the students verify their work before submitting it. I also wait to do a "code review" until they are ready to publish their work.

We don't have the luxury of a multi student programming team, but I would love a model where you have a student who is responsible for each mechanism, and one responsible for the "robot".

https://www.atlassian.com/git/workfl...feature-branch
__________________
"Never let your schooling interfere with your education" -Mark Twain

Last edited by mwtidd : 15-04-2014 at 12:15.
Reply With Quote
  #9   Spotlight this post!  
Unread 15-04-2014, 13:33
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,728
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: Command Based Java Topics

Quote:
I personally prefer a mechanism based package structure for this reason. Something like this:
We create new packages for commands for each of the subsystems so they aren't all stuck in the base commands package. Makes it much easier to find what you want.

Code:
blah.blah.blah.blah.drivetrain.commands
My biggest complaint about RobotBuilder when we first used it was that it declared all of our motors and sensors in the RobotMap class instead of in their respective subsystems. Does it still do this?
Reply With Quote
  #10   Spotlight this post!  
Unread 20-04-2014, 05:15
amreuland's Avatar
amreuland amreuland is offline
Overworked Insomniac
AKA: Austin
FRC #2583 (Westwood Robotics)
Team Role: Programmer
 
Join Date: Jan 2013
Rookie Year: 2013
Location: Austin TX
Posts: 18
amreuland is on a distinguished road
Re: Command Based Java Topics

We also found things easier using a mechanism based package structure.

Also, we have a naming system
Code:
SS_ : Subsystem
C_ : Command
CG_ : Command Group
https://github.com/WestwoodRobotics/...c2014/launcher

This way, we know what is what. And we can have similar named Commands and Command Groups, if we need that
Code:
C_Pickup
CG_Pickup.
What I want to see more of, is people getting out of their comfort zone with coding. Getting them to try new things, instead of doing the same old simple, boring code.

For example, I've been making a custom Library (Much Like atalibj that I found earlier this week), and the main point of it, is the Custom main robot class. It runs smoother, and faster than the WPILib version, and adds in some more automation to the robots. https://github.com/WestwoodRobotics/RoboLibJ

Also, If you are using an IDE, Making custom templates is a really good idea.
I have A custom template for the Subsystem Class that automatically fill in the super() constructor, writes singleton code, writes a static{} block, adds in an ITable and ITableListener for custom values, creates some extra methods for the ITable.
Reply With Quote
  #11   Spotlight this post!  
Unread 21-04-2014, 16:47
NotInControl NotInControl is offline
Controls Engineer
AKA: Kevin
FRC #2168 (Aluminum Falcons)
Team Role: Engineer
 
Join Date: Oct 2011
Rookie Year: 2004
Location: Groton, CT
Posts: 261
NotInControl has a reputation beyond reputeNotInControl has a reputation beyond reputeNotInControl has a reputation beyond reputeNotInControl has a reputation beyond reputeNotInControl has a reputation beyond reputeNotInControl has a reputation beyond reputeNotInControl has a reputation beyond reputeNotInControl has a reputation beyond reputeNotInControl has a reputation beyond reputeNotInControl has a reputation beyond reputeNotInControl has a reputation beyond repute
Re: Command Based Java Topics

Quote:
Originally Posted by notmattlythgoe View Post
Ok, so it sounds like you're doing pretty much the same thing we're doing. We keep a trunk version and a branch version. Once we're sure the code is working in the branch the way we want we'll merge it into the trunk. We also do a lot of code changes between competitions (adding in a 3rd ball pickup to our 2 ball autp after week 4 and adding in CheesyVision for hot goal 1 and 2 balls currently), the first thing we did was tag our competition code from week 6. I've heard of teams that make tags after each meeting, this just seems excessive to me but we're still trying to hash out our best practice.

The pain in the butt thing we ran into this year was our practice bot is using 2 solenoid cards instead of 1 like our competition bot is using because of a lack of correctly voltaged solenoids, so making sure we don't merge in our address changes can get annoying. We currently have 2 working branches open, one for competition and one for practice so we're not constantly having to make sure we have the right addresses in. Keeping both branches and the trunk in sync is a bit annoying.
We do it a bit differently. Master is kept as the latest working/tested code that can be deployed to the robot and guaranteed to work. And only Mentors are allowed to push to master as an understanding by all programming members.

Everything else is done in branches. Every feature is branched and pull requested. The programming mentors review the branches, and either make comments, or merge it into master once the code was tested.

Now sometimes during a competition, we will work in master, but we will push to github into a new branch. And then follow the same process.

I have all of my students setup using eclipse and egit (what i personally use on my Ubuntu FRC laptop), although some students on our team use gitGui on Windows for managing their comits. We rarely ever tag, but we should.

Note: The above is the ideal scenario on our team, I hope I get to see the day that it actually works like that. LOL.


As for maintaing multiple versions of the code. The Poofs wrote a pretty neat library called a ConstantsFile I belive. It is an object that you can use to declare variables in RobotMap and then overwrite them using a textfile that lives on the CRio. If the textfile doesn't exist, it just defaults to the hardwritten value in code. I am sure someone on 254 can explain it better.

Essentially, you can maintain one code base for your comp bot and practice bot, if you wrote your variables such that they can be updated on RobotStartup via a text file, and have that text file live on the practice bot cRio. This would allow you to keep the same single source and the text file on the practice bot does the heavy lifting for you. You can accomplish this using the Poofs method, or implement your own.


As for advanced topics for command base:

1. Commands are loaded during their instantation on RobotInit. How to pass a value to a command in realtime during robot run.
2. Default commands, and how/when to use them
3. CommandBase programming philosophy. When to make something a method/function within a subsystem, when to make it a command, when to make it a command group.
4. And of course, no programming class is complete with a proper "how to comment code" discussion.


Hope this helps,
Kevin
__________________
Controls Engineer, Team 2168 - The Aluminum Falcons
[2016 Season] - World Championship Controls Award, District Controls Award, 3rd BlueBanner
-World Championship- #45 seed in Quals, World Championship Innovation in Controls Award - Curie
-NE Championship- #26 seed in Quals, winner(195,125,2168)
[2015 Season] - NE Championship Controls Award, 2nd Blue Banner
-NE Championship- #26 seed in Quals, NE Championship Innovation in Controls Award
-MA District Event- #17 seed in Quals, Winner(2168,3718,3146)
[2014 Season] - NE Championship Controls Award & Semi-finalists, District Controls Award, Creativity Award, & Finalists
-NE Championship- #36 seed in Quals, SemiFinalist(228,2168,3525), NE Championship Innovation in Controls Award
-RI District Event- #7 seed in Quals, Finalist(1519,2168,5163), Innovation in Controls Award
-Groton District Event- #9 seed in Quals, QuarterFinalist(2168, 125, 5112), Creativity Award
[2013 Season] - WPI Regional Winner - 1st Blue Banner

Last edited by NotInControl : 21-04-2014 at 16:56.
Reply With Quote
  #12   Spotlight this post!  
Unread 21-04-2014, 17:18
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,728
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: Command Based Java Topics

All great ideas guys. Keep them coming.

Quote:
What I want to see more of, is people getting out of their comfort zone with coding.
This is one of the reasons I want to do this as an exercise, to come up with ideas of ways we can implement new practices and how to perfect the ones we currently have while also providing resources to other teams to use to improve their skills.

Last edited by notmattlythgoe : 21-04-2014 at 17:33.
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 13:19.

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