Skip to content

Commit

Permalink
Merge pull request #301 from tinymovr/studio/flux_braking_tests
Browse files Browse the repository at this point in the history
also compare without flux braking and negative velocity
  • Loading branch information
yconst authored Oct 4, 2023
2 parents 1fd00b4 + 189daae commit b30b800
Showing 1 changed file with 22 additions and 11 deletions.
33 changes: 22 additions & 11 deletions studio/Python/tests/test_board.py
Original file line number Diff line number Diff line change
Expand Up @@ -367,19 +367,30 @@ def test_p_flux_braking(self):
# Ensure we're idle
self.check_state(0)
self.try_calibrate()

self.tm.controller.current.max_Ibrake = 10
self.tm.controller.current.max_Ibrake = 0
self.tm.controller.velocity_mode()
self.tm.controller.velocity.setpoint = 200000
time.sleep(0.4)
self.tm.controller.velocity.setpoint = 0
I_brake_vals = []
for _ in range(50):
I_brake_vals.append(self.tm.Ibus)
time.sleep(0.005)
time.sleep(0.5)
for v_set in [-250000, 250000]:
self.tm.controller.velocity.setpoint = v_set
time.sleep(0.4)
self.tm.controller.velocity.setpoint = 0
I_brake_vals = []
for _ in range(200):
I_brake_vals.append(self.tm.Ibus)
time.sleep(0.001)
time.sleep(0.2)
self.assertLess(min(I_brake_vals), -0.12 * A)
self.tm.controller.current.max_Ibrake = 10
for v_set in [-250000, 250000]:
self.tm.controller.velocity.setpoint = v_set
time.sleep(0.4)
self.tm.controller.velocity.setpoint = 0
I_brake_vals = []
for _ in range(200):
I_brake_vals.append(self.tm.Ibus)
time.sleep(0.001)
time.sleep(0.2)
self.assertGreater(min(I_brake_vals), -0.12 * A)
self.tm.controller.current.max_Ibrake = 0
self.assertGreater(min(I_brake_vals), -1 * A)
self.tm.controller.idle()
time.sleep(0.4)

Expand Down

0 comments on commit b30b800

Please sign in to comment.