Team138Entropy / Entropy2022

FIRST Robotics Team Entropy 138's code for the 2022 season
Other
3 stars 0 forks source link

Basic Autonomous Paths #19

Open joecaraccio opened 2 years ago

joecaraccio commented 2 years ago

We now know the game and can begin building Autonomous Modes!

In our codebase:

An autonomous mode is one or more autonomous actions

Our Modes are defined here: https://github.com/Team138Entropy/Entropy2022/tree/main/src/main/java/frc/robot/auto/modes

So far we only have 3 Modes. The base class (which shouldn't be edited), the DoNothing Mode (which I hope we never use) and the TestDriveMode.

We need to make many more modes. For example:

Each Drive Action should only drive one path. Together we will put together each path as we need and then run them all sequentially.

Here is an example of several drive segments together:

public class DriveToBall extends AutoModeBase {

    List<DriveTrajectoryAction > driveActionList = new ArrayList<DriveTrajectoryAction >();  

    public DriveToBall (){
      // add multiple actions to drive trajectorys, these will run one after another
      driveActionList.add(new DriveTrajectoryAction(TrajectoryLibrary.getInstance().getBasicTrajectory());
      driveActionList.add(new DriveTrajectoryAction(TrajectoryLibrary.getInstance().getBasicTrajectory());
      driveActionList.add(new DriveTrajectoryAction(TrajectoryLibrary.getInstance().getBasicTrajectory()); 
   }

    @Override
    protected void routine() throws AutoModeEndedException {
      // Traverse list and run each action
      for(DriveTrajectoryAction currentAction:  driveActionList )  {
        runAction(currentAction);
     }
    }
}