Hi everyone, I’m relatively new to programming as this is my first year on the team. I’m wondering if any of you have any tips/resources that would be of any benefit to me; I have been researching on the WPILib Docs to find out more, but I’m just trying to broaden my scope of sources and gain more info from those who have a bit of experience doing this. Thank you!
The WPILib Docs are great to read from start to finish, even if you won’t be using certain things now, it’s good to be aware of them for the future. I would also check out the example projects and templates that WPILib has (can be created inside VS Code) along with some of the examples from whatever hardware supplier that you are using (REV and CTRE have example projects for using their motor controllers and sensors).
If you want to learn programming, use the myriad of free resources out there.
Most importantly, for applying general programming principles to FRC programming, understanding Java objects, classes, and general conditional logic. Then, variable lifetime (scope).
If you want to learn Robot programming. Watch from 0 to Autonomous youtube series, or just start with programming your robot in the WPILib docs section.
It’s more copy-pasting than you think. It’s more copy-pasting than you think. It’s more copy-pasting than you think. It’s more copy-pasting than you think. It’s more copy-pasting than you think. It’s more copy-pasting than you think. It’s more copy-pasting than you think. It’s more copy-pasting than you think. It’s more copy-pasting than you think. It’s more copy-pasting than you think. It’s more copy-pasting than you think. It’s more copy-pasting than you think.
All of the tips here are awesome!
One thing to remember is that there are 5 million different ways to solve every problem, so don’t just go with the first one you think of, but don’t spend too long finding the “best” one.
KISS (Keep It Simple Stupid). This applies to code as well. Better to have well-tested code that you understand that something really complicated that only sometimes works.
One of the most helpful things to have is a place to ask questions. Google and Chief Delphi are great places but you can also join the Bear Bytes discord. It is a programming focussed discord that is ever-growing with members from teams all over the place. It was started by Team 930 from southeast Wisconsin and is mainly populated by members of teams around there.
Join link: https://discord.gg/Hz8qSExaS5
When programming your robot’s subsystems, it’s best to be in close contact with those working in that subsystem such as mechanical, like if you want to make code for your intake or arm, keep talking to them, like what they want the subsystem to do, what changes they made or want to make it do, etc. That way you can write whatever code is needed beforehand rather than having to write it on the spot and taking more time than needed.
And having someone idiot check your code is always nice, just going through what you wrote and checking the logic just to make sure something doesn’t go wrong and break your robot.
And this is just my opinion, but I think using IntelliJ is better than the WPILib Visual Studio Code, as it has relatively better IntelliSense and a little more friendly user interface for Github functions like pushing and pulling from your repo, though there are stuff like updating your vendors or installing vendors were you have to use VSCode to run it, but deploying and building to the RoboRIO can be done all in IntelliJ
This is a big deal.
Of course you need all of the general programming concepts as mentioned but there is so much in WPILib that just knowing what’s there will expand your thinking and make you more productive - “You mean there is a function for that already?!?!”.
And don’t just read it once, go over it again, and again, each time you’ll mentally go deeper and retain more because it all builds on itself.
If there are other programmers on your team, ask them to help teach you. They (theoretically) already know programming and robot coding and even if they can’t do full teaching they can be great for answering small questions. As the code lead for my team, I really do want everyone on the programming team to know how to program. Though as other people has said the wpilib docs are a great source and will often know more than your fellow programing people.
Simulate, simulate, and simulate. Programmers will never get the bot on schedule and setting up a simulation framework even a simple one using wpilibs built in system or one of the dozens produced by other teams can allow for you to develop and work on high level controls, command logic, and general layout of your code long before you get access to the robot.
What really helped me learn FRC Programming (I already had existing Java knowledge) is copying code. Not copy-pasting, but in one tab I had the drive code from one of my team’s old robots, and on the other tab I had VS Code. What I did was I would go through each subsystem and command and retype everything. It got me to think about what I was actually typing and it left me thinking of questions, which I would answer using the documentation. The real key is to keep thinking of questions and ideas, and try to find the answers to them.
I can’t guarantee this will work for everyone, but if you have a fast and active mind like mine then this can be very useful.
This is just like the difference between reading about a new language and looking at the examples or actually taking the time to type them in - however trivial.
You develop the “feel” for what you’re doing and the mechanics of the language or the function or whatever get imprinted into your brain in a way that you gain and retain so much more.
Programming isn’t reading code, it’s writing code - the first is like watching a video, the second is actually doing it. You want to be a doer and will be much less effective if you’re just a watcher. Even if the “doing” thing you happen to be doing right then is reading code; you understand it better because you’ve actually done it.
@Gold87 recommendation is super solid. It’ll make you a better programmer.