mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-19 00:41:43 +00:00
[wpilib] Move Field2d to SmartDashboard
This commit is contained in:
@@ -12,6 +12,7 @@
|
||||
#include <frc/geometry/Rotation2d.h>
|
||||
#include <frc/kinematics/DifferentialDriveWheelSpeeds.h>
|
||||
#include <frc/simulation/SimDeviceSim.h>
|
||||
#include <frc/smartdashboard/SmartDashboard.h>
|
||||
|
||||
using namespace DriveConstants;
|
||||
|
||||
@@ -53,6 +54,7 @@ void DriveSubsystem::SimulationPeriodic() {
|
||||
-m_drivetrainSimulator.GetHeading().Degrees().to<double>());
|
||||
|
||||
m_fieldSim.SetRobotPose(m_odometry.GetPose());
|
||||
frc::SmartDashboard::PutData("Field", &m_fieldSim);
|
||||
}
|
||||
|
||||
units::ampere_t DriveSubsystem::GetCurrentDraw() const {
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
#include <frc/simulation/AnalogGyroSim.h>
|
||||
#include <frc/simulation/DifferentialDrivetrainSim.h>
|
||||
#include <frc/simulation/EncoderSim.h>
|
||||
#include <frc/simulation/Field2d.h>
|
||||
#include <frc/smartdashboard/Field2d.h>
|
||||
#include <frc2/command/SubsystemBase.h>
|
||||
#include <units/voltage.h>
|
||||
|
||||
@@ -169,7 +169,6 @@ class DriveSubsystem : public frc2::SubsystemBase {
|
||||
frc::sim::EncoderSim m_rightEncoderSim{m_rightEncoder};
|
||||
frc::sim::AnalogGyroSim m_gyroAngleSim{m_gyro};
|
||||
|
||||
// The Field2d class simulates the field in the sim GUI. Note that we can have
|
||||
// only one instance!
|
||||
// The Field2d class shows the field in the sim GUI.
|
||||
frc::Field2d m_fieldSim;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user