1516b Over Under 2.0
Codebase for 1516b over under season
Loading...
Searching...
No Matches
globals.cpp
Go to the documentation of this file.
1#include "globals.h"
2#include "api.h"
3#include "robot/auton.h"
4#include "robot/drivetrain.h"
5#include "robot/wings.h"
6
7
8
9/*
10* Although the following constants belong in their own seperate files(auton.cpp, drivetriain.cpp), they are put here in order to maintain
11* a common location for all of the constants used by the program to belong in.
12* NOTE: This is the location where these variables are put into memory, but they can be otherwise modified throughout the program.
13*/
14
15// Defines the objects that are used by the program for each of the individual subsystems.
16
17namespace Robot {
18 namespace Globals {
19
20pros::Controller controller (pros::E_CONTROLLER_MASTER);
21pros::Motor RightFront (6, pros::E_MOTOR_GEARSET_18, false, pros::E_MOTOR_ENCODER_DEGREES);
22pros::Motor LeftFront (-5, pros:: E_MOTOR_GEARSET_18, false, pros::E_MOTOR_ENCODER_DEGREES);
23pros::Motor LeftBack (-7, pros::E_MOTOR_GEARSET_18, false, pros::E_MOTOR_ENCODER_DEGREES);
24pros::Motor RightBack (8, pros::E_MOTOR_GEARSET_18, false, pros::E_MOTOR_ENCODER_DEGREES);
25pros::Motor LeftMid (-2, pros::E_MOTOR_GEARSET_18, false, pros::E_MOTOR_ENCODER_DEGREES);
26pros::Motor PuncherMotor (-19, pros::E_MOTOR_GEARSET_18, false, pros::E_MOTOR_ENCODER_DEGREES);
27pros::Motor PuncherMotor2 (20, pros::E_MOTOR_GEARSET_18, false, pros::E_MOTOR_ENCODER_DEGREES);
28pros::Motor RightMid (3, pros::E_MOTOR_GEARSET_18, false, pros::E_MOTOR_ENCODER_DEGREES);
29pros::Motor IntakeMotor (-9, pros::E_MOTOR_GEARSET_18, false, pros::E_MOTOR_ENCODER_DEGREES);
30pros::Imu inertial_sensor(15);
31pros::Distance distance(18);
32pros::ADIDigitalOut wing ('A');
33pros::ADIDigitalOut wing2 ('D');
34pros::ADIDigitalOut pto_1 ('B');
35pros::ADIDigitalOut pto_2 ('C');
36
37pros::Motor_Group punchers ({PuncherMotor, PuncherMotor2});
38pros::Motor_Group drive_left ({LeftFront, LeftMid, LeftBack});
39pros::Motor_Group drive_right ({RightFront, RightMid, RightBack});
41
42
43// Describes the lemlib objects that are used to control the autonomous functions of the robot.
44lemlib::Drivetrain_t drivetrain {
45 &drive_left, // left drivetrain motors
46 &drive_right, // right drivetrain motors
47 11.75, // track width
48 3.25, // wheel diameter - 3.25 on competition bot, 4 on test drivetrain
49 360 // wheel rpm - 360 rpm for competition bot, 200 for test drivetrain
50};
51
52lemlib::OdomSensors_t sensors {
53 nullptr, // vertical tracking wheel 1
54 nullptr, // vertical tracking wheel 2
55 nullptr, // horizontal tracking wheel 1
56 nullptr, // we don't have a second tracking wheel, so we set it to nullptr
57 &inertial_sensor // inertial sensor
58};
59
60
61// forward/backward PID
62lemlib::ChassisController_t lateralController {
63 8, // kP
64 30, // kD
65 1, // smallErrorRange
66 100, // smallErrorTimeout
67 3, // largeErrorRange
68 500, // largeErrorTimeout
69 5 // slew rate
70};
71
72// turning PID
73lemlib::ChassisController_t angularController {
74 4, // kP
75 40, // kD
76 1, // smallErrorRange
77 100, // smallErrorTimeout
78 3, // largeErrorRange
79 500, // largeErrorTimeout
80 0 // slew rate
81};
82
84
85 }
86}
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
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