[wpilib] Fix DiffDriveSim pose reset and example (#2837)

Calling the resetPosition method on an odometry instance expects encoder positions to be reset to zero.
This commit is contained in:
Prateek Machiraju
2020-11-12 01:37:14 -05:00
committed by GitHub
parent 5c2dc043cd
commit 616405f7ae
4 changed files with 8 additions and 0 deletions

View File

@@ -98,6 +98,8 @@ void DifferentialDrivetrainSim::SetPose(const frc::Pose2d& pose) {
m_x(State::kX) = pose.X().to<double>();
m_x(State::kY) = pose.Y().to<double>();
m_x(State::kHeading) = pose.Rotation().Radians().to<double>();
m_x(State::kLeftPosition) = 0;
m_x(State::kRightPosition) = 0;
}
Eigen::Matrix<double, 7, 1> DifferentialDrivetrainSim::Dynamics(