(First, we have several kids who helped write this code. Excuse the naming scheme)
- Subsystem called
theCLAAAWWW
- Object called “Arm”
- Object called “Wrist”
theCLAAAWWW
is the both the arm and wrist as one. It accesses the methods in the Wrist
and Arm
to run.
We get a “State” of the theCLAAAWWW
by checking what angle the arm and wrist is in. Five states in total:
- LOADING - Arm is straight up and down, wrist pointed backwards
- TRANSPORT - Arm is straight up and down, wrist pointed forwards
- LOW - Arm is outside bot, low to ground
- MEDIUM - Arm is outside bot, medium above ground
- HIGH - Arm is outside bot, high above ground
We never tell the robot what state it is in. It only checks itself through getState()
which, again, is based on angles. The angles always print out correctly
We run a sequential command when buttons are pressed to go to different positions. We had to add quite a bit of logic to make sure the Wrist and Arm did not collide with the robot when it was going from one specific state to another. We wrote this logic in the sequential command.
The issue we are running into, is that when the sequential command checks what state it is in, it sometimes says LOADING when it runs the command. However, when we SmartDashboard getState()
, it shows the correct “state”; it is switching so fast you cannot see it. In essence, it says its in LOADING for a split second when the command is run, and messes itself up. We use what “state” it is currently in and what its target state is to determine how it should move itself to get there.
Here is the sequential command.
Here is theCLAAAWWW
and its getState()
method
Here is RobotContainer
where we call the button presses.
One specific example: if the SmartDashboard says it is in LOW (via the getState()
method) and we try to go to LOADING, it thinks it is already in LOADING (and print it out via PrintCommand()
) when it runs even though the dashboard says LOW.
Hopefully someone can find where we made a mistake
Bonus amazing picture of robot: