mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-21 01:01:43 +00:00
[wpimath] Fix ElevatorSim::GetCurrentDraw() in C++ (#8370)
The Kv calculation in C++ was missing a negative sign compared to the Java implementation.
This commit is contained in:
@@ -88,7 +88,7 @@ units::ampere_t ElevatorSim::GetCurrentDraw() const {
|
||||
double kA = 1.0 / m_plant.B(1, 0);
|
||||
using Kv_t = units::unit_t<units::compound_unit<
|
||||
units::volt, units::inverse<units::meters_per_second>>>;
|
||||
Kv_t Kv = Kv_t{kA * m_plant.A(1, 1)};
|
||||
Kv_t Kv = Kv_t{-kA * m_plant.A(1, 1)};
|
||||
units::meters_per_second_t velocity{m_x(1)};
|
||||
units::radians_per_second_t motorVelocity = velocity * Kv * m_gearbox.Kv;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user