fix timer logic and everything inbetween
This commit is contained in:
parent
50460a1e30
commit
0147b49ceb
@ -12,4 +12,3 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
#include "ary-lib/drive/drive.hpp"
|
||||
#include "ary-lib/autonselector.hpp"
|
||||
#include "ary-lib/util.hpp"
|
||||
#include "ary-lib/Timer.h"
|
||||
@ -1,6 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "ary-lib/drive/drive.hpp"
|
||||
#include "main.h"
|
||||
|
||||
void near_side();
|
||||
void far_side();
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
|
||||
#include "main.h"
|
||||
#include "Wings.h"
|
||||
#include "Timer.h"
|
||||
|
||||
#define TRACK_WIDTH 11.5
|
||||
#define PLACEHOLDER_TC_OFFSET 2.5
|
||||
@ -44,9 +45,10 @@ namespace globals {
|
||||
|
||||
extern pros::ADIDigitalOut intake_piston;
|
||||
|
||||
extern pros::ADIDigitalOut doinker_piston;
|
||||
extern pros::ADIDigitalOut climb_piston;
|
||||
|
||||
extern Wings wings;
|
||||
extern Timer timer;
|
||||
|
||||
extern lemlib::TrackingWheel vert_tracking_wheel;
|
||||
extern lemlib::TrackingWheel horiz_tracking_wheel;
|
||||
|
||||
@ -46,6 +46,7 @@
|
||||
#include "superstructure.hpp"
|
||||
#include "autons.hpp"
|
||||
#include "wings.h"
|
||||
#include "Timer.h"
|
||||
|
||||
#include "asset.h"
|
||||
#include "gif-pros/gifclass.hpp"
|
||||
|
||||
@ -11,6 +11,7 @@
|
||||
#define RENU_LEFT_WING_CONTROL DIGITAL_LEFT
|
||||
#define RENU_RIGHT_WING_CONTROL DIGITAL_RIGHT
|
||||
#define RENU_WING_CONTROL DIGITAL_L2
|
||||
#define RENU_CLIMB_CONTROL DIGITAL_A
|
||||
|
||||
// Ria's control preferences
|
||||
#define RIA_PTO_TOGGLE DIGITAL_LEFT
|
||||
@ -50,13 +51,14 @@ namespace superstruct {
|
||||
|
||||
//- Structure methods
|
||||
void intakeControl(pros::controller_digital_e_t intakeButton);
|
||||
void togglePto();
|
||||
void togglePto(bool toggle);
|
||||
void runCata(double inpt);
|
||||
void runAntiBlock(double inpt);
|
||||
void subsysControl(pros::controller_digital_e_t ptoToggleButton, pros::controller_digital_e_t cataRunButton);
|
||||
void wingsControl();
|
||||
void wingsControlSingle(pros::controller_digital_e_t wingControlButton);
|
||||
void wingsControlComplex(pros::controller_analog_e_t leftWingButton, pros::controller_analog_e_t rightWingButton, pros::controller_analog_e_t wingButton);
|
||||
void climbControl(pros::controller_digital_e_t climbButton);
|
||||
|
||||
//More methods
|
||||
void toggleIntake(bool val);
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
#include "ary-lib/Timer.h"
|
||||
#include "main.h"
|
||||
#include "Timer.h"
|
||||
|
||||
Timer::Timer() {
|
||||
start = pros::millis();
|
||||
@ -101,4 +101,14 @@ void skills() {
|
||||
turnSync(-60);
|
||||
driveSync(10, true);
|
||||
wings.open();
|
||||
|
||||
togglePto(true);
|
||||
timer.reset();
|
||||
while (timer.getElapsedTimeMS() < 30000) {
|
||||
runCata(-12000);
|
||||
}
|
||||
runCata(0);
|
||||
togglePto(false);
|
||||
|
||||
wings.close();
|
||||
}
|
||||
@ -37,9 +37,10 @@ namespace globals {
|
||||
|
||||
pros::ADIDigitalOut intake_piston('D');
|
||||
|
||||
//pros::ADIDigitalOut doinker_piston('E');
|
||||
pros::ADIDigitalOut climb_piston('B');
|
||||
|
||||
Wings wings;
|
||||
Timer timer;
|
||||
|
||||
pros::Imu inertial_sensor(18);
|
||||
|
||||
|
||||
@ -221,13 +221,26 @@ namespace superstruct {
|
||||
|
||||
if (globals::master.get_digital(DIGITAL_UP)) {
|
||||
runAntiBlock(-12000);
|
||||
} else if (globals::master.get_digital(DIGITAL_UP)) {
|
||||
} else if (globals::master.get_digital(DIGITAL_LEFT)) {
|
||||
runAntiBlock(12000);
|
||||
} else {
|
||||
runAntiBlock(0);
|
||||
}
|
||||
}
|
||||
|
||||
int climb_state = 0;
|
||||
void climbControl(pros::controller_digital_e_t climbButton) {
|
||||
if (globals::master.get_digital_new_press(climbButton)) {
|
||||
if (climb_state == 0) {
|
||||
climb_piston.set_value(1);
|
||||
climb_state = 1;
|
||||
} else if (climb_state == 1) {
|
||||
climb_piston.set_value(0);
|
||||
climb_state = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void wingsControlSingle(pros::controller_digital_e_t wingControlButton) {
|
||||
if (globals::master.get_digital_new_press(wingControlButton)) {
|
||||
if (wings.getState() == 0) // A value of 0 indicates that both wings are closed
|
||||
@ -255,6 +268,7 @@ namespace superstruct {
|
||||
subsysControl(RENU_PTO_TOGGLE, RENU_CATA_CONTROL);
|
||||
wingsControlSingle(RENU_WING_CONTROL);
|
||||
intakeControl(RENU_INTAKE_CONTROL);
|
||||
climbControl(RENU_CLIMB_CONTROL);
|
||||
}
|
||||
|
||||
void ria_control() {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user