Programming an FRC Robot Choosing a Language 1 INDEX • The Programing Languages and their Environments • • • • The Three Major Enviroments Java with the NetBeans IDE C++ with the Windriver Workbench IDE Graphical Programming with the LabView IDE • Pros and Cons for each Language • • • • Java C++ LabView Side-by-Side Comparisons • Thanks 2 THE PROGRAMING LANGUAGES AND THEIR ENVIRONMENTS 3 There are three major programing environments available to FIRST Robotics Teams • Java – NetBeans • C++ - Windriver Workbench • Graphical Programming - LabView 4 Java with the NetBeans IDE 5 Java Basic Structure package edu.wpi.first.wpilibj.templates; import edu.wpi.first.wpilibj.SimpleRobot; public class RobotTemplate extends SimpleRobot { //Declare Global Variables here public RobotTemplate(){ //Initialize Global Variables here } public void autonomous() { //Autonomous code goes here } public void operatorControl() { //Teleop code goes here } } 6 Java IDE Interface 7 C++ with the Windriver Workbench IDE 8 C++ Basic Structure #include "WPILib.h" class RobotDemo : public SimpleRobot{ //Declaration of components go here public: RobotDemo(void): //Initialization of components goes here { //Startup routines go here } void Autonomous(void){ //Autonomous code goes here } void OperatorControl(void) { //Teleop code goes here } }; START_ROBOT_CLASS(RobotDemo); 9 C++ IDE Interface 10 Graphical Programming with the LabView IDE 11 LabView Basic Structure 12 LabView IDE Interface 13 LabView IDE Interface 14 LabView IDE Interface 15 PROS AND CONS FOR EACH LANGUAGE 16 Java Pros Cons • A well known language • Many Resources • Similar to C++ in style and syntax • Fast Compiling • Easier to pass references between functions • Object-Oriented-Programming • Text-Based language • Structured/User Friendly • Used in Computer Science Courses • Does not use the standard LabView Dashboard 17 C++ Pros • A well known language • Many Resources • Similar to Java in style and syntax • Fast Compiling • Object-OrientedProgramming • Text-based language Cons • Requires a Windows PC • Allows for free reign • Less user-friendly 18 LabView Pros • A well known language in the First FRC community • Many Resources • Graphical • Popular with First Teams Cons • Hard to navigate in the functions menu • Requires Windows PC 19 Side-by-Side Comparisons Java • Text-based • Many Resources Available • Syntax is similar to that of C++ • Fast Compiling • Object-OrientedProgramming • Structured • Easier to pass references C++ • Text-based • Syntax is similar to that of Java • Fast Compiling • Object-OrientedProgramming • Many Resources Available • Not Structured 20 Side-by-Side Comparisons LabView • Graphical • Hard to locate specific functions • Popular with First Teams • Well Documented C++ • Text-based • Syntax is similar to that of Java • Fast Compiling • Object-OrientedProgramming • Many Resources Available • Not Structured 21 Side-by-Side Comparisons LabView • Graphical • Hard to locate specific functions • Popular with First Teams • Well Documented Java • Text-based • Many Resources Available • Syntax is similar to that of C++ • Fast Compiling • Object-OrientedProgramming • Structured • Easier to pass references 22 Thanks to • • • • Team 1279 ColdFusion The Chief Delphi Community The WPI Robotics Libraries Sample Programs Provided by First For providing information that was used in this presentation 23