Wpi lib screensteps live code#
The servo motor should be connected to PWM port 0 and the code uses a Logitech F310 for the operator interface. The following is an example of a very simple Command Based Robot that has a single subsystem consisting of a servo motor with two positions: Open, Closed and they are selected using the A and B buttons on a gamepad. ScreenStepsLive has a very good example of how a program might look if programmed for TimedRobot and then the same program converted to CommandRobot you should review it here For example, when the X button is pressed on your controller run a command to launch a frisbee. However, it now creates and instance of the RobotContainer class that creates the robot subsystems, user interface objects(xbox controller, joysticks, etc.) and binds button presses to the activities (commands, command groups) that your robot will be performing. Robot.java still extends TimedRobot (the framework we've been using until now) and the methods robotInit(), robotPeriodic(), autonomousInit(), autonomousPeriodic(), teleopInit(), teleopPeriodic().
command groups represent behaviors: a set of activities that must be performed in a particular sequence (such as pointing a turret at a target, adjusting the elevation angle, and then throwing a frisbee into it).Ī given activity may require more than one subsystem (e.g.commands representing activities that can be done by one or more subsystem (e.g.subsystems representing physical parts of our robot: intakes, shooters, turrets, drivetrains, etc.You can read about it in ScreenStepsLive. WPILib provides a framework called Command Based Programming that helps with this.
Wpi lib screensteps live software#
Improving cohesion and reducing coupling are key concepts in software engineering. As our robot programs become more complex, a framework is needed to help keep related functionality together ( cohesion) while preventing unrelated functions from becoming entangled ( coupling).