Introducing FRC Blocks - A starter program for FRC coding novices

FRC Blocks is a web interface that allows you to code FRC robots using an intuitive drag-and-drop interface. It compiles to Python in real time, allowing you to see the code that you “write”. FRC Blocks is intended to be a bridge between drag-and-drop languages (scratch, labview) and more traditional programming languages.

FRC Blocks is great for:

  • Workshops
  • Demonstrations
  • Novice Programmers

I started this project as a way to get more members of my team involved in programming the robot, even if they have no prior experience or build season is only 3 weeks away.

Try it out (no persistence or runner)

View on GitHub

It’s simple to install and use.

  1. Download FRC Blocks off github
  2. Install pyfrc on development computer and robot
  3. Start webserver (run.bat)
  4. Navigate to localhost:8000/cgi-bin/
  5. Start coding! Use procedures named robotInit, teleopPeriodic, etc as starting points. All blocks are very similar to their robotpy counterparts.

Pneumatics, motors, some sensors, and joysticks are implemented. The live version does not spit out runnable code, as it needs a bootstrap IterativeRobot class, which is provided in the file.

Disclaimer: I have not tried this on a robot yet. However, it works on the pyfrc simulator. I’ll update this soon with info on robot testing.

Wow. Very cool. thanks for sharing. Will have to check it out in more detail tonight.

Dr W

This looks really cool! It’s a little confusing at first without any instructions, but I got the hang of it after a few minutes. I will have to show this to my new programmers to introduce them to robot programming (as opposed to regular programming). I would love to see a good set of instructions, and pneumatic control.

Blockly is cool, interesting the way that you’ve changed/extended it.

I’ve been using Snap! recently since it also allows you to create your own blocks.

How did you pick Blockly as your base?

I’ve never heard of Snap! before now. I got this idea from MIT App Inventor 2, which uses Blockly.

Actually, after looking it up, I realize that I once used BYOB, a long while ago. Does that also compile to some language that uses wpilib?

If you run Snap! and go into the examples look for Codification. It’s a short example that produces C, Smalltalk, Javascript and Python.

Needs some refinement, but very cool.