1516b Over Under 2.0
Codebase for 1516b over under season
Loading...
Searching...
No Matches
utility.cpp
Go to the documentation of this file.
1#include "robot/utility.h"
2#include "api.h"
3#include "globals.h"
4
5using namespace Robot;
6using namespace Robot::Globals;
7/**
8 * \todo Figure out a way to send an event to the different objects to toggle between the different subsystems.
9*/
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 {
19 drive.SwitchDrive();
21
22 // Exits the loop if the up button is pressed
23
24 pros::delay(10);
25 }
26}
27
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}
41
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}
The Autonomous class contains classes and functions related to the robot's autonomous behavior.
Definition auton.h:11
void AutonSwitcher()
Switches the autonomous program.
Definition auton.cpp:82
Represents the drivetrain of the robot.
Definition drivetrain.h:23
void SwitchDrive()
Switches the DriveTrain mode between arcade and tank drive.
Represents a Puncher mechanism for a robot.
Definition puncher.h:12
void PuncherSwitch()
Toggles whether the distance sensor is activated or not and prints it out.
Definition puncher.cpp:55
Contains global variables and type definitions for the Robot namespace.
Definition globals.cpp:18
pros::Motor LeftMid
pros::Motor RightBack
pros::Motor RightFront
pros::Motor RightMid
pros::Motor LeftFront
lemlib::Chassis chassis
pros::Motor LeftBack
Contains utility functions for controlling the screen and toggling subsystems.
Definition utility.h:13
void displayLocation()
Displays current position of the robot.
Definition utility.cpp:42
void toggleSubsystemOptions(Autonomous &auton, Drivetrain &drive, Puncher &punch)
Toggles subsystems, drive mode auton routine, and puncher.
Definition utility.cpp:10
void displayMotorVel()
Displays current velocity of the robot.
Definition utility.cpp:28
Contains all objects generated by the 1516B team - Contains all of the subsystems,...
Definition globals.cpp:17