Skip to content
Snippets Groups Projects

Various changes in Python code

Merged Samuel Tardieu requested to merge push-tmxwmklnoosx into main
3 files
+ 15
8
Compare changes
  • Side-by-side
  • Inline
Files
3
@@ -35,9 +35,13 @@ def check_firmware():
assert c.get_encoder_ticks() == (0, 0)
print("- Check that PID coefficients can be set and read")
c.set_pid_coefficients(0, 0, 0)
assert c.get_pid_coefficients() == (0, 0, 0)
assert c.get_pid_coefficients() == ((0, 0), (0, 0), (0, 0))
c.set_pid_coefficients(0.25, 0.125, -0.0625)
assert c.get_pid_coefficients() == (0.25, 0.125, -0.0625)
assert c.get_pid_coefficients() == (
(0.25, 0.25),
(0.125, 0.125),
(-0.0625, -0.0625),
)
print("- Check that the shutdown timeout triggers in controlled mode")
c.set_motor_shutdown_timeout(0.2)
c.set_pid_coefficients(4, 0, 0)
@@ -71,11 +75,11 @@ def check_firmware():
(left, right) = c.get_encoder_ticks()
assert left > 0 and right < 0
print("- Check that the I error accumulator is reset in non-controlled mode")
assert c.get_pid_i_accumulator() == (0, 0)
assert c.get_pid_i_accumulators() == (0, 0)
print("- Check that a positive I stays behind the target")
c.set_motor_speed(30, 30)
time.sleep(0.5)
(left, right) = c.get_pid_i_accumulator()
(left, right) = c.get_pid_i_accumulators()
assert left > 0 and right > 0
time.sleep(1)
Loading