Hey Mycroft devs and users,
I have a small raspi project I’m working on and I am trying to get mycroft to be able to drive my motors once I tell it to.
So, I setup a skill with the following code:
from mycroft import MycroftSkill, intent_file_handler
#from gpiozero import DigitalInputDevice, DigitalOutputDevice, Robot, Motor
#from time import sleep, perf_counter
from .jarvismotors import MotorSystem
self.r = MotorSystem((6, 5, 12), 4, 17, (19, 26, 13), 27, 22, 25)
@intent_file_handler('forward.intent') def handle_forward(self, message): self.speak_dialog('forward') self.r.forward() sleep(2) r.stop() def stop(self): pass
I have a separate file I cannot share with the code I wrote for my motors. There, I have calculators that calculate the RPM of the motors and automatically adjust them using threading.
I have noticed that threading behaves in odd ways whenever I ask mycroft to drive the motors.
Sometimes mycroft drives the motors for 2 seconds, sometimes the thread does not finish execution even though the moment r.stop() is called, the thread is terminated (from .jarvismotors script).
It seems to me I do not fully understand making skills in Mycroft. If anyone can help I would really appreciate it