1516X High Stakes 2.0
Codebase for 1516X High Stakes season
Loading...
Searching...
No Matches
Robot::Autonomous Class Reference

The Autonomous class contains classes and functions related to the robot's autonomous behavior. More...

#include <auton.h>

Public Types

enum  AUTON_ROUTINE {
  RED_LEFT = 1 , RED_RIGHT = 2 , BLUE_LEFT = -1 , BLUE_RIGHT = -2 ,
  SKILLS = 0
}
 

Public Member Functions

void AutoDrive (Intake &intake, Latch &latch, DistanceSensor &distance)
 Drives the robot autonomously.
 

Static Public Member Functions

static void AutonSwitcher (int autonNum)
 Switches the autonomous program.
 

Static Public Attributes

static AUTON_ROUTINE auton = RED_LEFT
 Sets the number of the autonomous program to use.
 
static std::string autonName
 The name of the autonomous program.
 

Private Member Functions

void Auton1 (Intake &intake, Latch &latch, DistanceSensor &distance)
 Runs the autonomous path for the far side defensive game strategy.
 
void Auton2 (Intake &intake, Latch &latch, DistanceSensor &distance)
 Runs the autonomous path for the near side offensive game strategy.
 
void Auton3 (Intake &intake, Latch &latch, DistanceSensor &distance)
 Runs the puncher routine for the Skills Challenge.
 
void Auton4 (Intake &intake, Latch &latch, DistanceSensor &distance)
 Runs the autonomous path for the far side offensive game strategy. This function executes the autonomous path for the far side offensive game strategy. It contains the specific actions and movements required for this strategy.
 
void Auton5 (Intake &intake, Latch &latch, DistanceSensor &distance)
 

Detailed Description

The Autonomous class contains classes and functions related to the robot's autonomous behavior.

We use Lemlib extensively for our documentation. You can find the documentation for Lemlib at Lemlib documentation.

Definition at line 14 of file auton.h.

Member Enumeration Documentation

◆ AUTON_ROUTINE

Enumerator
RED_LEFT 
RED_RIGHT 
BLUE_LEFT 
BLUE_RIGHT 
SKILLS 

Definition at line 16 of file auton.h.

Member Function Documentation

◆ AutoDrive()

void Autonomous::AutoDrive ( Intake & intake,
Latch & latch,
DistanceSensor & distance )

Drives the robot autonomously.

This function drives the robot autonomously based on the selected autonomous program. It takes a reference to a Puncher object and a boolean value indicating whether to use autonomous mode.

Parameters
puncherA reference to the Puncher object.
autonoA boolean value indicating whether to use autonomous mode.

Definition at line 30 of file auton.cpp.

30 {
31 // Keep the switcher running while the controller down button has not been pressed and the time period is not
32 // autonomous Compare the current auton value to run the auton routine
33 switch (Autonomous::auton) {
34 case RED_LEFT:
35 Auton1(intake, latch, distance);
36 break;
37 case RED_RIGHT:
38 Auton2(intake, latch, distance);
39 break;
40 case BLUE_LEFT:
41 Auton3(intake, latch, distance);
42 break;
43 case BLUE_RIGHT:
44 Auton4(intake, latch, distance);
45 break;
46 case SKILLS:
47 Auton5(intake, latch, distance);
48 break;
49 }
50}
void Auton2(Intake &intake, Latch &latch, DistanceSensor &distance)
Runs the autonomous path for the near side offensive game strategy.
Definition auton.cpp:14
void Auton1(Intake &intake, Latch &latch, DistanceSensor &distance)
Runs the autonomous path for the far side defensive game strategy.
Definition auton.cpp:11
void Auton3(Intake &intake, Latch &latch, DistanceSensor &distance)
Runs the puncher routine for the Skills Challenge.
Definition auton.cpp:17
void Auton4(Intake &intake, Latch &latch, DistanceSensor &distance)
Runs the autonomous path for the far side offensive game strategy. This function executes the autonom...
Definition auton.cpp:23
static AUTON_ROUTINE auton
Sets the number of the autonomous program to use.
Definition auton.h:26
void Auton5(Intake &intake, Latch &latch, DistanceSensor &distance)
Definition auton.cpp:25

