I am getting some unexpected behavior with my motors not running to their destinations using wave_chains. It's an odd symptom. The motors are woken up and the code shows print messages as expected, but the motors act like their step pins aren't set high.
When I run the motors with PWM, the limit switches work as expected and home the motors
Here is my setup:
1. Callbacks are setup for each of the four limit switches. If closed, set a "global" halt flag and run a homing method for each.
2. Callbacks are setup for each of the four motors. The callbacks are used to count steps for each.
3. A check in the gotoPreset method that cancels the wave_chain if the halt flag is true
Code: Select all
...wave chain creation and send...
while self.pi.wave_tx_busy():
if (self.haltAll == 1):
self.pi.wave_tx_stop()
else:
time.sleep(0.1)
If I remove the limit switch callback, the motors run to their destinations as expected.
If I add back the limit switch callback and comment the self.pi.wave_tx_stop() in the while loop above, the motors run to their destinations as expected.
One complication that may play a role is that when running to a preset destination with wave_chains, all four motors may be running at once, whereas when using the PWM method, only one motor is running at a time.
Thanks for any suggestions