Team5830 / 2022-Rapid-React

Team 5830's robot code for FIRST Rapid React (2022)
MIT License
0 stars 0 forks source link

Add Flywheel subsystem #8

Closed asteele11 closed 2 years ago

asteele11 commented 2 years ago

Description

The Shooter will include a flywheel powered with two SparkMax motors. When controlled over CANbus there is a built in encoder and a PID controllor that can be used to set the speed. This is an example of how this was previously done.

https://github.com/Team5830/Infinite-Recharge-Robot/blob/pidmod/src/main/java/frc/robot/subsystems/Shooter.java

With any PID controller there are tuning parameters that must be set. Adjusting these values can take a lot of time so instead of always loading these values from the Constants the previous code loaded them from the SmartDashboard. This allowed them to be adjusted "live" without having to recompile and reload the code. This did work as it is written but it might be better to only load the values when the command is scheduled.

asteele11 commented 2 years ago

Merged this but I'm thinking we should move the SmartDashboardCmd from the Robot.java, putting it in there means we have to create the subsystems in Robot.java and then they are recreated in RobotContainer.java. We could create a command group to run the SmartDashboardCmd in parallel with the drive command. Another option is to push to the SmartDashboard in the periodic() methods of the subsystems.