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

Commit

Permalink
get committed loser
Browse files Browse the repository at this point in the history
  • Loading branch information
cowsed committed Mar 8, 2024
1 parent b425a78 commit 869d044
Show file tree
Hide file tree
Showing 3 changed files with 104 additions and 6 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": "10/5/2023, 8:40:34 PM",
"platform": "V5",
"language": "cpp",
"slot": 1,
"slot": 2,
"sdkVersion": "V5_20220726_10_00_00",
"cpp": {
"includePath": [],
Expand Down
102 changes: 100 additions & 2 deletions src/competition/autonomous.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#include "robot-config.h"

void just_auto();
void elim_auto();
void jideways_skills();
void autonomous() {
while (imu.isCalibrating()) {
Expand Down Expand Up @@ -198,8 +199,7 @@ void just_auto() {

// across half court
drive_sys.DriveToPointCmd({108, 7},vex::fwd, 0.75),
// drive_sys.TurnToHeadingCmd(29, 0.5),
// drive_sys.DriveForwardCmd(-2, vex::fwd),

drive_sys.TurnToPointCmd(122.5,16.52,vex::fwd, 0.5),
drive_sys.DriveToPointCmd({122.5, 16.52},vex::fwd, 0.5),

Expand Down Expand Up @@ -229,6 +229,104 @@ void just_auto() {
drive_sys.DriveForwardCmd(8.0, vex::fwd, 0.25)->withTimeout(4.0),
new DelayCommand(500),
intake_cmd(0),
// new DebugCommand(),
};
cc.run();
// clang-format on
}
void elim_auto() {
// clang-format off
CommandController cc{
odom.SetPositionCmd({.x = 40, .y = 7, .rot = 90}),
drive_sys.DriveToPointCmd({40, 35}, vex::fwd, 0.75),
// // pick up first
// drive_sys.TurnToPointCmd(59.5, 51.7, vex::fwd, 0.75),
// intake_cmd(),
// drive_sys.DriveToPointCmd({58.5, 51.7}, vex::fwd, 0.5),
// drive_sys.DriveToPointCmd({38.5, 35.5}, vex::reverse, 0.75),
// stop_intake(),
// drive_sys.TurnToPointCmd(37.9, 19.5, vex::fwd, 0.65),
// drive_sys.DriveToPointCmd({37.9, 19.5}, vex::fwd, 0.75),

// // Drop First
// drive_sys.TurnToHeadingCmd(340, 0.5),
// outtake_cmd(),
// new DelayCommand(600),
// stop_intake(),
// drive_sys.TurnToHeadingCmd(-90, 0.5),
// drive_sys.DriveToPointCmd({39.7, 34.5}, vex::reverse, 0.5),

// pick up second
drive_sys.TurnToPointCmd(47.2, 54.7, vex::fwd, 0.65),
intake_cmd(12.0),
drive_sys.DriveToPointCmd({47.63, 54.5}, vex::fwd, 0.5),
drive_sys.DriveToPointCmd({37.7, 34.5}, vex::reverse, 0.75),
stop_intake(),
drive_sys.TurnToPointCmd(37.5, 20.0, vex::fwd, 0.65),
drive_sys.DriveToPointCmd({37.5, 20.0}, vex::fwd, 0.75),

// Drop Second
drive_sys.TurnToHeadingCmd(340, 0.65),
outtake_cmd(),
new DelayCommand(600),
stop_intake(),


// get close to wall
drive_sys.TurnToHeadingCmd(240, 0.65),
drive_sys.DriveToPointCmd({33.5,12.5}, vex::fwd,0.25),

// turn and back up to bar
drive_sys.TurnToPointCmd(22.0,16.0, vex::reverse,0.65),
drive_sys.DriveToPointCmd({22,16.0},vex::reverse,0.15),
new RepeatUntil({
toggle_wing_r(), // out
new DelayCommand(400),
toggle_wing_r(), // in
new DelayCommand(800),
}, (new IfTimePassed(35))->Or(new TimesTestedCondition(10))),

// pushing
outtake_cmd(),
drive_sys.DriveToPointCmd({37, 8.5},vex::fwd,0.5),
drive_sys.TurnToHeadingCmd(-10, 0.5),

// stop things circa half court
new Async(new FunctionCommand([](){
if (odom.get_position().x > 69){
left_wing.set(true);
outtake(0);
return true;
}
return false;
})),

// across half court
drive_sys.DriveToPointCmd({108, 7},vex::fwd, 0.75),

drive_sys.TurnToPointCmd(122.5,16.52,vex::fwd, 0.5),
drive_sys.DriveToPointCmd({122.5, 16.52},vex::fwd, 0.5),

toggle_wing_l(),
drive_sys.TurnDegreesCmd(-180)->withTimeout(0.35), // start spinning the right way

drive_sys.TurnToPointCmd(132.5,36.2, vex::reverse, 0.5),
drive_sys.DriveForwardCmd(25, vex::reverse, 1.0)->withTimeout(1.0),
drive_sys.DriveForwardCmd(25, vex::fwd, 1.0)->withTimeout(1.0),

drive_sys.TurnToHeadingCmd(247, 0.65),
drive_sys.DriveForwardCmd(30, vex::reverse, 1.0)->withTimeout(1.0),
drive_sys.DriveForwardCmd(20, vex::fwd, 1.0)->withTimeout(1.0),

drive_sys.TurnToHeadingCmd(227, 0.65),
drive_sys.DriveForwardCmd(24, vex::reverse, 1.0)->withTimeout(1.0),
drive_sys.DriveForwardCmd(34, vex::fwd, 1.0)->withTimeout(1.0),

new RepeatUntil(InOrder{
drive_sys.DriveForwardCmd(24, vex::reverse, 1.0)->withTimeout(1.0),
drive_sys.DriveForwardCmd(24, vex::fwd, 1.0)->withTimeout(1.0),
}, new FunctionCondition([](){return false;})),

// new DebugCommand(),
};
cc.run();
Expand Down
6 changes: 3 additions & 3 deletions src/competition/opcontrol.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const vex::controller::button &climb_wing_button = con.ButtonUp;

const double fold_out_time = 0.25;
void opcontrol() {
autonomous();

// odom.set_position({.x = 40, .y = 12, .rot = 90});
while (imu.isCalibrating()) {
vexDelay(1);
Expand Down Expand Up @@ -78,8 +78,8 @@ void opcontrol() {
// drive
if (do_drive) {
if (tank) {
double left = (double)con.Axis3.position() / 100.0;
double right = (double)con.Axis2.position() / 100.0;
double left = (double)con.Axis4.position() / 100.0;
double right = (double)con.Axis3.position() / 100.0;
drive_sys.drive_tank(left, right, 1, brake_type);
} else {
double forward = (double)con.Axis3.position() / 100.0;
Expand Down

0 comments on commit 869d044

Please sign in to comment.