Skip to content
This repository has been archived by the owner on May 16, 2024. It is now read-only.

Commit

Permalink
Added stabilizer solenoid & logic
Browse files Browse the repository at this point in the history
  • Loading branch information
superrm11 committed Apr 7, 2024
1 parent 1a771dc commit bdbd87b
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .vscode/vex_project_settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"creationDate": "Sun, 10 Mar 2024 19:16:09 GMT",
"platform": "V5",
"language": "cpp",
"slot": 7,
"slot": 8,
"sdkVersion": "V5_20240223_11_00_00",
"cpp": {
"includePath": [],
Expand Down
1 change: 1 addition & 0 deletions include/cata/cata.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#pragma once
#include "../core/include/utils/controls/pidff.h"
#include "cata/common.h"
#include "vex.h"
Expand Down
5 changes: 3 additions & 2 deletions include/robot-config.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,11 @@ extern OdometryTank odom;
extern TankDrive drive_sys;

extern CataSys cata_sys;
extern digital_out left_wing;
extern digital_out right_wing;
extern pneumatics left_wing;
extern pneumatics right_wing;

extern digital_out vision_light;
extern pneumatics stabilizer_sol;
extern pneumatics l_endgame_sol;
extern pneumatics r_endgame_sol;
extern pneumatics cata_sol;
Expand Down
3 changes: 3 additions & 0 deletions src/cata/cata.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include "cata/cata.h"
#include "robot-config.h"

bool intake_can_be_enabled(double cata_pos) {
return (cata_pos == 0.0) || (cata_pos > inake_enable_lower_threshold && cata_pos < intake_enable_upper_threshold);
Expand Down Expand Up @@ -119,6 +120,7 @@ class PrimeClimb : public CataOnlySys::State {
void entry(CataOnlySys &sys) override {
sys.cata_sol.open();
sys.mot.stop(vex::coast);
stabilizer_sol.open();
};

CataOnlySys::MaybeMessage work(CataOnlySys &sys) override {
Expand Down Expand Up @@ -149,6 +151,7 @@ class ClimbHold : public CataOnlySys::State {
sys.l_endgame_sol.open();
sys.r_endgame_sol.open();
sys.cata_sol.close();
stabilizer_sol.close();
};

CataOnlySys::MaybeMessage work(CataOnlySys &sys) override {
Expand Down
4 changes: 2 additions & 2 deletions src/competition/opcontrol.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -195,8 +195,8 @@ void testing() {
// if (!disable_drive)
// drive_sys.drive_tank(f, s, 1, TankDrive::BrakeType::None);
if (!disable_drive)
drive_tank_autoaim(TankDrive::BrakeType::None);
// drive_sys.drive_tank(l, r, 1, TankDrive::BrakeType::None);
// drive_tank_autoaim(TankDrive::BrakeType::None);
drive_sys.drive_tank(l, r, 1, TankDrive::BrakeType::None);

// ================ Drive Tuning =================
static bool done_a = false;
Expand Down
16 changes: 8 additions & 8 deletions src/robot-config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,17 +36,16 @@ motor intake_roller(PORT9, gearSetting::ratio18_1, false);
motor cata_r(PORT2, gearSetting::ratio36_1, true);
motor cata_l(PORT10, gearSetting::ratio36_1, false);

vex::digital_out left_wing(Brain.ThreeWirePort.B); // Check if swapped
vex::digital_out right_wing(Brain.ThreeWirePort.F);
// ================ Three-Wire Ports ==============
vex::pneumatics left_wing(Brain.ThreeWirePort.A);
vex::pneumatics right_wing(Brain.ThreeWirePort.F);

// endgame_sol output 1 to CLIMB pistons
// endgame_sol output 2 to cata_sol (single acting)
// cata_sol output 1 to catapult assist pistons
vex::pneumatics stabilizer_sol(Brain.ThreeWirePort.C);
vex::pneumatics l_endgame_sol(Brain.ThreeWirePort.G);
vex::pneumatics r_endgame_sol(Brain.ThreeWirePort.A);
vex::pneumatics cata_sol(Brain.ThreeWirePort.D);
vex::pneumatics r_endgame_sol(Brain.ThreeWirePort.D);
vex::pneumatics cata_sol(Brain.ThreeWirePort.B);

vex::digital_out vision_light(Brain.ThreeWirePort.C);
vex::digital_out vision_light(Brain.ThreeWirePort.E);

#else
// NEMO CONFIG
Expand Down Expand Up @@ -224,6 +223,7 @@ void robot_init() {
l_endgame_sol.set(false);
r_endgame_sol.set(false);
cata_sol.set(false);
stabilizer_sol.close();

gps_sensor.calibrate();
}

0 comments on commit bdbd87b

Please sign in to comment.