[wpilib] Fix acceleration getter for DCMotorSim (#7449)

This commit is contained in:
Nicholas Armstrong
2024-11-30 01:15:00 -05:00
committed by GitHub
parent 0941251375
commit b91864a5ec
2 changed files with 2 additions and 2 deletions

View File

@@ -52,7 +52,7 @@ units::radians_per_second_t DCMotorSim::GetAngularVelocity() const {
units::radians_per_second_squared_t DCMotorSim::GetAngularAcceleration() const {
return units::radians_per_second_squared_t{
(m_plant.A() * m_x + m_plant.B() * m_u)(0, 0)};
(m_plant.A() * m_x + m_plant.B() * m_u)(1, 0)};
}
units::newton_meter_t DCMotorSim::GetTorque() const {

View File

@@ -184,7 +184,7 @@ public class DCMotorSim extends LinearSystemSim<N2, N1, N2> {
*/
public double getAngularAccelerationRadPerSecSq() {
var acceleration = (m_plant.getA().times(m_x)).plus(m_plant.getB().times(m_u));
return acceleration.get(0, 0);
return acceleration.get(1, 0);
}
/**