Skip to content

Commit

Permalink
add a simple scheduling example
Browse files Browse the repository at this point in the history
  • Loading branch information
spacey-sooty committed Mar 2, 2024
1 parent 4eb9aa2 commit 4f4866b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 18 deletions.
20 changes: 4 additions & 16 deletions src/main/cpp/Robot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

#include "behaviour/HasBehaviour.h"
#include "networktables/NetworkTableInstance.h"

#include "drivetrain/behaviours/SwerveBehaviours.h"

static units::second_t lastPeriodic;

Expand Down Expand Up @@ -53,7 +53,7 @@ void Robot::RobotInit() {
// simulation_timer = frc::Timer();

// robotmap.swerveBase.gyro->Reset();


_swerveDrive = new wom::SwerveDrive(robotmap.swerveBase.config, frc::Pose2d());
wom::BehaviourScheduler::GetInstance()->Register(_swerveDrive);
Expand Down Expand Up @@ -154,20 +154,8 @@ void Robot::TeleopInit() {
wom::BehaviourScheduler* sched = wom::BehaviourScheduler::GetInstance();
sched->InterruptAll();

// frontLeft->SetVoltage(4_V);
// frontRight->SetVoltage(4_V);
// backLeft->SetVoltage(4_V);
// backRight->SetVoltage(4_V);


// FMAP("fmap.fmap");

// _swerveDrive->OnStart();
// sched->InterruptAll();

//reimplement when vision is reimplemented

// _swerveDrive->SetPose(_vision->GetAngleToObject(VisionTargetObjects::kNote).first);
robotmap.controllers.triggerDriver->XButton()->SetTrueBehaviour(
wom::make<wom::DrivebasePoseBehaviour>(_swerveDrive, frc::Pose2d(1_m, 0_m, frc::Rotation2d(0_rad))));
}

void Robot::TeleopPeriodic() {}
Expand Down
8 changes: 6 additions & 2 deletions src/main/include/RobotMap.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,19 @@
#include "Wombat.h"
#include "AlphaArm.h"
#include "AlphaArmBehaviour.h"
#include "behaviour/TriggerXboxController.h"
#include "utils/Encoder.h"
#include "utils/PID.h"

struct RobotMap {
struct Controllers {
frc::XboxController driver = frc::XboxController(0);
frc::XboxController codriver = frc::XboxController(1);
frc::XboxController testController = frc::XboxController(2);
wom::TriggerXboxController* triggerDriver = new wom::TriggerXboxController(0);
};
Controllers controllers;

struct AlphaArmSystem {
rev::CANSparkMax alphaArmMotorUp{21, rev::CANSparkMax::MotorType::kBrushless};
rev::CANSparkMax alphaArmMotorDown{26, rev::CANSparkMax::MotorType::kBrushless};
Expand All @@ -58,7 +62,7 @@ struct RobotMap {
AlphaArmSystem alphaArmSystem;



struct SwerveBase {
ctre::phoenix6::hardware::CANcoder frontLeftCancoder{16, "Drivebase"};
ctre::phoenix6::hardware::CANcoder frontRightCancoder{18, "Drivebase"};
Expand Down

0 comments on commit 4f4866b

Please sign in to comment.