piston testing fr

read the title
This commit is contained in:
ary 2023-09-29 07:48:02 -04:00
parent 575f79648a
commit 1cbae5ced1
5 changed files with 28 additions and 0 deletions

View File

@ -9,6 +9,8 @@
#define DRIVE_RATIO 0.75
#define DRIVE_RPM 450
bool ptoEnabled;
namespace globals {
extern pros::Controller master;
@ -30,6 +32,8 @@ namespace globals {
extern pros::Rotation rot_horiz;
extern pros::Rotation enc_theta;
extern pros::ADIAnalogOut pto_piston;
extern lemlib::TrackingWheel vert_tracking_wheel;
extern lemlib::TrackingWheel horiz_tracking_wheel;

View File

@ -20,5 +20,9 @@ namespace superstruct {
void turnChassis(double theta, double turnSpeedScale);
void leftSwing(double theta, double swingSpeedScale);
void rightSwing(double theta, double swingSpeedScale);
//- Structure methods
void togglePto();
bool getPtoState();
}

View File

@ -22,6 +22,7 @@ namespace globals {
pros::Rotation rot_horiz(1);
// pros::Rotation enc_right();
// pros::Rotation enc_theta();
pros::ADIAnalogOut pto_piston(1);
lemlib::Drivetrain_t chassis_odom {
&left_drive,

View File

@ -1,8 +1,10 @@
#include "main.h"
#include "lemlib/api.hpp"
#include "globals.hpp"
#include "superstructure.hpp"
using namespace globals;
using namespace superstruct;
/**
* A callback function for LLEMU's center button.
@ -87,6 +89,10 @@ void opcontrol() {
motor_tlb.move_voltage(0);
motor_trb.move_voltage(0);
}
if (globals::master.get_digital_new_press(DIGITAL_LEFT)) {
togglePto();
}
pros::delay(20);
}

View File

@ -2,6 +2,8 @@
using namespace ary;
using namespace globals;
bool ptoEnabled = false;
namespace superstruct {
void configureExitConditions() {
chassis.set_exit_condition(chassis.turn_exit, 100, 3, 500, 7, 500, 500);
@ -52,4 +54,15 @@ namespace superstruct {
//chassis.set_mode(SWING);
chassis.set_swing(RIGHT_SWING, theta, SWING_SPEED * swingSpeedScale);
}
// Structure methods
void togglePto() {
int state = (ptoEnabled) ? 1 : 0;
pto_piston.set_value(state);
}
// bool getPtoState() {
// return (pto_piston.get_value() == 1) ? true : false;
// }
}