Lab 6 Adding a Subsystem to the robot - MDHSRobotics/TeamWiki GitHub Wiki

Home / References / [Introduction to Programming - Part 2](Introduction to Programming - Part 2)

#Lab 6 - Adding a Subsystem to the robot

###Objective In this lab, you will create a new Subsystem for the robot.

###Prerequisite

  • Tote2016 project opened in Eclipse

###Steps

  1. Create a new SubSystem class

    • Expand the src folder in the package explorer
    • Right click on the org.usfirst.frc.team4141.robot.subsystems package to bring up the context menu
    • Select the Class option from the new Menu
    • Enter a name for your Subsystem class, e.g. MySubsystem
    • Set the Superclass to org.usfirst.frc.team4141.MDRobotBase.MDSubsystem
    • click the Finish button
  2. Implement required methods

    • Hover over the class name, and select the auto fix option, this will add a constructor to the class.
  3. Add subsystem to the Robot

    • Add the following to the configureRobot() method of the Robot class
     	add(new MySubsystem(this, "mySubsystem")
     			.add("setting", new IntegerConfigSetting(0,10,4))
     			.configure()
     	);	
    
  4. Save and close any files you have created or modified.