I do some research in Robotic using several machine learning algorithm.
I am using Raspi 3 with native camera module. I stack the Raspi with L298N Motor Driver. They are using separate power supply.
The Motor driver are using 4 pin to control the direction of the left and right servo.
I create a Nodejs script to listen for some action (Forward, right, back, left) from some port. Everything goes well. Camera recording works too.
A problem arise when I created a script to capture every 4 frames from the camera stream and do random action. The stream are in 30fps. So to capture 4 frames it takes roughly 130ms, after that it has to choose a random action (Forward, right, back, left). The Raspi hangs up after 3 cycle. I was thinking that the refresh rate was too fast, but that wasn't the case. Because after I added a 5 sec wait after each action, the Raspi still hangs up after 3 cycle.
The Raspi were fine if I connected the raspi output pin into some LEDS. The LEDs are blinking after the 4 frames captured successfully without any Raspi hang.
Any ideas?
Sorry for the bad english Thanks