Changes between Version 2 and Version 3 of ControlSystems/SoftwareTeam/Training/GettingStarted/RobotFSM1
- Timestamp:
- Nov 6, 2019, 2:12:21 PM (6 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
ControlSystems/SoftwareTeam/Training/GettingStarted/RobotFSM1
v2 v3 1 You should review the Java State Machine example before exploring this code. 1 You should review the Java [wiki:ControlSystems/SoftwareTeam/Training/GettingStarted/StateMachines State Machine] example before exploring this code. 2 3 The most basic requirement for scoring points in autonomous mode is usually to drive off the starting position some distance and then stop. However, to do something interesting (and earn more points), robots usually need to perform a sequence of maneuvers and actions. There are several ways to do this, but the simplest is with a state machine. The example below is the full Robot.java program to drive straight for a set distance and then execute a turn. 4 2 5 3 6 == State Machine for PWM robot … … 160 163 } 161 164 }}} 165 166 Note that: 167 * The robot is always in one of the defined states: Starting, Driving, Turning, and Stopped. 168 * The robot transitions from one state to the next by starting a new activity: driveForward, turnRight, stop. 169 170 === Extra Credit 171 Modify the program to add more states: for example, after turning, drive forward again.