Log in

View Full Version : Java help? for 3596


Intern
15-01-2014, 09:26
Our team(3596) has a lot of new programmers... two of us it is our second year, we did not code a thing last year, hello world does not help alot, we learn most of this really fast,we have recently made a drive code and layout for the Xbox controller, is there any tips on how to learn java for our new programmers. ::rtm::

otherguy
15-01-2014, 10:04
Have you checked out the guides available at http://wpilib.screenstepslive.com/s/3120?

For Java, start taking a look through this section:
http://wpilib.screenstepslive.com/s/3120/m/7885

notmattlythgoe
15-01-2014, 10:46
Our team did a presentation on Command Based Java this past fall, if you'd like the presentation I can send it to you.

Intern
15-01-2014, 19:04
can you send this to us our programming captain would like a copy for us

otherguy
15-01-2014, 20:22
If you decide to use the Command Based Robot project (vs SimpleRobot or IterativeRobot), then I would suggest the following resources (in addition to the link I posted above):


Powerpoint presentation introducing the command based robot project (starts on slide 18): http://simplerobotics.org/cRIO/2012NewFeatures.pdf
WPILib Cookbook: http://firstforge.wpi.edu/sf/docman/do/listDocuments/projects.wpilib/docman.root.c_and_java_documentation


Complimenting the cookbook are a series of videos on youtube under this (http://www.youtube.com/user/BradAMiller) account:

Introduction: http://www.youtube.com/watch?v=v0vt9yKLxUQ
Claw: http://www.youtube.com/watch?v=PpDX0CAcUNc
Elevator and Wrist: http://www.youtube.com/watch?v=j2Xz8bRRcF0
Command Groups http://www.youtube.com/watch?v=QRv98SaVS6E
Drivetrain http://www.youtube.com/watch?v=BZ9l4DAaUAI
Autonomous http://www.youtube.com/watch?v=5rJLi-QOflc



And for completeness, and your awareness, last year introduced a tool called Robot Builder. It's a GUI that allows you to generate the command based robot project java code automatically. Resources on that tool can be found here: http://wpilib.screenstepslive.com/s/3120/m/7882

notmattlythgoe
16-01-2014, 07:39
can you send this to us our programming captain would like a copy for us

For anybody that is interested here (https://drive.google.com/folderview?id=0B6s5G2ggzYdYdEhGQk4teURpazA&usp=sharing) is a link to the presentation and the accompanying code to go along with it. If you have any questions please feel free to email me.

Ipiano
20-01-2014, 19:57
I would HIGHLY recommend using the command-based pattern, alongside the RobotBuilder program.

RobotBuilder can be found in the SunSpotFRCSDK directory under the user directory on the C Drive, in the tools folder. The program itself allows you to define the hardware and "commands" you will have, and then it generates the "skeleton" code which has all of the constructors for everything, and all that's left to do is write the logic that runs it how you want. In addition, the program automatically sets up everything so that you can use the smartdashboard (also in the tools folder) and put the robot in "test" mode(an option like teleop or autonomous) and manually drive/test all sensors and actuators.

nyaculak
20-01-2014, 21:33
I don't think I can stress this enough, but I REALLY discourage the use of the CommandBase template. I've tried coding with it, but this system only seems to complicate the robot code.

Each part of the robot needs to be broken down into subsystems and then the commands for that subsystem are contained within a separate class. I find that our code flows much more intuitively if we combine data and behavior into one class for each subsystem program the usage of it in a procedural manner.

The CommandBase seems to strip a lot of the control from the user. You're pretty much stuck with the system that the CommandBase provides. You can accomplish exactly the same thing in both CommandBase and Simple/Iterative Robot templates, but if the CommandBase system does not fit what you want to achieve, you are going to have a bad time. With the Simple and Iterative Robot templates, you can decide the precise execution of the actuators on the robot and easily set up your own system for how to do so.

Also, for a team with less experienced programmers, the CommandBase system seems much more complex. I can't say I speak from experience, but if you encounter a problem when writing your code, it will be harder to diagnose where the problem is located. Even if you use RobotBuilder, you'll likely encounter logical errors that will be difficult to debug for novice programmers.

The CommandBase template did come with one thing that I really liked and that was the inclusion of the RobotMap class. It's used to contain a listing of static fields of all the digital and analog input/output channels from the cRIO modules and the sidecar. This was a great idea! Every team should do that.

notmattlythgoe
21-01-2014, 07:07
I don't think I can stress this enough, but I REALLY discourage the use of the CommandBase template. I've tried coding with it, but this system only seems to complicate the robot code.

Each part of the robot needs to be broken down into subsystems and then the commands for that subsystem are contained within a separate class. I find that our code flows much more intuitively if we combine data and behavior into one class for each subsystem program the usage of it in a procedural manner.

The CommandBase seems to strip a lot of the control from the user. You're pretty much stuck with the system that the CommandBase provides. You can accomplish exactly the same thing in both CommandBase and Simple/Iterative Robot templates, but if the CommandBase system does not fit what you want to achieve, you are going to have a bad time. With the Simple and Iterative Robot templates, you can decide the precise execution of the actuators on the robot and easily set up your own system for how to do so.

Also, for a team with less experienced programmers, the CommandBase system seems much more complex. I can't say I speak from experience, but if you encounter a problem when writing your code, it will be harder to diagnose where the problem is located. Even if you use RobotBuilder, you'll likely encounter logical errors that will be difficult to debug for novice programmers.

The CommandBase template did come with one thing that I really liked and that was the inclusion of the RobotMap class. It's used to contain a listing of static fields of all the digital and analog input/output channels from the cRIO modules and the sidecar. This was a great idea! Every team should do that.

Not to sound rude but, I actually disagree with everything you've stated and actually believe the opposite of it all. As an ex-teacher and a java developer I've found the command based system to be much easier to teach and debug than the iterative platform. The students are also able to pick it up extremely easy are able to easily debug what is going on.

krieck
21-01-2014, 13:22
The command based architecture does add a learning curve, but if you take the time, it should become intuitive. It should allow your program to scale up to a large, sophisticated program. More important, it should allow multiple programmers to work on different subsystems and commands without stepping on each other's toes too much.

I also highly recommend the RobotBuilder, although you absolutely need to take the time to understand all the code it generates.