Team2556 / Charged-Up

Team 2556's repository for the 2023 FRC challenge Charged Up
Other
1 stars 1 forks source link

Programming Practice with Santana #1

Open NawaPlayz opened 1 year ago

NawaPlayz commented 1 year ago

Program Santana with driver controls

The project for this year will be using the Command Based WPILib design. This programming style may seem weird and difficult to understand, but it allows for much better organization and readability.

Mecanum Driving

Since driving is an absolutely vital part to the robot in both the autonomous and driver operated periods, it is the first priority when prototyping. A mecanum drivetrain allows the robot to move straight, turn, and strafe. The wheels consists of a series of small, independently rotating wheels mounted on a common hub. The wheels are angled so that when they are all spinning in the same direction, the robot will move in a straight line. However, by varying the speed or direction of the individual wheels, the robot can move in any direction. This example requires that you map the driving to the left and right joysticks of a controller. So when forward is pressed on the left stick, the robot moves forward, when the stick is pushed left the robot strafes left, and when the right stick is moved to the right, the robot turns, with the opposite direction having the opposite movement. Code for this can be found on the Command Base WPILib section and on this drive train article

Butterfly

Butterfly drive is simply using pneumatics to adjust the middle set of wheels in Santana. This is achieved by creating an air compressor object WPILib Documentation, then using a flag set by the controller, such as an onButtonReleased event, to make the solenoids extend/retract.

Intake

The intake also uses pneumatics to extend/retract, and when extended requires the intake motor to spin. Once a ball has been intaked, it must travel into the robot and gets pushed by the translation motor in the center of the bot, until it reaches the limit switch. The controls for this should be the triggers, both will extend the intake but spin the motor in opposite directions. When no trigger is pressed the intake should retract.

Shooter

The shooter should use a PID controller to rev up & maintain its speed after shooting a ball. Once the shoot button is pressed, it should verify it has reached a reasonable shooting velocity then start spinning the translation motor to shoot the ball.

Hood

Elevator

Autonomous Driving