diff --git a/.vscode/c_cpp_properties.json b/.vscode/c_cpp_properties.json index 892ae72..49f9182 100644 --- a/.vscode/c_cpp_properties.json +++ b/.vscode/c_cpp_properties.json @@ -1,7 +1,7 @@ { "env": { - "vex_compilerPath": "${config:vexrobotics.vexcode.Cpp.Toolchain.Path}\\clang\\bin\\clang", - "vex_sdkPath": "${config:vexrobotics.vexcode.Cpp.Sdk.Home}\\V5\\V5_20240802_15_00_00\\vexv5", + "vex_compilerPath": "${config:vexrobotics.vexcode.Cpp.Toolchain.Path}/clang/bin", + "vex_sdkPath": "${config:vexrobotics.vexcode.Cpp.Sdk.Home}/V5/V5_20240802_15_00_00/vexv5", "vex_gcc": "${vex_sdkPath}/gcc/include/c++/4.9.3", "vex_sdkIncludes": [ "${vex_sdkPath}/clang/8.0.0/include/**", diff --git a/.vscode/settings.json b/.vscode/settings.json index e314c62..84aae75 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,6 +1,6 @@ { "C_Cpp.default.systemIncludePath": [ - "${config:vexrobotics.vexcode.Cpp.Sdk.Home}\\V5\\V5_20240802_15_00_00\\vexv5\\gcc\\include\\sys" + "${config:vexrobotics.vexcode.Cpp.Sdk.Home}/V5/V5_20240802_15_00_00/vexv5/gcc/include/sys" ], "makefile.configureOnOpen": true, "C_Cpp.errorSquiggles": "disabled" diff --git a/.vscode/vex_project_settings.json b/.vscode/vex_project_settings.json index 70db017..a440d90 100644 --- a/.vscode/vex_project_settings.json +++ b/.vscode/vex_project_settings.json @@ -9,7 +9,7 @@ "creationDate": "Wed, 20 Nov 2024 02:36:10 GMT", "platform": "V5", "language": "cpp", - "slot": 8, + "slot": 1, "sdkVersion": "V5_20240802_15_00_00", "cpp": { "includePath": [], diff --git a/include/robot-config.h b/include/robot-config.h index 2076aff..e7922d2 100644 --- a/include/robot-config.h +++ b/include/robot-config.h @@ -51,8 +51,8 @@ extern PID::pid_config_t drive_correction_pid; extern robot_specs_t robot_cfg; -// extern OdometryNWheel<3> odom; -extern OdometryTank odom; +extern OdometryNWheel<3> odom; +// extern OdometryTank odom; extern TankDrive drive_sys; /** diff --git a/src/competition/autonomous.cpp b/src/competition/autonomous.cpp index 544cc80..2d1b370 100644 --- a/src/competition/autonomous.cpp +++ b/src/competition/autonomous.cpp @@ -104,7 +104,7 @@ class DebugCommand : public AutoCommand { void skills() { CommandController cc { - odom.SetPositionCmd({.x = 12, .y = 96, .rot = 0}), + odom.SetPositionCmd({.x = 9, .y = 96, .rot = 0}), new Async(new FunctionCommand([]() { while(true) { @@ -140,18 +140,18 @@ void skills() { drive_sys.DriveToPointCmd({24, 120}, vex::forward, .8) -> withTimeout(1), // Fifth Ring - drive_sys.TurnToPointCmd(0, 144, vex::directionType::fwd, .6) -> withTimeout(1), - drive_sys.DriveToPointCmd({6, 138}, vex::forward, .8) -> withTimeout(1), + drive_sys.TurnToPointCmd(4, 144, vex::directionType::fwd, .6) -> withTimeout(1), + drive_sys.DriveToPointCmd({6, 137}, vex::forward, .8) -> withTimeout(1), // Deposit First Stake - drive_sys.DriveForwardCmd(8, vex::directionType::rev, .6) -> withTimeout(.7), + drive_sys.DriveForwardCmd(18, vex::directionType::rev, .6) -> withTimeout(.7), // drive_sys.TurnToPointCmd(96, 120, vex::directionType::fwd, .6) -> withTimeout(3), drive_sys.TurnToHeadingCmd(-45, .6) -> withTimeout(.5), conveyor_stop_command(), //drop goal/move away goal_grabber_command(false), - drive_sys.DriveForwardCmd(4, vex::directionType::rev, .8) -> withTimeout(.3), + drive_sys.DriveForwardCmd(7, vex::directionType::rev, .8) -> withTimeout(.3), drive_sys.DriveToPointCmd({24, 120}, vex::forward, .8) -> withTimeout(.6), @@ -161,7 +161,7 @@ void skills() { //grab second goal drive_sys.TurnToHeadingCmd(90, .6) -> withTimeout(1), - drive_sys.DriveForwardCmd(24,vex::directionType::rev,.6)-> withTimeout(1), + drive_sys.DriveToPointCmd({96, 96},vex::directionType::rev,.6)-> withTimeout(1), goal_grabber_command(true), conveyor_intake_command()->withCancelCondition(new ConveyorStalled), diff --git a/src/competition/opcontrol.cpp b/src/competition/opcontrol.cpp index b61c10c..3b0776c 100644 --- a/src/competition/opcontrol.cpp +++ b/src/competition/opcontrol.cpp @@ -16,7 +16,8 @@ void testing(); */ void opcontrol() { - autonomous(); + // autonomous(); + testing(); // ================ INIT ================ while (imu.isCalibrating()) { vexDelay(1); @@ -116,8 +117,8 @@ void testing() { // drive_sys.DriveForwardCmd(24.0, vex::fwd, 0.6)->withTimeout(12), // new DelayCommand(500), // }, new TimesTestedCondition(4)), - drive_sys.DriveForwardCmd(48.0, vex::fwd, 0.8)->withTimeout(3), - drive_sys.TurnToHeadingCmd(90.0, 0.7)->withTimeout(3), + // drive_sys.DriveForwardCmd(48.0, vex::fwd, 0.8)->withTimeout(3), + // drive_sys.TurnToHeadingCmd(90.0, 0.7)->withTimeout(3), // drive_sys.DriveForwardCmd(96.0, vex::fwd, 0.8)->withTimeout(3), // drive_sys.TurnToHeadingCmd(180.0, 0.7)->withTimeout(3), // drive_sys.DriveForwardCmd(96.0, vex::fwd, 0.8)->withTimeout(3), diff --git a/src/robot-config.cpp b/src/robot-config.cpp index a82438b..91cfbf7 100644 --- a/src/robot-config.cpp +++ b/src/robot-config.cpp @@ -12,9 +12,9 @@ CustomEncoder left_enc{Brain.ThreeWirePort.C, 2048}; CustomEncoder right_enc{Brain.ThreeWirePort.E, 2048}; CustomEncoder front_enc{Brain.ThreeWirePort.G, 2048}; -tracking_wheel_cfg_t left_enc_cfg{-0.0625, 3.625, M_PI, 0.9}; -tracking_wheel_cfg_t right_enc_cfg{-0.0625, -3.625, 0, 0.9}; -tracking_wheel_cfg_t front_enc_cfg{4.5, -0.375, (M_PI/2), 0.9}; +tracking_wheel_cfg_t left_enc_cfg{-0.0625, 3.625, M_PI, 1.0625}; +tracking_wheel_cfg_t right_enc_cfg{-0.0625, -3.625, 0, 1.0625}; +tracking_wheel_cfg_t front_enc_cfg{4.5, -0.375, (M_PI/2), 1.0625}; // ================ OUTPUTS ================ // Motors @@ -86,7 +86,7 @@ PID::pid_config_t turn_pid_cfg{ .i = 0.005, .d = 0.001, //.deadband = 1.5, - .deadband = 3, + .deadband = 2, .on_target_time = 0.1, }; @@ -98,7 +98,7 @@ robot_specs_t robot_cfg{ .robot_radius = 12.0, .odom_wheel_diam = 2.125, .odom_gear_ratio = 1.0, - .dist_between_wheels = 11.0, + .dist_between_wheels = 12.5, // .drive_correction_cutoff = 0, .drive_feedback = &drive_pid, @@ -106,8 +106,8 @@ robot_specs_t robot_cfg{ .correction_pid = drive_correction_pid, }; -// OdometryNWheel<3> odom({left_enc, right_enc, front_enc}, {left_enc_cfg, right_enc_cfg, front_enc_cfg}, &imu, true); -OdometryTank odom(left_enc, right_enc, robot_cfg, &imu); +OdometryNWheel<3> odom({left_enc, right_enc, front_enc}, {left_enc_cfg, right_enc_cfg, front_enc_cfg}, &imu, true); +// OdometryTank odom(left_enc, right_enc, robot_cfg, &imu); TankDrive drive_sys(left_motors, right_motors, robot_cfg, &odom); /**