mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-19 00:41:43 +00:00
SCRIPT: wpiformat
This commit is contained in:
committed by
Peter Johnson
parent
ae6bdc9d25
commit
2109161534
@@ -6,7 +6,8 @@
|
||||
|
||||
#include <wpi/system/RobotController.hpp>
|
||||
|
||||
void Drivetrain::SetSpeeds(const wpi::math::DifferentialDriveWheelSpeeds& speeds) {
|
||||
void Drivetrain::SetSpeeds(
|
||||
const wpi::math::DifferentialDriveWheelSpeeds& speeds) {
|
||||
auto leftFeedforward = m_feedforward.Calculate(speeds.left);
|
||||
auto rightFeedforward = m_feedforward.Calculate(speeds.right);
|
||||
double leftOutput = m_leftPIDController.Calculate(m_leftEncoder.GetRate(),
|
||||
@@ -31,9 +32,9 @@ void Drivetrain::UpdateOdometry() {
|
||||
|
||||
void Drivetrain::ResetOdometry(const wpi::math::Pose2d& pose) {
|
||||
m_drivetrainSimulator.SetPose(pose);
|
||||
m_odometry.ResetPosition(m_imu.GetRotation2d(),
|
||||
wpi::units::meter_t{m_leftEncoder.GetDistance()},
|
||||
wpi::units::meter_t{m_rightEncoder.GetDistance()}, pose);
|
||||
m_odometry.ResetPosition(
|
||||
m_imu.GetRotation2d(), wpi::units::meter_t{m_leftEncoder.GetDistance()},
|
||||
wpi::units::meter_t{m_rightEncoder.GetDistance()}, pose);
|
||||
}
|
||||
|
||||
void Drivetrain::SimulationPeriodic() {
|
||||
|
||||
@@ -15,7 +15,8 @@ class Robot : public wpi::TimedRobot {
|
||||
public:
|
||||
Robot() {
|
||||
m_trajectory = wpi::math::TrajectoryGenerator::GenerateTrajectory(
|
||||
wpi::math::Pose2d{2_m, 2_m, 0_rad}, {}, wpi::math::Pose2d{6_m, 4_m, 0_rad},
|
||||
wpi::math::Pose2d{2_m, 2_m, 0_rad}, {},
|
||||
wpi::math::Pose2d{6_m, 4_m, 0_rad},
|
||||
wpi::math::TrajectoryConfig(2_mps, 2_mps_sq));
|
||||
}
|
||||
|
||||
|
||||
@@ -96,7 +96,8 @@ class Drivetrain {
|
||||
|
||||
// Gains are for example purposes only - must be determined for your own
|
||||
// robot!
|
||||
wpi::math::SimpleMotorFeedforward<wpi::units::meters> m_feedforward{1_V, 3_V / 1_mps};
|
||||
wpi::math::SimpleMotorFeedforward<wpi::units::meters> m_feedforward{
|
||||
1_V, 3_V / 1_mps};
|
||||
|
||||
// Simulation classes help us simulate our robot
|
||||
wpi::sim::EncoderSim m_leftEncoderSim{m_leftEncoder};
|
||||
|
||||
Reference in New Issue
Block a user