1516X Push Back 1.0
1516X's robot code for the 2025-2026 VEX Robotics Competition
Loading...
Searching...
No Matches
RCL.cpp
Go to the documentation of this file.
1// Copyright 2026 California High Robotics, Team 1516X
2// SPDX-License-Identifier: GPL-3.0-or-later
3
4#include "RCL.h"
5#include "distanceReset.h"
6#include "globals.h"
7
8RCL_Controller rcl;
9
10void RCL_Controller::start() {
11 if (running.exchange(true)) {
12 return;
13 }
14
15 task = std::make_unique<pros::Task>([this]() {
16 const double alpha = 0.1;
17
18 while (running) {
19 distancePose targetXY = distanceReset(false, true, 2, 10);
20
21 lemlib::Pose currentPose = chassis.getPose();
22
23 float newX = currentPose.x + alpha * (targetXY.x - currentPose.x);
24 float newY = currentPose.y + alpha * (targetXY.y - currentPose.y);
25
26 chassis.setPose({newX, newY, currentPose.theta});
27 pros::delay(50);
28 }
29 }, "RCL Task");
30}
31
32void RCL_Controller::end() {
33 if (running.exchange(false)) {
34 pros::delay(60);
35 }
36}
RCL_Controller rcl
Definition RCL.cpp:8
distancePose distanceReset(bool setPose=false, bool filter=true, float filter_range=3.5, float heading_tolerance=40.0)
Chassis chassis(drivebase, lateral_controller, angular_controller, sensors, &throttle_curve, &steer_curve)