1516b Over Under 2.0
Codebase for 1516b over under season
Loading...
Searching...
No Matches
Robot::Utility Namespace Reference

Contains utility functions for controlling the screen and toggling subsystems. More...

Functions

void displayLocation ()
 Displays current position of the robot.
 
void displayMotorVel ()
 Displays current velocity of the robot.
 
void toggleSubsystemOptions (Autonomous &auton, Drivetrain &drive, Puncher &punch)
 Toggles subsystems, drive mode auton routine, and puncher.
 

Detailed Description

Contains utility functions for controlling the screen and toggling subsystems.

Test
The Utility namespace is a group of unrelated methods that have functions that are important independently.

Function Documentation

◆ displayLocation()

void Robot::Utility::displayLocation ( )

Displays current position of the robot.

Definition at line 42 of file utility.cpp.

42 {
43 while (true) {
44 lemlib::Pose pose = chassis.getPose(); // get the current position of the robot
45 pros::lcd::print(0, "x: %f", pose.x); // print the x position
46 pros::lcd::print(1, "y: %f", pose.y); // pri∟nt the y position
47 pros::lcd::print(2, "heading: %f", pose.theta); // print the heading
48 pros::delay(10);
49 }
50}
lemlib::Chassis chassis

References Robot::Globals::chassis.

Referenced by initialize().

◆ displayMotorVel()

void Robot::Utility::displayMotorVel ( )

Displays current velocity of the robot.

Definition at line 28 of file utility.cpp.

28 {
29 while (true) {
30 // std::vector<std::int32_t> currents = drive_.get_current_draws();// get the current position of the robot
31 pros::lcd::print(0, "Motor velocity draw");
32 pros::lcd::print(1, "motor 1 vel: %lf", LeftFront.get_actual_velocity());
33 pros::lcd::print(2, "motor 2 vel: %lf", RightFront.get_actual_velocity());
34 pros::lcd::print(3, "motor 3 vel: %lf", LeftMid.get_actual_velocity());
35 pros::lcd::print(4, "motor 4 vel: %lf", RightMid.get_actual_velocity());
36 pros::lcd::print(5, "motor 5 vel: %lf", LeftBack.get_actual_velocity());
37 pros::lcd::print(6, "motor 6 vel: %lf", RightBack.get_actual_velocity()); // print the x position// print the heading
38 pros::delay(10);
39 }
40}
pros::Motor LeftMid
pros::Motor RightBack
pros::Motor RightFront
pros::Motor RightMid
pros::Motor LeftFront
pros::Motor LeftBack

References Robot::Globals::LeftBack, Robot::Globals::LeftFront, Robot::Globals::LeftMid, Robot::Globals::RightBack, Robot::Globals::RightFront, and Robot::Globals::RightMid.

Referenced by initialize().

◆ toggleSubsystemOptions()

void Robot::Utility::toggleSubsystemOptions ( Autonomous & auton,
Drivetrain & drive,
Puncher & punch )

Toggles subsystems, drive mode auton routine, and puncher.

Parameters
Autonomousauton Auton object.
Drivetraindrive Drivetrain object.
Puncherpunch Puncher object.
Todo
Figure out a way to send an event to the different objects to toggle between the different subsystems.

Definition at line 10 of file utility.cpp.

10 {
11 // Allows the user to select the autonomous routine, drive control type as well as whether the distance puncher is enabled.
12 // The user can select the auton routine by pressing the right buttons on the controller.
13 // The user can select the drive control type by pressing the down button on the controller.
14 // The user can select the distance puncher by pressing the left button on the controller.
15 // The state of each subsystem is displayed on the controller screen.
16 while (true)
17 {
18 auton.AutonSwitcher();
19 drive.SwitchDrive();
20 punch.PuncherSwitch();
21
22 // Exits the loop if the up button is pressed
23
24 pros::delay(10);
25 }
26}
void AutonSwitcher()
Switches the autonomous program.
Definition auton.cpp:82
void SwitchDrive()
Switches the DriveTrain mode between arcade and tank drive.
void PuncherSwitch()
Toggles whether the distance sensor is activated or not and prints it out.
Definition puncher.cpp:55

References Robot::Autonomous::AutonSwitcher(), Robot::Puncher::PuncherSwitch(), and Robot::Drivetrain::SwitchDrive().

Referenced by toggles().