You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I think this is also sort of a hardware issue, but maybe one can solve it with software:
If I draw the joystick fast forward/backward my raspberry pi zero w crashes and reboots.
If I'm driving forward, then stop and afterwards drive backward there is no problem.
So my idea is to implement a little delay (several milliseconds) when changing the direction.
Where would be the place to implement this?
The text was updated successfully, but these errors were encountered:
def set_speed(self, speed):
msg = "set_speed({}, {})".format(self.motor_id, speed)
logger.debug(msg)
if speed == self._last_speed or speed is None:
return
if ((speed > 0) and (self._last_speed < 0)) or ((speed < 0) and (self._last_speed > 0)):
msg = "change direction ************************"
logger.debug(msg)
speed = 0
sleep(0.1)
pz.stop()
sleep(0.3)
self._last_speed = speed
return
self._last_speed = speed
logger.info(msg)
# TODO: scale -100..100 to -128..127
speed = constrain(speed, -128, 127)
pz.setMotor(self.motor_id, speed)
At this moment it's a quick an dirty implementation but I think it sort of works. I have to optimize the sleep timings a bit, but I have to charge my battery first.
I think this is also sort of a hardware issue, but maybe one can solve it with software:
If I draw the joystick fast forward/backward my raspberry pi zero w crashes and reboots.
If I'm driving forward, then stop and afterwards drive backward there is no problem.
So my idea is to implement a little delay (several milliseconds) when changing the direction.
Where would be the place to implement this?
The text was updated successfully, but these errors were encountered: