Commit b097411
committed
fix: the rewritten coefficient still had an overflow, in the product
Attacking the previous commit rather than trusting it. Writing the filter
coefficient as `1 / (1 + tau * rate)` removed the overflow in `1 / rate`, and
left one in `tau * rate`: the product goes infinite where neither factor does,
`1 / inf` is 0, and an actuator whose coefficient is 0 never moves. Measured,
tau=1e200 at 1e200 Hz holds its initial 0.5 against a command of 0.25 for the
whole flight. That is the same silent freeze the demand-rate check further up
exists to prevent, so it raises now.
The bound is nowhere near anything real. A 0.01 s time constant at 100 Hz gives
0.5, and 10 s at 1000 Hz gives 1e-4. A small coefficient is what a slow actuator
is; only zero is broken, and only overflow reaches it.
Also restructure the ordering check in the range validator. It was written as
`not lower <= upper` to reject a pair of NaNs, which every ordered comparison
lets through. That reads as a double negative and pylint refuses it as C0117,
which is what turned the Linters job red. Naming NaN first and then comparing
says the same thing in the order a reader expects. Taking pylint's own
suggestion verbatim would have been a bug: `lower > upper` is false for two
NaNs.
The linter gate is the exit code, which is a bitmask, and not the score. The
score stays at 10.00/10 with a convention message present, which is how this got
pushed red. The three I0021 useless-suppression notes in motor.py, sensor.py and
stochastic_rocket.py are information messages, set no bit, and are left alone.
Signed-off-by: thc1006 <84045975+thc1006@users.noreply.github.com>1 parent 4ecd10f commit b097411
2 files changed
Lines changed: 60 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
79 | 79 | | |
80 | 80 | | |
81 | 81 | | |
82 | | - | |
83 | | - | |
84 | | - | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
85 | 89 | | |
86 | 90 | | |
87 | 91 | | |
| |||
210 | 214 | | |
211 | 215 | | |
212 | 216 | | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
213 | 230 | | |
214 | 231 | | |
215 | 232 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
872 | 872 | | |
873 | 873 | | |
874 | 874 | | |
| 875 | + | |
| 876 | + | |
| 877 | + | |
| 878 | + | |
| 879 | + | |
| 880 | + | |
| 881 | + | |
| 882 | + | |
| 883 | + | |
| 884 | + | |
| 885 | + | |
| 886 | + | |
| 887 | + | |
| 888 | + | |
| 889 | + | |
| 890 | + | |
| 891 | + | |
| 892 | + | |
| 893 | + | |
| 894 | + | |
| 895 | + | |
| 896 | + | |
| 897 | + | |
| 898 | + | |
| 899 | + | |
| 900 | + | |
| 901 | + | |
| 902 | + | |
| 903 | + | |
| 904 | + | |
| 905 | + | |
| 906 | + | |
| 907 | + | |
| 908 | + | |
| 909 | + | |
| 910 | + | |
| 911 | + | |
| 912 | + | |
| 913 | + | |
| 914 | + | |
0 commit comments