References auton, Auton1(), Auton2(), Auton3(), Auton4(), Auton5(), BLUE_LEFT, BLUE_RIGHT, RED_LEFT, RED_RIGHT, and SKILLS.

◆ Auton1()

void Autonomous::Auton1 ( Intake & intake,
Latch & latch,
DistanceSensor & distance )
private

Runs the autonomous path for the far side defensive game strategy.

This function executes the autonomous path for the far side defensive game strategy. It contains the specific actions and movements required for this strategy.

Definition at line 11 of file auton.cpp.

11{}

Referenced by AutoDrive().

◆ Auton2()

void Autonomous::Auton2 ( Intake & intake,
Latch & latch,
DistanceSensor & distance )
private

Runs the autonomous path for the near side offensive game strategy.

This function executes the autonomous path for the near side offensive game strategy. It contains the specific actions and movements required for this strategy.

Definition at line 14 of file auton.cpp.

14{}

Referenced by AutoDrive().

◆ Auton3()

void Autonomous::Auton3 ( Intake & intake,
Latch & latch,
DistanceSensor & distance )
private

Runs the puncher routine for the Skills Challenge.

This function executes the puncher routine for the Skills Challenge. It takes a reference to a Puncher object and performs the necessary actions for the challenge.

Parameters
puncherA reference to the Puncher object.

Definition at line 17 of file auton.cpp.

17{}

Referenced by AutoDrive().

◆ Auton4()

void Autonomous::Auton4 ( Intake & intake,
Latch & latch,
DistanceSensor & distance )
private

Runs the autonomous path for the far side offensive game strategy. This function executes the autonomous path for the far side offensive game strategy. It contains the specific actions and movements required for this strategy.

Todo
Make the autonomous more fleshed out, building it properly for the competition

Definition at line 23 of file auton.cpp.

23{}

Referenced by AutoDrive().

◆ Auton5()

void Autonomous::Auton5 ( Intake & intake,
Latch & latch,
DistanceSensor & distance )
private

Executes the Skills challenge autonomous.

This function controls the robot's actions during autonomous routine 5. It takes references to the Intake and Latch objects as parameters.

Parameters
intakeThe reference to the Intake object.
latchThe reference to the Latch object.

Definition at line 25 of file auton.cpp.

25 {
26 // Autonomous routine for the Skills challenge
27}

Referenced by AutoDrive().

◆ AutonSwitcher()

void Autonomous::AutonSwitcher ( int autonNum)
static

Switches the autonomous program.

This function switches the autonomous program to the next available program. It allows the user to cycle through different autonomous programs during runtime.

Definition at line 52 of file auton.cpp.

52 {
53 switch (autonNum) {
54 case 1:
55 Autonomous::autonName = "Red Left";
57 break;
58 case 2:
59 Autonomous::autonName = "Red Right";
61 break;
62 case -1:
63 Autonomous::autonName = "Blue Left";
65 break;
66 case -2:
67 Autonomous::autonName = "Blue Right";
69 break;
70 case 0:
71 Autonomous::autonName = "Skills";
73 }
74 std::cout << "Current auton: " + Autonomous::autonName << std::endl;
75}
static std::string autonName
The name of the autonomous program.
Definition auton.h:33

References auton, autonName, BLUE_LEFT, BLUE_RIGHT, RED_LEFT, RED_RIGHT, and SKILLS.

Member Data Documentation

◆ auton

Autonomous::AUTON_ROUTINE Autonomous::auton = RED_LEFT
static

Sets the number of the autonomous program to use.

This function allows the user to specify the autonomous program to be executed by the robot. The autonomous program number determines the specific actions and movements the robot will perform.

Parameters
autonThe number of the autonomous program to use.

Definition at line 26 of file auton.h.

Referenced by AutoDrive(), and AutonSwitcher().

◆ autonName

std::string Autonomous::autonName
static

The name of the autonomous program.

This variable stores the name of the autonomous program currently selected. It is handled by the switching functions and the screen.

Definition at line 33 of file auton.h.

Referenced by AutonSwitcher().


The documentation for this class was generated from the following files: