1516b Over Under 2.0
Codebase for 1516b over under season
Loading...
Searching...
No Matches
puncher.h
Go to the documentation of this file.
1#pragma once
2
3namespace Robot {
4
5 /**
6 * @brief Represents a Puncher mechanism for a robot.
7 *
8 * @details The Puncher class provides functionality to control a puncher mechanism on a robot.
9 * It allows running the puncher based on an autonomous value, setting the distancePuncher variable,
10 * toggling the distance sensor activation, and checking whether to shoot or not.
11 */
12 class Puncher {
13 public:
14 /**
15 * @brief Runs the puncher based on the given autonomous value.
16 *
17 * This function executes the puncher mechanism based on the provided autonomous value.
18 * It contains conditionals that determine the behavior of the puncher.
19 *
20 * @note Make sure to have the Puncher object initialized before calling this function.
21 *
22 * @param autonVal The autonomous value to determine the puncher behavior.
23 */
24 void run(int autonVal);
25
26 /**
27 * @brief Sets the distancePuncher variable based on the punch parameter.
28 *
29 * This function sets the distancePuncher variable based on the provided punch parameter.
30 * The distancePuncher variable determines the behavior of the puncher mechanism.
31 *
32 * @param punch The value to set the distancePuncher variable to.
33 */
34 void setDistancePuncher(bool punch);
35
36 /**
37 * @brief Toggles whether the distance sensor is activated or not and prints it out.
38 *
39 * This function toggles the distance sensor activation by flipping the value of the distancePuncher variable.
40 * It then prints out the current state of the distancePuncher variable.
41 */
42 void PuncherSwitch();
43
44 private:
45 /**
46 * @brief Checks if the distance sensor is connected and whether to shoot.
47 *
48 * This function checks if the distance sensor is connected and retrieves the distance from the triball.
49 * It uses the distance to determine whether to shoot or not.
50 *
51 * @return The value returned of whether to shoot or not.
52 */
53 int toShoot();
54
55 /**
56 * @brief Determines whether to use the distance sensor or not.
57 *
58 * The distancePuncher variable decides whether to use the distance sensor or not.
59 * If distancePuncher is true, the distance sensor is used. If it is false, the distance sensor is not used.
60 */
62 };
63}
The Autonomous class contains classes and functions related to the robot's autonomous behavior.
Definition auton.h:11
void AutoDrive(Puncher &puncher, bool autono)
Drives the robot autonomously.
Definition auton.cpp:60
void Auton1()
Runs the autonomous path for the far side defensive game strategy.
Definition auton.cpp:11
static int auton
Sets the number of the autonomous program to use.
Definition auton.h:22
void Auton2()
Runs the autonomous path for the near side offensive game strategy.
Definition auton.cpp:31
void AutonSwitcher()
Switches the autonomous program.
Definition auton.cpp:82
void Auton3(Puncher &puncher)
Runs the puncher routine for the Skills Challenge.
Definition auton.cpp:51
Represents a Puncher mechanism for a robot.
Definition puncher.h:12
bool distancePuncher
Determines whether to use the distance sensor or not.
Definition puncher.h:61
void setDistancePuncher(bool punch)
Sets the distancePuncher variable based on the punch parameter.
Definition puncher.cpp:10
void PuncherSwitch()
Toggles whether the distance sensor is activated or not and prints it out.
Definition puncher.cpp:55
int toShoot()
Checks if the distance sensor is connected and whether to shoot.
Definition puncher.cpp:40
void run(int autonVal)
Runs the puncher based on the given autonomous value.
Definition puncher.cpp:15
The Wings class represents the wings of a robot.
Definition wings.h:11
void setState(bool wingState)
Sets the state of the wings.
Definition wings.cpp:23
void run()
Runs the wings.
Definition wings.cpp:7
bool getState()
Gets the current state of the wings.
Definition wings.cpp:27
bool state
Definition wings.h:42
Contains global variables and type definitions for the Robot namespace.
Definition globals.cpp:18
pros::Controller controller
lemlib::ChassisController_t angularController
Definition globals.cpp:73
pros::Motor LeftMid
pros::Motor IntakeMotor
pros::Distance distance
pros::Motor_Group drive_
pros::Imu inertial_sensor
pros::Motor RightBack
pros::ADIDigitalOut wing2
pros::Motor_Group drive_right
pros::Motor_Group drive_left
pros::Motor RightFront
pros::ADIDigitalOut wing
pros::ADIDigitalOut pto_2
pros::ADIDigitalOut pto_1
pros::Motor RightMid
lemlib::OdomSensors_t sensors
Definition globals.cpp:52
pros::Motor LeftFront
pros::Motor PuncherMotor2
lemlib::ChassisController_t lateralController
Definition globals.cpp:62
Robot::Wings robotWings
lemlib::Chassis chassis
pros::Motor PuncherMotor
lemlib::Drivetrain_t drivetrain
Definition globals.cpp:44
pros::Motor_Group punchers
pros::Motor LeftBack
Contains all objects generated by the 1516B team - Contains all of the subsystems,...
Definition globals.cpp:17