1516X Push Back
1.0
1516X's robot code for the 2025-2026 VEX Robotics Competition
Loading...
Searching...
No Matches
main.cpp
Go to the documentation of this file.
1
#include "main.h"
2
#include "command/commandController.h"
3
#include "command/commandScheduler.h"
4
#include "
robot/globals.h
"
// Assuming 'chassis' is declared in here
5
#include "
robot/intake.h
"
// Your intake subsystem
6
#include "units/units.hpp"
7
8
using namespace
units;
9
10
// Global Objects
11
CommandController
primary
(pros::E_CONTROLLER_MASTER);
12
Intake
*
intake
;
13
14
// Command scheduler loop
15
[[noreturn]]
void
update_loop
() {
16
while
(
true
) {
17
auto
start_time = pros::millis();
18
CommandScheduler::run();
19
pros::c::task_delay_until(&start_time, 10);
20
}
21
}
22
23
void
initialize
() {
24
chassis
.calibrate();
// calibrate sensors
25
pros::Task commandSchedulerTask(
update_loop
);
26
intake
=
new
Intake
(pros::Motor(20));
27
CommandScheduler::registerSubsystem(
intake
,
intake
->pctCommand(0.0));
28
primary
.getTrigger(DIGITAL_L1)->whileTrue(
intake
->pctCommand(-1.0));
29
primary
.getTrigger(DIGITAL_L2)->whileTrue(
intake
->pctCommand(1.0));
30
primary
.getTrigger(DIGITAL_A)->whileTrue(
intake
->pctCommand(-1.0)
31
->withTimeout(300_ms)
32
->andThen(
intake
->pctCommand(1.0)->withTimeout(300_ms))
33
->repeatedly());
34
}
35
36
void
disabled
() {}
37
38
void
competition_initialize
() {}
39
40
void
autonomous
() {
41
// Your autonomous code will go here
42
}
43
44
void
opcontrol
() {}
Intake
Definition
intake.h:11
globals.h
chassis
lemlib::Chassis chassis
intake.h
initialize
void initialize()
Definition
main.cpp:23
autonomous
void autonomous()
Definition
main.cpp:40
disabled
void disabled()
Definition
main.cpp:36
primary
CommandController primary(pros::E_CONTROLLER_MASTER)
competition_initialize
void competition_initialize()
Definition
main.cpp:38
intake
Intake * intake
Definition
main.cpp:12
update_loop
void update_loop()
Definition
main.cpp:15
opcontrol
void opcontrol()
Definition
main.cpp:44
src
main.cpp
Generated on Fri Jul 25 2025 16:33:17 for 1516X Push Back by
1.13.2