-
Notifications
You must be signed in to change notification settings - Fork 68
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Setting default servo positions in track mode from PID controller #44
Comments
I have not yet tested this script yet, however "the last position of the scan loop before breaking" which I think it's the same cause of hangs & may be of same origin that I was looking for a resolution or answer. I noticed servo oscillate badly in V1.2 in close vicinity with subject("Face" label with Tf option enabled by using --edge-tpu option with face label ) almost in less than 3' range). I've changed this value for oscillate fix ; PID gains for tilting
It stoped oscillate in face tracking mode(label being "face") with Edge Tpu but control flow breaking is still there. My setup; (Pi4, 4GB, 8/20/20 Buster, Same Pimorini Servo Hat, Clean Install only with RPI V1.2; When object(face) goes out of FOV(beyond 90 degree servo max position or beyond about 8' in distance, cam sequentially moves to lower left -90 to right about 90 degree then does face up(toward ceiling) or face down(most of time) and hangs there(it still detect face if servo is forced to be positioned toward the face or face is placed toward close to camera whichever, but it still would not resume tracking). I'd assume that camera would remain toward last known position and wait for certain time duration like 1 minutes or some pre defined time(I'm guessing exit point will be more likely to be same entry back point), if no object is detected within that time, cam goes back to servo neutral point of pan angle 0 & tilt angle (pre-defined angle) and resume tracking once object is back in FOV. In my testing of RPI, When subject(Face) goes out of FOV, I think it only goes back to detection mode and not in tracking mode. but what strange about this is that sometimes it resumes tracking(few minutes & manual force focus and random occasion) but most of times it stuck in frozen position, not being able to track face. Adrian's PID control, I think servo goes back to predefined neutral position & resume subject tracking upon subject detection. Help will be appreciated from newbie |
Hello jp3spinelli, I ran your script and I'm getting following error; |
Corrected "ModuleNotFoundError: No module named 'RPi'" Upon Command: (.venv) pi@raspberrypi:~ $ rpi-deep-pantilt track --edge-tpu face Scanning(left & right Servo movement) is started but does not detect face nor stop toward face presented in front of camera, just continuing with none stop left & right servo movement. Did I missed any step? |
Hey @Martin2kid! How's the detection quality without pan/tilt tracking enabled? Do you have visuals on what the Pi is seeing?
|
Leigh, When I ran $ rpi-deep-pantilt detect --loglevel=DEBUG --edge-tpu face, I'm getting following error. So I ran with face tracking and short video clip was uploaded for your referance here; I think detection quality & speed is pretty good (better than using Intel NCS & OpenVINO with SSD model with similar PID setting but slower than using Caffe model without using PID, of course. Only negative thing that I noticed and struggle to figure out is that when face goes out of FOV, RPI camera is positioning toward extreme up or down, hangs & does not resume face tracking (it still detect face though) when face is returned to FOV. Error msg; (.venv) pi@raspberrypi:~ $ rpi-deep-pantilt detect --loglevel=DEBUG --edge-tpu face INFO:root:model inputs: [{'name': 'normalized_input_image_tensor', 'index': 7, 'shape': array([ 1, 320, 320, 3]), 'dtype': <class 'numpy.uint8'>, 'quantization': (0.0078125, 128), 'quantization_parameters': {'scales': array([0.0078125], dtype=float32), 'zero_points': array([128]), 'quantized_dimension': 0}}] During handling of the above exception, another exception occurred: Traceback (most recent call last): |
Leigh, I cloned Rpi-deep-pantilt from my Pi4 4GB & moved to Pi4 8GB 8-20-2020 Buster with Picam Noir for testing with Brushless FOC Gimbal setup with the Simplebgc32 controller board (I had to clone it because of pip install https://github.com/leigh-johnson/Tensorflow-bin/releases/download/v2.2.0/tensorflow-2.2.0-cp37-cp37m-linux_armv7l.whl no longer works). In my test, my hardware setup with Simplebgc32 controller board tracks really well in smooth & fast motion, PID setting change or adjustment is now much more predictable but still hangs when face goes out of FOV--face detection continue when face is back in FOV but tracking is not resuming--. For referance, my old video at; https://youtu.be/Ce-c9StqzsE which was based on Caffe model Hang behavior was same with Pimorini PanTilt hat setup, so I can conclude this is not PID setting nor Camera orientation related and thinking more toward of closed loop handling in Tf face detection input side. I tried to test with Logitech C-920 USB Webcam but could not figure out how to improvise in Tf.(note this cam worked very well with OpenCV +OpenVINO+Caffe model and produced much better detection than Picam V2.1 which was too sensitive to background lighting changes). Upon receiving constant low power status message from Pi4, (This was new behavior with Pi4 8GB with 8-20-2020 Buster and it was at 5.3Volt input setting with Coral USB connected, Pimorini Pantilt hat connected with servo motors, Cooling Fan connected). I changed Pi4's power supply voltage to 5.5Volt & Rpi-deep-pantilt tracking became much more stable & preditable, with minor jitter or very little motion spike (I think Coral USB Stick drain & Pimorini's 2 servo motors power drain were probably the main cause of random jitter & spike that I've noticed in the past. And ran "rpi-deep-pantilt detect --loglevel=DEBUG --edge-tpu face" Detection quality excellent!!! --log as follows; `(.venv) pi@raspberrypi:~/rpi-deep-pantilt $ rpi-deep-pantilt detect --loglevel=DEBUG --edge-tpu face WARNING:root:Detecting labels: ('face',) INFO:root:model inputs: [{'name': 'normalized_input_image_tensor', 'index': 7, 'shape': array([ 1, 320, 320, 3]), 'dtype': <class 'numpy.uint8'>, 'quantization': (0.0078125, 128), 'quantization_parameters': {'scales': array([0.0078125], dtype=float32), 'zero_points': array([128]), 'quantized_dimension': 0}}] |
I added a scanning procedure in the manager.py script under the set_servos function which breaks upon detection and reverts to track mode. However, the track mode has a default position where the object in question is usually left out of the FOV. Here's my script:
How do I set the initial servo position once tracking begins to the last position of the scan loop before breaking?
The text was updated successfully, but these errors were encountered: