How do you teach new programming members?

Whether they be completely brand new to the subject or have years worth of general coding experience, how do you teach new FRC programmers what they need to know for build season? Furthermore, how do you keep programming fun and engaging?

Every year my team tries to teach with presentations that are slow and boring and no one learna from them. And every year people don’t know what they’re doing, so coding the robot is usually left to the same 2 people when there’s close to 20. This causes people to feel insignificant and leave for other subteams. How do I spread the knowledge and get everyone learning what they need to do to elevate our programming subteam?

Any suggestions are appreciated and the more specific the better! Thank you in advance

Break them down into groups of 1 experienced programmer to a couple inexperienced. Then give each group indicidual tasks. Learn by doing. The lead and head mentor can go group to group watching what they are doing, making suggestions, or helping them past sticking points. Presentations suck. PowerPoint sucks more. If they have a question that is in documentation tell them where to find the document. Or which website to look on.

I’ve taught Labview for FRC workshops quite a few times, and I find that a “build along with me” method tends to work better than slides in medium-group settings (5-15ish). It’s easier to remember something you’ve done than something you’ve seen on a slide, and if they make a mistake and have to fix it, it’ll stick better than just seeing the happy path.

I do a quick high-level walkthrough of the architecture (what happens in each big section (like Begin, Robot Main, Teleop, Auton, Periodic Tasks…) and how the control flow goes through the match), and then I describe what we want the (theoretical) robot to do at the end of the session. Then I start building it on a PC that’s hooked up to a projector and have the learners build along at the same time on their own machines. One of my co-mentors wanders the floor and helps people who are stuck, and I stop and do the same if there are more people adrift than he can handle. I don’t just do the thing, either. I ask the students what they think comes next, I talk about things that could go wrong, and I make obvious mistakes and let them catch me.

Problem statements for a training session would include things like “For a west-coast-style drivetrain with two CAN-Talons (left and right), make the drivetrain controllable using Joystick-1’s primary X and Y axes and also set up the compressor for pneumatics” or “Take a motor mechanism with one CAN-Talon motor controller and one pneumatic actuator and set it to execute this simple state machine (see drawing) using these control and sensor inputs.” Keep the problems fairly petite, because it typically takes more than twice as long to teach it as it does to do it.

For a more one-on-one or small group (<5) training, put a learner in the driver seat and have them do all the typing/mousing. Don’t tell them everything – use a lot of leading questions. “Ok, so the Electrical team has told us these CAN Talons will be plugged into ports 1 and 2, and that 1 is the Left one. Where do you go to tell the code they exist and give them some names we can use later?..” If you have more than one learner, make sure you swap out who the driver is periodically. Have the non-drivers do documentation look-ups where appropriate.

I was planning on doing that this year, but I don’t have enough programers anymore. I had 5 other experienced programmers, and now I’m down to one. I don’t know how to implement this model without enough experienced programmers.

I’m entering the sort of mid-level mentor stage, after five years of experience. I am no longer completely new to the subject, but I’ve been around long enough to have learned a couple of things. So, here’s my perspective on the subject.

I gave up on trying to teach programming to kids that have zero programming experience. If they don’t know what a variable is, or a method/procedure/subroutine, I tell them they need to take some sort of class from somewhere else before they can be part of the programming team. That may seem a bit harsh, but my experience is that I just don’t have the time to devote to the very basic tasks. Whether or not your team can afford to do introductory programming instruction will depend on your specific circumstances. How many mentors? How much time? During what part of the season, etc?

So, for kids who at least know the basics, I start with exercises that have immediate impact, a sort of “hello Robot”, approach. I walk them through setting up a robot project using the FRC libraries, and then explain that the good folks at WPI have created libraries for the most common objects that we will use. I start with motors. Write a program that tells a motor to turn on and off. We have a test bench that we created that has a variety of motors and sensors, wired up to a Roborio, so I have the students write a program that will turn on one of those motors and make it spin. If you don’t have such a bench, but you have last year’s robot rolling about, have them write and deploy a piece of code that will turn on the motors and go forward for one second.

After that, I add extra pieces, one at a time. Now spin the motor, or go forward, when the joystick is pressed. Now, read the encoders and stop when you get a certain distance.

If using a real robot, and your team has been around a while, your drive code might have some “fancy” stuff, like gyroscopic control for straight driving. Strip that stuff out, so that it’s down to the core driving feature when teaching new programmers.

