![]() |
Seeking advice for rookie programming
Hello! I'm a member of the newly created FRC Team 6420, and am looking for advice on programming. I've been the main programmer for FTC for the past two years, using Android Studio. You can view my work for this year here.
I'm familiar with Java & IntelliJ, but our main mentor is recommending we use C++ because teams in the area use it and we will be able to get help. I have some limited experience with C++, and no experience with eclipse. I'm aware the Labview exists, but I really don't like any sort of visual programming. It seems exceedingly clunky to me. So. What would you recommend? Are there online tutorials for FRC programming? How is it similar / different to FTC programming? Anything else you'd like to add? Thanks! |
Re: Seeking advice for rookie programming
Welcome to FRC!
WPILIB ScreenStepsLive is the definitive FRC programming tutorial. If you have experience with Java, I would personally recommend using that. Changing IDEs is a lot easier than changing languages. I've also seen some people using IntelliJ and Gradle to do robot code. If you know Python (or don't, it's easy to learn!), that's also an option, using robotpy. |
Re: Seeking advice for rookie programming
There may be other opinions, but I would recommend staying with what you know -- in this case Java. The "pain" of learning C++ just isn't worth it. (And this coming from a mentor who knew C++ and had much more C++ experience prior to starting this mentor gig and having to learn Java). Also, if there continue to be FTC teams that you are drawing students from, you have the advantage of having incoming programming team candidates with Java expertise.
I mentor both FRC (2992) and FTC (8991 and 10337) teams for programming using Java, and we have found the advantage of having incoming FRC students with FTC Java experience to be a great jump starter. I recommend you check out https://wpilib.screenstepslive.com/s/4485 which is the documentation for the controls and programming from last year. AFAIK the 2017 version is not yet posted (though there is some 2017 beta info at that same site). Whether you use C++ or Java, you will likely be using Eclipse. It's not that different from Android Studio. Installation instructions at the above website are reasonably easy to follow. Its actually a bit easier to setup for Java than C++. The API tutorial for Java is pretty decent. You will see a ton of similarity w/ FTC API for accessing hardware and driver station. The IterativeRobot base class is very similar to the OpMode base class for FTC. While it may seem a bit more complex at first, I strongly recommend you look into the "Command Based" programming model. The "Robot Builder" tool that comes w/ the API is a good way to jump start into Command Based programming. My first year as a mentor, the team had lost all of its programming resources so we were essentially programming rookies. We switched that year from C++ to Java and started off doing IterativeRobot but switched partway through build season to Command Based as it makes Autonomous programming much easier (it enables a base class called CommandGroup similar to LinearOpMode from FTC). Command Based also allows easy multitasking for your robot, with each "subsystem" able to operate fairly independently, making your code easier to implement and troubleshoot. Finally, make sure you take a look at the SmartDashboard tool and API. This is similar to (but much more powerful than) the Telemetry functions in FTC. I took a quick look at your FTC code, and it looks good. I don't expect you to have any issues making the FRC transition. Good luck and have fun Mike |
Re: Seeking advice for rookie programming
Disclaimer: my team is switching from C++ to Java this year
C++ Pros
Java Pros:
|
Re: Seeking advice for rookie programming
Disclaimer/Background: I'm a software engineer with 30+ years experience programming in C and C++, but I know a fair amount of Java as well. I have been working with our FRC team doing C++ code for 11 years. I have no experience with FTC code.
I'm not going to tell you what you should choose, but here are are few points to consider:
Save Save Save Save |
Re: Seeking advice for rookie programming
I agree with much of what has been said in this thread, but...
Quote:
|
Re: Seeking advice for rookie programming
Quote:
Quote:
Basically, the general idea is that C++ provides several ways to store, transfer, and access data while in Java there's only one way. You don't really need to know this unless you plan on learning C++ |
Re: Seeking advice for rookie programming
My team has used C++ for the past several years, but we are switching to Java this year because it's the language our school teaches in a programming course and we're sick of pointers.
I've used both C++ and Java, and I'd say that Java is much easier to work with. Switching from Java to C++ might seem reasonably easy, but there's a bunch of quirks you will need to learn. Nothing is different with syntax, but, as has been mentioned on this thread, the ways data is stored is rather different. |
Re: Seeking advice for rookie programming
In your situation, I'll unhesitatingly recommend java. Unless you already know c++ quite well, or are working from a considerable existing code base, or are doing something requiring really tight optimization, the "advantages" of C++ over java are really just more rope to hang yourself. It sounds like none of these apply in your situation. Outside of assembler, about the only thing which can cause as much confusion as a pointer arithmetic error with so little effort on the part of the programmer is an abused FORTRAN common block, and for pretty much the same reason.
|
Re: Seeking advice for rookie programming
Another thing to consider when selecting a language, sustainability. We have some good programmers, and they were thinking about switching from Java to C++. There were some robotics stuff that they wanted to try, that might require a faster processing loop than WPI-Lib. So we talked about it. Our high school teaches Java, so if they wanted to switch to another language, they had to be able to develop a program to teach future programmers C++. They then decide that they would stay in Java, since it fits with what the school teaches.
So TLDR, pick a language that's best for the club and can live one |
Re: Seeking advice for rookie programming
There are lots of good arguments on both sides in this thread, but I think that sticking with what your team as a whole knows best will serve you better. When push comes to shove, your team needs to be able to sort out its own code issues--your neighboring teams won't be there in your pit when the inevitable competition-day bugs arise!
I'd also argue that you're more likely to get urgent programming help here on these forums than from neighboring teams--there's simply a MUCH larger pool to draw on here! Think about the number of responses you've received to this question here in less than 12 hours! Either way you go--good luck! It's a blast! |
Re: Seeking advice for rookie programming
Quote:
One thing that I will note is that the teams that need help are disproportionately using languages other than C++. This suggests to me that teams are more conservative about moving to it than they need to be. |
Re: Seeking advice for rookie programming
Quote:
(I've heard some object to this by arguing that it is indeed pass-by-reference, but variable assignment in java is best interpreted as name-binding. But this is not how the language specification describes it.) |
Re: Seeking advice for rookie programming
Quote:
|
Re: Seeking advice for rookie programming
Hint: Programmers like to argue about their favorite languages :-)
On our team our mentors (myself included) prefer C++ as a language; however, our FTC feeder system (in Michigan FTC is generally a middle school program) is now in Java and our high school AP Programming class is taught in Java. Based primarily on these two factors we (the mentors) supported the idea of using Java even though it is not our personal favorite programming language. Prior to that we had been using LabVIEW which, while I will admit I never grew to love, I least felt I had a pretty good understanding -- but we never found it easy to create work flow that supported 10+ programmers without more discipline than we were able to maintain with high school students during build. I would suggest writing up a pro and con for each language. Keep in mind your primary goals -- different teams can easily have different goals. For us it was choosing a language which will allow us to engage the most students (we have a large programming sub-group) and field a competitive robot. Other teams may want to prioritize the learning of only one or two programmers and they are personally going to get more out of using C++ or Python -- there is no one perfect answer. |
Re: Seeking advice for rookie programming
Quote:
That said--you really don't want to be too dependent when other teams are likely to have their own issues to deal with. |
Re: Seeking advice for rookie programming
I've found the best language is the one that the team knows. If your mentors know c++ you should use c++. If your mentors are familiar with Java, you should use Java. Having access to a living encyclopedia on a subject is insanely useful. I say this having been both a student and a mentor.
"oh hey I wonder how to do this thing." "Java has a thing for that." VS "oh hey I wonder how to do this thing." commences googling and experimenting for an hour/ 5 hours. |
Re: Seeking advice for rookie programming
The APIs between C++ and Java are almost identical. Thus, a C++ team would be able to help you get started with encoders, for example. I help C++ teams all the time, even though my understanding of C++ is rudimentary.
|
Re: Seeking advice for rookie programming
Thanks for all the advice! We have decided to use Java, as our mentor knows both Java and C++, and the FTC Team will continue to produce Java programmers.
I will look into Command Based programming. It seems very similar to a system I was imagining implementing for FTC, until LinearOpMode was updated to be less irritating. I've installed eclipse (& all the 2016 stuff), and have started to take a look at the sample robot code. It's not particularly difficult to navigate eclipse and it seems similar enough to IntelliJ that I won't have many problems. |
Re: Seeking advice for rookie programming
Once you've installed wpilib, there are some great little example programs you can access by creating a new project and selecting a new wpilib robot project. (I don't have it in front of me but you should find it easily).
If you needed to quickly whip up some code to test a drivetrain, for example, you could fire up Eclipse and have a basic IterativeRobot with a 2-joystick tank drive, ready to deploy, in a matter of about 30 seconds. Which has come in handy a few times when doing diagnostics in a hurry, such as in a pit. But more practically, you can find examples of just about anything you need to do, either by browsing the wpilib website or creating a sample project to play with. "How do I use pneumatics?" Boom, here's a working example. |
| All times are GMT -5. The time now is 11:10. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi