mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-20 00:51:42 +00:00
[wpilib] Add set functions to differential drive simulation (#2746)
All the other simulation objects already have functions like this through LinearSystemSim.
This commit is contained in:
@@ -89,6 +89,17 @@ units::ampere_t DifferentialDrivetrainSim::GetCurrentDraw() const {
|
||||
return loadIleft + loadIRight;
|
||||
}
|
||||
|
||||
void DifferentialDrivetrainSim::SetState(
|
||||
const Eigen::Matrix<double, 7, 1>& state) {
|
||||
m_x = state;
|
||||
}
|
||||
|
||||
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>();
|
||||
}
|
||||
|
||||
Eigen::Matrix<double, 7, 1> DifferentialDrivetrainSim::Dynamics(
|
||||
const Eigen::Matrix<double, 7, 1>& x,
|
||||
const Eigen::Matrix<double, 2, 1>& u) {
|
||||
|
||||
Reference in New Issue
Block a user