I have jetbot installed and I have been making progress. Now I am making a python3 script that takes camera pictures. I discovered a problem:
If I initialize an instance of the jetbot.camera.Camera class, and then call .restart() on that instance, there would be a segfault
If I call .stop() and .start(), I also get a segfault
The last lines of output looks like
GST_ARGUS: Running with following settings:
Camera index = 0
Camera mode = 0
Output Stream W = 3280 H = 2464
seconds to Run = 0
Frame Rate = 21.000000
Segmentation fault (core dumped)
it SHOULD look like (but doesn’t):
GST_ARGUS: Running with following settings:
Camera index = 0
Camera mode = 0
Output Stream W = 3280 H = 2464
seconds to Run = 0
Frame Rate = 21.000000
GST_ARGUS: PowerService: requested_clock_Hz=37126320
GST_ARGUS: Setup Complete, Starting captures for 0 seconds
GST_ARGUS: Starting repeat capture requests.
CONSUMER: Producer has connected; continuing.
(I am doing all this from the python3 interactive console, no code to post)
I am not skilled enough to identify whether this is a problem with cv2, or with python threading, or with something else, sorry. I don’t even know how to get the core dump right now.
The camera can be used again if I simply quit out of python3 and get back into python3
The camera is a IMX219, a Raspberry Pi cam v2, with 160 degree FOV
What is the problem and can this problem be fixed?
Thanks
EDIT:
I’ll admit my goal here is a bit over-engineered. I have a jetbot but with bigger motors, and a microcontroller pretending to be the motorhat over I2C. One difference is I programmed in a “safety” so I can shutdown the motors and it will ignore subsequent commands from rogue scripts. The script I am writing now is a background service that checks for a DualShock4 controller and uses it as a remote kill-switch. (I am paranoid, yes, but I’ve had 7 stitches from a home built home programmed muilticopter before)
It also handles simply remotely moving the robot. I also coded in a camera shutter button, plus a button where it will continuously take pictures. All image files are tagged with the controller state for training purposes. Example: if I drive it to follow a line on the ground, all the images will contain whether I told it to go left or right.
I don’t want this script to hog the camera, but I want the script to run all the time and auto-start to keep the robot “safe”.
Yes I understand there are several workarounds but I’d like to see if the segfault can be fixed.