|
The LiftStateMachine explained in “Build Day: Motor and Rotation Sensor to Lift, Worked on Lift Code, Built Holder 1.1.1,and Mounted Radio” on 11/10/2021 for the last robot will be functionally identical when adapted for this bot. Additionally, a nearly identical state machine design was used for our ring intake and for the pneumatic holder. Because most of the code is exactly the same, we don’t need to put it here. All specific changes can be seen in the code branch of the GitHub repository this notebook is hosted in. DesignA significant change in the design of the code, however, was the transition to using static classes for our state machines instead of normal classes. When you make all the functions and variables of a class
This is more clunky than something like this, which better represents the real world objects the code is controlling:
CreateThis design change was fairly easy in implement. Here are the primary changes screenshotted from the GitHub repository: Additionally, instead of having a separate function from outside the thread that actually runs the state machine in a thread, we can have a function contained within the class, because of how multitasking is handled on the brain. This is what is changed to make this happen in main.cpp: |