Above all, all of that theory stuff about what makes “good code” is not something you start with for a new programmer, or even an experienced programmer who is new to FRC. Start with practical, hands on, immediate feedback exercises as much as possible. After 35 years of professional programming, that’s still the way I learn any new programming language, operating system, library, or whatever else I’m doing. Figure out the “hello world” program, and add to it. Once I get to the point where I’m confident I can use the tool, then and only then do I actually start thinking about design considerations. These kids won’t have that level of experience, so it will take them longer to get past the basics. (I don’t know how many times I’ve had to explain, patiently, the reason they are getting the null pointer exception. “There’s a difference between declaring an object, and actually creating an instance of the object.”)

The best way to keep people engaged is to set up the exercises so they have frequent successes. Especially if they have little or no programming experience, start with a installing the sample tank/differential drive code on a robot; this also helps ensure that your programmers know how to deploy code. Then do fairly straightforward things like changing the joystick style, reducing maximum throttle based on a control, and sending messages to the dashboard. Then, when it comes time to add manipulators, start getting into what the various blocks of code do, and quickly make something go up or down or feed a manipulator in/out. Do the more formal “programming 101” stuff in between these more immediately satisfying tasks, preferably in a way that each new programming structure gets quickly used to create a new functionality.

All of the above, but develop a task-based project, where success is easily defined. Like “Make the robot move”.

Help but don’t do.

I spent a lot of time writing step-by-step tutorials that teach them how to program. I tried doing “lecture style” and found that I was boring some and moving way too fast for others so this allows them to go at their own pace and I can spend all my time answering questions.

I try to teach newbies with no programming, but as others have mentioned - it’s not incredibly successful.

Students with prior coding experience get to do a series of tutorials on “how to robot” that start with simple concepts (motor controlled by a joystick) to continue to more complicated topics (PID and autonomous).

I haven’t made time to update it since CTRE changed their libraries - but here it is as an example: Lets Learn Programming

Preferably, students each get to work alone but limitations in laptops mean that students might have to work in groups of 2 (or at most, 3). They all have to share robot access though.

One thing I noticed is that new programmers can sometimes rely too much on waiting for experienced programmers to give them the answer. Just this week, we had two students that needed to learn programming, one student who had a bit of experience, and two programming mentors.

For simplicity sake (and protection of identity), the two students that need to learn are Student A and Student B. The student with a bit of experience is Student C. The other programming mentor besides myself is Mentor A.

Student B unfortunately forgot their laptop and Mentor A is trying to finalize the reference document and create some example programs to utilize. Student A is starting fresh with programming, relying on Student C to help. Unfortunately, I notice that Student C is being very hands-on, and both are leaving Student B out.

Since I know it’s very likely that I will be a relatively-inactive mentor for a couple of years as I try to get my feet wet, and I know that Student C doesn’t want to be the only one programming the robot (and they wish to learn other areas as well), I eventually stepped in and proposed this:

Student A and Student B work together to try and figure out the programming example. If they are completely stuck and cannot go any further, they ask Student C for help. If the three of them working together cannot figure it out, they come to me or Mentor A for help.

While this was only a one-time solution, it sparks this idea where the students are more involved, the newer programmers work together to find solutions, and the students are more reliant on each other rather than immediately turning to mentors for help.

So far, it’s worked tremendously and both Student A and Student B felt like they learned something. It’ll have to be adjusted when we reach the extent of Student C’s knowledge, but while we’re still teaching the new programmers, this seems a more viable solution than just saying “Type this and it makes this happen.”

Does anybody do anything with FRC robot simulators? I am aware they exist but have not had a lot of experience with them. We tried to look at it in Stronghold year but the sim was so resource heavy that it wasn’t practical to use.

Alternately I think a neat project would be enabling code that “looks like” robot code to run on something like a Raspberry Pi, where we could create little 4WD robots and make them move around.

My team teaches by having our head of software show examples of how to use certain LabVIEW tools up on the classroom projector and then assigning groups (with a certain ratio of veteran members to new members) various things to do, walking around and helping as needed.

I’ve found that using a simulator to explain and test logic is a very useful tool when no roboRIO is available or impractical to bring to your location.

As for teaching, I find that the hardest learning curve to get over is the very basics (methods, if elseif else statements). A simulator is perfect for that because it lets you write laptop-runnable basic test code that still looks and feels like writing robot code.

We’ve got a repo that has a few different branches showing some of the things we’ve simulated.

Some of it is written for the coding practice for mechanisms we may build in the future, some for testing robot code before we waste our time at the build site when we need to test efficiently.

The master branch is where we would modify anything we use for teaching, but we don’t typically commit any of that.

Huge shoutout to team 174 for making SnobotSim plugin.
With the official build and development environment being moved to Gradle and VSCode in 2019, I’ve noticed that there is an option for “Simulate Robot Code on Desktop” which is disabled in the Alpha, so having an officially supported simulator may be something that will be available in 2019 (My personal guess, not confirming anything)