wpilibsuite / frc-docs

Official FRC Documentation powered by Read the Docs
https://docs.wpilib.org
Other
145 stars 260 forks source link

Document how to add kS to simulation #1775

Open virtuald opened 2 years ago

virtuald commented 2 years ago

The section on sysid details kS, kV, and kA... but the differential drive simulator only deals with kV and kA and completely ignores kS. I found that the behavior in simulation was close, but still noticably different from Real Life until I accounted for kS.

The dumb-simple way I integrated kS (linear only) was with the following:

kS = self.kS_linear
if l_voltage > kS:
    l_voltage -= kS
elif l_voltage < -kS:
    l_voltage += kS
else:
    l_voltage = 0

if r_voltage > kS:
    r_voltage -= kS
elif r_voltage < -kS:
    r_voltage += kS
else:
    r_voltage = 0

Once I added that.. the robot movement was much closer to what I expected. I suspect it's not quite right though.

It's possible that one result of this documentation request might end up as an addition to the simulation classes in addition to the documentation.

calcmogul commented 2 years ago

I haven't done anything rigorous yet like I did for the drivetrain K_v/K_a sysid model, but the threshold is probably some kind of weighted average between K_s,linear if V_l = V_r and K_s,angular if V_l = -V_r.