-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Outline implementation of DrivetrainSubsystem
- Loading branch information
1 parent
7f0a094
commit cd68f92
Showing
24 changed files
with
258 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#include "frc846/robot/swerve/drivetrain.h" | ||
|
||
namespace frc846::robot::swerve { | ||
|
||
DrivetrainSubsystem::DrivetrainSubsystem(DrivetrainConfigs configs, bool enable) | ||
: GenericSubsystem{"SwerveDrivetrain"}, configs_{configs}, modules_{} { | ||
// TODO: finish | ||
} | ||
|
||
void DrivetrainSubsystem::Setup() { | ||
// TODO: finish | ||
} | ||
|
||
DrivetrainTarget DrivetrainSubsystem::ZeroTarget() const { | ||
return DrivetrainOLControlTarget{{0_fps, 0_fps}}; | ||
} | ||
|
||
bool DrivetrainSubsystem::VerifyHardware() { | ||
bool ok = true; | ||
// TODO: finish | ||
return ok; | ||
} | ||
|
||
DrivetrainReadings DrivetrainSubsystem::ReadFromHardware() { | ||
DrivetrainReadings readings; | ||
// TODO: finish | ||
return readings; | ||
} | ||
|
||
void DrivetrainSubsystem::WriteToHardware(DrivetrainTarget target) { | ||
// TODO: finish | ||
} | ||
|
||
} // namespace frc846::robot::swerve |
30 changes: 30 additions & 0 deletions
30
src/frc846/cpp/frc846/robot/swerve/odometry/swerve_pose.cc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#include "frc846/robot/swerve/odometry/swerve_pose.h" | ||
|
||
namespace frc846::robot::swerve::odometry { | ||
|
||
SwervePose SwervePose::rotate(units::degree_t angle) const { | ||
return SwervePose{ | ||
position.rotate(angle), bearing + angle, velocity.rotate(angle)}; | ||
} | ||
|
||
SwervePose SwervePose::translate(frc846::math::Vector2D translation) const { | ||
return SwervePose{position + translation, bearing, velocity}; | ||
} | ||
|
||
SwervePose SwervePose::extrapolate(units::second_t time) const { | ||
return SwervePose{ | ||
position + frc846::math::Vector2D{velocity[0] * time, velocity[1] * time}, | ||
bearing, velocity}; | ||
} | ||
|
||
SwervePose SwervePose::operator+(const SwervePose& other) const { | ||
return SwervePose{position + other.position, bearing + other.bearing, | ||
velocity + other.velocity}; | ||
} | ||
|
||
SwervePose SwervePose::operator-(const SwervePose& other) const { | ||
return SwervePose{position - other.position, bearing - other.bearing, | ||
velocity - other.velocity}; | ||
} | ||
|
||
} // namespace frc846::robot::swerve::odometry |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
#pragma once | ||
|
||
#include <units/angular_velocity.h> | ||
|
||
#include <cassert> | ||
|
||
namespace frc846::control::config { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.