I’m using the H7 to take pictures on a trigger, and I have it so that it can communicate with a Raspberry Pi 4 that can already watch a directory and will trigger if the contents of that folder are changed. I’ve noticed that when the H7 takes pictures and saves them ( sensor.snapshot().save(“folder/filename.jpg”) ) it will not update the folder on-board until the system has been rebooted. I’m curious if there is a way to force write the images either to the on-board SD card or to the Pi’s SD card?
You’d have to us the RPC library to transfer files. The camera emulates a USB storage disk. As such, the PC assumes files can’t be created out of nowhere so it won’t rescan for new files after pictures are taken.
You could write a program to unmount and mount the cameras drive.
I was thinking about the RPC library, thanks for the confirmation. I saw on GitHub that the program is originally for Arduino, is there additional support available for Raspberry Pi?
In my application I don’t think I could use the unmount and mount solution only because I’m trying to make sure that the trigger won’t spam trip and take a bunch of pictures at once. Unless there’s a way to preserve a timer through reboots, but I’m sure that’s a python question rather than an OpenMV question.
Thanks for your time and response!
For clarification, I’ve already got python code available to watch directories, and I have code that will do stuff once the directory is updated, also in python.
To my current understanding, I’d use the RPC library and connect the H7 to my Pi via USB. I guess I’m a little confused; am I correct in the following: I would need to implement the “RPC remote device” methods in my upython code on the H7 so it would run as the on-board main.py script, then using the Pi, implement the “RPC controller device” methods to run code in parallel with my directory watching code?
The RPC library just allows you to do serial comms with the camera. It’s designed to be robust.
You can do what you like really as for what data you move between platforms.
I’ve been working on getting the RPC example programs to run on my Raspberry Pi 4 and I’ve run into a few issues. I’ve been following the existing thread “Rpc module for Raspberry Pi” with the author gabriel_colon32. I believe I’m almost there but there’s an error occurring that I can’t figure out. To preface, on the Pi i have the program from Github “rpc_image_transfer_jpg_as_the_controller_device.py” and the example program “image_transfer_jpg_as_the_remote_device_for_your_computer.py” on my H7. I have the rpc.py file that was mentioned on the referenced forum thread in my python3 directory on my Pi. I’m getting the following output on the console:
I went into the rpc file and double checked that the “rpc_usb_vcp_master” class exists, and it does. Does anyone have any ideas? Thanks in advance!
Did you change the folder structure? The rpc.py file should be right next to the test script.
The attribute error means it can’t find that class in the file.
Got it, i placed the rpc.py file in the python3 directory. Thank you!